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

Functions AeadEncryptionContext.encrypt

1
2
3
4
5
6
7
8
module juptune.crypto.aead;

Result encrypt(
    SecureMemory. plaintext, 
    ubyte[] additionalData, 
    ubyte[] outCipherText, 
    ubyte[] outCipherTextSlice
);

Documentation

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.

Assertions

plaintextmust not be empty, it makes no sense to encrypt an empty buffer.

outCipherTextmust be at least plaintext.length + AeadAlgorithmT.ABYTESin length. Where ABYTES is typically the length of the authentication tag.

Notes

This is a "combined" AEAD encryption, where the authentication tag is appended to the ciphertext. You can retrieve the tag by taking the last AeadAlgorithmT.ABYTESbytes of outCipherTextSlice.

Params

Throws

Anything that AeadAlgorithmT.encryptthrows.

Returns

A Resultthat indicates if the encryption was successful or not.