plusaes
GCM

Functions

Error plusaes::encrypt_gcm (unsigned char *data, const std::size_t data_size, const unsigned char *aadata, const std::size_t aadata_size, const unsigned char *key, const std::size_t key_size, const unsigned char *iv, const std::size_t iv_size, unsigned char *tag, const std::size_t tag_size)
 
Error plusaes::encrypt_gcm (unsigned char *data, const std::size_t data_size, const unsigned char *aadata, const std::size_t aadata_size, const unsigned char *key, const std::size_t key_size, const unsigned char(*iv)[12], unsigned char(*tag)[16])
 
Error plusaes::decrypt_gcm (unsigned char *data, const std::size_t data_size, const unsigned char *aadata, const std::size_t aadata_size, const unsigned char *key, const std::size_t key_size, const unsigned char *iv, const std::size_t iv_size, const unsigned char *tag, const std::size_t tag_size)
 
Error plusaes::decrypt_gcm (unsigned char *data, const std::size_t data_size, const unsigned char *aadata, const std::size_t aadata_size, const unsigned char *key, const std::size_t key_size, const unsigned char(*iv)[12], const unsigned char(*tag)[16])
 

Detailed Description

GCM mode functions

Function Documentation

◆ decrypt_gcm() [1/2]

Error plusaes::decrypt_gcm ( unsigned char *  data,
const std::size_t  data_size,
const unsigned char *  aadata,
const std::size_t  aadata_size,
const unsigned char *  key,
const std::size_t  key_size,
const unsigned char *  iv,
const std::size_t  iv_size,
const unsigned char *  tag,
const std::size_t  tag_size 
)
inline

Decrypts data with GCM mode and checks an authentication tag.

You can specify iv size and tag size. But usually you should use the other overloaded function whose iv and tag size is fixed.

Returns
kErrorOk
kErrorInvalidKeySize
kErrorInvalidIvSize
kErrorInvalidTagSize
kErrorInvalidTag

◆ decrypt_gcm() [2/2]

Error plusaes::decrypt_gcm ( unsigned char *  data,
const std::size_t  data_size,
const unsigned char *  aadata,
const std::size_t  aadata_size,
const unsigned char *  key,
const std::size_t  key_size,
const unsigned char(*)  iv[12],
const unsigned char(*)  tag[16] 
)
inline

Decrypts data with GCM mode and checks an authentication tag.

Parameters
[in,out]dataInput data and output buffer. This buffer is replaced with decrypted data.
[in]data_sizedata size
[in]aadataAdditional Authenticated data
[in]aadata_sizeaadata size
[in]keyCipher key
[in]key_sizeCipher key size. This value must be 16 (128-bit), 24 (192-bit), or 32 (256-bit).
[in]ivInitialization vector
[in]tagAuthentication tag data
Returns
kErrorOk
kErrorInvalidKeySize
kErrorInvalidTag

◆ encrypt_gcm() [1/2]

Error plusaes::encrypt_gcm ( unsigned char *  data,
const std::size_t  data_size,
const unsigned char *  aadata,
const std::size_t  aadata_size,
const unsigned char *  key,
const std::size_t  key_size,
const unsigned char *  iv,
const std::size_t  iv_size,
unsigned char *  tag,
const std::size_t  tag_size 
)
inline

Encrypts data with GCM mode and gets an authentication tag.

You can specify iv size and tag size. But usually you should use the other overloaded function whose iv and tag size is fixed.

Returns
kErrorOk
kErrorInvalidKeySize
kErrorInvalidIvSize
kErrorInvalidTagSize

◆ encrypt_gcm() [2/2]

Error plusaes::encrypt_gcm ( unsigned char *  data,
const std::size_t  data_size,
const unsigned char *  aadata,
const std::size_t  aadata_size,
const unsigned char *  key,
const std::size_t  key_size,
const unsigned char(*)  iv[12],
unsigned char(*)  tag[16] 
)
inline

Encrypts data with GCM mode and gets an authentication tag.

Parameters
[in,out]dataInput data and output buffer. This buffer is replaced with encrypted data.
[in]data_sizedata size
[in]aadataAdditional Authenticated data
[in]aadata_sizeaadata size
[in]keyCipher key
[in]key_sizeCipher key size. This value must be 16 (128-bit), 24 (192-bit), or 32 (256-bit).
[in]ivInitialization vector
[out]tagCalculated authentication tag data
Returns
kErrorOk
kErrorInvalidKeySize