- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a text that is 4 bytes whereas my key is 16 bytes. When doing AES CBC encryption with a 16 byte IV, I wish to know whether I have the option of PKCS or zero padding. Because seems like the API pretty much hides the fact what padding is going on underneath.
Can you confirm the type of padding?
/**
* @brief AES-CBC buffer encryption/decryption
*
* @param ctx AES context
* @param mode AES_ENCRYPT or AES_DECRYPT
* @param length length of the input data
* @param iv initialization vector (updated after use)
* @param input buffer holding the input data
* @param output buffer receiving the output data
*/
void aes_crypt_cbc( aes_context_t *ctx, aes_mode_type_t mode, uint32_t length, unsigned char iv[16], const unsigned char *input, unsigned char *output );
/**
* @brief AES-CBC buffer encryption/decryption with partial block padding
*
* @param ctx AES context
* @param mode AES_ENCRYPT or AES_DECRYPT
* @param length length of the input data
* @param iv initialization vector (updated after use)
* @param input buffer holding the input data
* @param output buffer receiving the output data
*/
int aes_cbc_crypt_pad_length_padding( aes_context_t *ctx, aes_mode_type_t mode, uint32_t length, const unsigned char iv[16], const unsigned char *input, unsigned char *output );
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The padding on WICED SDK 3.1.2 is PKCS5. API does not reveal anything,I found it after a few experiments involving repeated encryption and decryption. Most probably SDK 3.3.1 has PKCS5 too,since the API for AES is exactly the same.
.