class AEAD

Defined at line 27 of file ../../src/security/lib/fcrypto/aead.h

Public Methods

zx_status_t InitSeal (Algorithm aead, const Secret & key, const Bytes & iv)

Sets up the AEAD to use the algorithm indicated by |aead| to encrypt data using the given

|key| and |iv|.

Defined at line 51 of file ../../src/security/lib/fcrypto/aead.h

zx_status_t InitOpen (Algorithm aead, const Secret & key, const Bytes & iv)

Sets up the AEAD to use the algorithm indicated by |aead| to decrypt data using the given

|key| and |iv|.

Defined at line 57 of file ../../src/security/lib/fcrypto/aead.h

void AEAD ()

Defined at line 112 of file ../../src/security/lib/fcrypto/aead.cc

void ~AEAD ()

Defined at line 114 of file ../../src/security/lib/fcrypto/aead.cc

zx_status_t GetKeyLen (Algorithm aead, size_t * out)

Gets the number of bytes needed for the symmetric key used by the given |aead|.

Defined at line 64 of file ../../src/security/lib/fcrypto/aead.cc

zx_status_t Seal (const Bytes & ptext, uint64_t * out_nonce, Bytes * out_ctext)

Encrypts data from |ptext| to |ctext|, based on the parameters set in |InitSeal|. Saves the

|iv| used; |iv| will be resized and filled automatically. The AEAD tag is stored at the end

of |ctext| This method will fail if called 2^64 or more times with the same key and IV. The

second variant includes additional authenticated data in the tag calculation.

Defined at line 65 of file ../../src/security/lib/fcrypto/aead.h

zx_status_t Seal (const Bytes & ptext, const Bytes & aad, uint64_t * out_nonce, Bytes * out_ctext)

Defined at line 68 of file ../../src/security/lib/fcrypto/aead.h

zx_status_t Open (uint64_t nonce, const Bytes & ctext, Bytes * out_ptext)

Decrypts data from |ctext| to |ptext|, based on the parameters set in |InitOpen|.

Decryption can only succeed if the |iv| matches those produced by |Seal| and the AEAD tag is

included in |ctext|. The second variant includes additional authenticated data in the tag

calculation.

Defined at line 76 of file ../../src/security/lib/fcrypto/aead.h

zx_status_t Open (uint64_t nonce, const Bytes & ctext, const Bytes & aad, Bytes * out_ptext)

Defined at line 79 of file ../../src/security/lib/fcrypto/aead.h

zx_status_t GetIVLen (Algorithm aead, size_t * out)

Gets the number of bytes needed for the initialization vector (IV) used by the given

|aead|.

Defined at line 80 of file ../../src/security/lib/fcrypto/aead.cc

zx_status_t GetTagLen (Algorithm aead, size_t * out)

Gets the length of an authentication tag created by the given |aead|.

Defined at line 96 of file ../../src/security/lib/fcrypto/aead.cc

void Reset ()

Clears all state from this instance.

Defined at line 198 of file ../../src/security/lib/fcrypto/aead.cc

Enumerations

enum Algorithm
Name Value
kUninitialized 0
kAES128_GCM 1
kAES128_GCM_SIV 2

Algorithm enumerates the supported secret key ciphers.

Defined at line 30 of file ../../src/security/lib/fcrypto/aead.h