Marmos
v juptune
v asn1
v lang
v ast
v Classes
v Enums
v ir
v parser
v Enums
v Structs
v core
v crypto
v keyexchange
v memory
v data
v alphabet
v buffer
v json
v builder
v parser
v Enums
v Structs
v serialise
v Structs
v Templates
v pem
v Enums
v Structs

Structs AeadEncryptionContext

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
module 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;
}

Documentation

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.

Functions

Name Description
decrypt

Decrypts the given cipherTextinto the outPlainTextbuffer, using the given additionalDatato calculate the authentication tag, and returns a slice outPlainTextwhich contains the final decrypted plaintext.

encrypt

Encrypts the given plaintextinto the outCipherTextbuffer, using the given additionalDatato calculate the authentication tag, and returns a slice outCipherTextwhich contains the final encrypted ciphertext + authentication tag.

Variables

Name Description
_key
_nonce