1234567891011121314151617181920module juptune.crypto.aead;
struct AeadEncryptionContext(
AeadAlgorithmT
)
{
/++ FUNCTIONS ++/
/// Decrypts the given cipherText into the outPlainText buffer, using the given additionalData to calculate the authentication tag, and returns a slice outPlainText which contains the final decrypted plaintext.
Result decrypt(ubyte[] cipherText, ubyte[] additionalData, SecureMemory. outPlainText, SecureMemory. outPlainTextSlice);
/// Encrypts the given plaintext into the outCipherText buffer, using the given additionalData to calculate the authentication tag, and returns a slice outCipherText which contains the final encrypted ciphertext + authentication tag.
Result encrypt(SecureMemory. plaintext, ubyte[] additionalData, ubyte[] outCipherText, ubyte[] outCipherTextSlice);
/++ VARIABLES ++/
///
SecureMemory. _key;
///
SecureMemory. _nonce;
}
Provides a generic interface for AEAD encryption and decryption.
To understand what AeadAlgorithmTis, see the AeadIetfChacha20Poly1305struct as an example.
This struct makes extensive use of the SecureMemorystruct to help encourage secure storage of sensitive memory.
This struct is weakly safe as there are certain behaviours and access patterns that are not possible to prevent at compile time.
| Name | Description |
|---|---|
| decrypt |
Decrypts the given |
| encrypt |
Encrypts the given |
| Name | Description |
|---|---|
| _key | |
| _nonce |