AEADCipher.seal

ubyte[] seal(const(ubyte)[] plaintext, const(ubyte)[] aad, const(ubyte)[] nonce, ubyte[] output = null)

Encrypts and authenticates data.

Parameters

plaintextThe data to encrypt.
aadAdditional Authenticated Data (not encrypted, but authenticated).
nonceThe nonce/IV. MUST be unique for every seal call under the same key — nonce reuse in AEAD modes is catastrophic: it reveals plaintext XORs and the authentication key. A random nonceSize-byte nonce is the common safe choice.
outputOptional output buffer. If provided, it must be at least plaintext.length + tagSize bytes; otherwise implementations throw CryptoException.

Returns

The ciphertext with the authentication tag appended.

Throws

CryptoException if output is too small or encryption fails.