Table of Contents

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

bool

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

ciphertext Stream
associatedData byte[]

Returns

Stream

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

plaintext Stream
associatedData byte[]

Returns

Stream

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

plaintextLength long

Returns

long

SealAsync(byte[], byte[])

Encrypt and authenticate a message under a freshly generated nonce.

Task<byte[]> SealAsync(byte[] plaintext, byte[] associatedData)

Parameters

plaintext byte[]

Message to encrypt.

associatedData byte[]

Data which is authenticated but not encrypted, and must be presented again to unseal the message.

Returns

Task<byte[]>

UnsealAsync(byte[], byte[])

Verify and decrypt a sealed message.

Task<byte[]> UnsealAsync(byte[] sealedMessage, byte[] associatedData)

Parameters

sealedMessage byte[]

Output of SealAsync(byte[], byte[]).

associatedData byte[]

The same associated data that was sealed with the message.

Returns

Task<byte[]>

Exceptions

CryptographicException

The message, its associated data or the key do not match.