1 Reply Latest reply on Nov 2, 2015 8:59 AM by anirudh88

    Padding options in AES CBC Encrypt (Wiced SDK 3.3.1)

      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 );