plusaes
CBC

Functions

Error plusaes::encrypt_cbc (const unsigned char *data, const unsigned long data_size, const unsigned char *key, const unsigned long key_size, const unsigned char(*iv)[16], unsigned char *encrypted, const unsigned long encrypted_size, const bool pads)
 
Error plusaes::decrypt_cbc (const unsigned char *data, const unsigned long data_size, const unsigned char *key, const unsigned long key_size, const unsigned char(*iv)[16], unsigned char *decrypted, const unsigned long decrypted_size, unsigned long *padded_size)
 

Detailed Description

CBC mode functions

Function Documentation

◆ decrypt_cbc()

Error plusaes::decrypt_cbc ( const unsigned char *  data,
const unsigned long  data_size,
const unsigned char *  key,
const unsigned long  key_size,
const unsigned char(*)  iv[16],
unsigned char *  decrypted,
const unsigned long  decrypted_size,
unsigned long *  padded_size 
)
inline

Decrypt data with CBC mode.

Parameters
[in]dataData bytes.
[in]data_sizeData size.
[in]keyKey bytes.
[in]key_sizeKey size.
[in]ivInitialize vector.
[out]decryptedDecrypted data buffer.
[in]decrypted_sizeDecrypted data buffer size.
[out]padded_sizeIf this value is NULL, this function does not remove padding. If this value is not NULL, this function removes padding by PKCS and returns padded size using padded_size.
Since
1.0.0

◆ encrypt_cbc()

Error plusaes::encrypt_cbc ( const unsigned char *  data,
const unsigned long  data_size,
const unsigned char *  key,
const unsigned long  key_size,
const unsigned char(*)  iv[16],
unsigned char *  encrypted,
const unsigned long  encrypted_size,
const bool  pads 
)
inline

Encrypt data with CBC mode.

Parameters
[in]dataData.
[in]data_sizeData size. If the pads is false, data size must be multiple of 16.
[in]keykey bytes. The key length must be 16 (128-bit), 24 (192-bit) or 32 (256-bit).
[in]key_sizekey size.
[in]ivInitialize vector.
[out]encryptedEncrypted data buffer.
[in]encrypted_sizeEncrypted data buffer size.
[in]padsIf this value is true, encrypted data is padded by PKCS. Encrypted data size must be multiple of 16. If the pads is true, encrypted data is padded with PKCS. So the data is multiple of 16, encrypted data size needs additonal 16 bytes.
Since
1.0.0