private void EncryptCore( ReadOnlySpan <byte> nonce, ReadOnlySpan <byte> plaintext, Span <byte> ciphertext, Span <byte> tag, ReadOnlySpan <byte> associatedData = default) { AeadCommon.Encrypt(_keyHandle, nonce, associatedData, plaintext, ciphertext, tag); }
private void DecryptCore( ReadOnlySpan <byte> nonce, ReadOnlySpan <byte> ciphertext, ReadOnlySpan <byte> tag, Span <byte> plaintext, ReadOnlySpan <byte> associatedData = default) { AeadCommon.Decrypt(_keyHandle, nonce, associatedData, ciphertext, tag, plaintext, clearPlaintextOnFailure: true); }
private void DecryptCore( ReadOnlySpan <byte> nonce, ReadOnlySpan <byte> ciphertext, ReadOnlySpan <byte> tag, Span <byte> plaintext, ReadOnlySpan <byte> associatedData = default) { // BCrypt implementation of CCM clears plaintext for you on failure AeadCommon.Decrypt(_keyHandle, nonce, associatedData, ciphertext, tag, plaintext, clearPlaintextOnFailure: false); }
public void Decrypt(byte[] nonce, byte[] ciphertext, byte[] tag, byte[] plaintext, byte[]?associatedData = null) { AeadCommon.CheckArgumentsForNull(nonce, plaintext, ciphertext, tag); Decrypt((ReadOnlySpan <byte>)nonce, ciphertext, tag, plaintext, associatedData); }