AEADCipher.seal
ubyte[] seal(const(ubyte)[] plaintext, const(ubyte)[] aad, const(ubyte)[] nonce, ubyte[] output = null)Encrypts and authenticates data.
Parameters
plaintext | The data to encrypt. |
aad | Additional Authenticated Data (not encrypted, but authenticated). |
nonce | The 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. |
output | Optional 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.