예제 #1
0
 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);
 }
예제 #2
0
 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);
 }
예제 #3
0
 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);
 }
예제 #4
0
 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);
 }