Exemplo n.º 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);
 }
Exemplo n.º 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);
 }
Exemplo n.º 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);
 }
Exemplo n.º 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);
 }