Interface IAeadAlgorithm
- Namespace
- The.Security.Cryptography
- Assembly
- Instagile.dll
An initialised AES-GCM key, which encrypts and authenticates whole messages.
public interface IAeadAlgorithm : IDisposable
- Inherited Members
Remarks
Sealed messages are laid out as a 12-byte random nonce, the ciphertext and a 16-byte tag, identically on every platform.
Properties
IsStreamingSupported
If false, because the algorithm was not created for streaming, EncryptStream(Stream, byte[]) and DecryptStream(Stream, byte[]) will throw.
bool IsStreamingSupported { get; }
Property Value
Methods
DecryptStream(Stream, byte[])
Decrypt the output of EncryptStream(Stream, byte[]), throwing rather than returning any part that fails verification. The result owns ciphertext, outlives this algorithm and, in WebAssembly, can only be read asynchronously.
Stream DecryptStream(Stream ciphertext, byte[] associatedData)
Parameters
Returns
EncryptStream(Stream, byte[])
Encrypt a stream in independently authenticated segments, so that it can be decrypted without buffering. The result owns plaintext, outlives this algorithm and, in WebAssembly, can only be read asynchronously.
Stream EncryptStream(Stream plaintext, byte[] associatedData)
Parameters
Returns
GetKey()
Serialise the key material for use elsewhere.
byte[] GetKey()
Returns
- byte[]
GetStreamCiphertextLength(long)
The length of EncryptStream(Stream, byte[])'s output for a plaintext of the given length.
long GetStreamCiphertextLength(long plaintextLength)
Parameters
plaintextLengthlong
Returns
SealAsync(byte[], byte[])
Encrypt and authenticate a message under a freshly generated nonce.
Task<byte[]> SealAsync(byte[] plaintext, byte[] associatedData)
Parameters
plaintextbyte[]Message to encrypt.
associatedDatabyte[]Data which is authenticated but not encrypted, and must be presented again to unseal the message.
Returns
UnsealAsync(byte[], byte[])
Verify and decrypt a sealed message.
Task<byte[]> UnsealAsync(byte[] sealedMessage, byte[] associatedData)
Parameters
sealedMessagebyte[]Output of SealAsync(byte[], byte[]).
associatedDatabyte[]The same associated data that was sealed with the message.
Returns
Exceptions
- CryptographicException
The message, its associated data or the key do not match.