This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

LP-AM263P: Aes Encryption online calculator

Part Number: LP-AM263P

Tool/software:

Hi Team , 

  I referred 4 to 5 online calculators for aes 128 cbc encryption , none of them matches with the result provided in aes example code provided in mcu_plus_sdk . So , I need aes cbc 128bit encryption online calculator which should matches with the our example code result.

Regards, 
K.Sravya.

  • I used the plain text, key and IV from crypto_aes_cbc_128.c:

    /* Input buffer for encryption or decryption */
    static uint8_t gCryptoAesCbc128PlainText[APP_CRYPTO_AES_CBC_128_INOUT_LENGTH] __attribute__ ((aligned (APP_CRYPTO_AES_CBC_128_CATCHE_ALIGNMENT))) =
    {
        0x98, 0x3B, 0xF6, 0xF5, 0xA6, 0xDF, 0xBC, 0xDA,
        0xA1, 0x93, 0x70, 0x66, 0x6E, 0x83, 0xA9, 0x9A
    };
    
    /* The AES algorithm encrypts and decrypts data in blocks of 128 bits. It can do this using 128-bit or 256-bit keys */
    static uint8_t gCryptoAesCbc128Key[APP_CRYPTO_AES_CBC_128_KEY_LENGTH_IN_BYTES] __attribute__ ((aligned (APP_CRYPTO_AES_CBC_128_CATCHE_ALIGNMENT))) =
    {
        0x93, 0x28, 0x67, 0x64, 0xA8, 0x51, 0x46, 0x73,
        0x0E, 0x64, 0x18, 0x88, 0xDB, 0x34, 0xEB, 0x47
    };
    
    /* Initialization vector (IV) is an arbitrary number that can be used along with a secret key for data encryption/decryption. */
    static uint8_t gCryptoAesCbc128Iv[APP_CRYPTO_AES_CBC_128_IV_LENGTH_IN_BYTES] __attribute__ ((aligned (APP_CRYPTO_AES_CBC_128_CATCHE_ALIGNMENT))) =
    {
        0x19, 0x2D, 0x9B, 0x3A, 0xA1, 0x0B, 0xB2, 0xF7,
        0x84, 0x6C, 0xCB, 0xA0, 0x08, 0x5C, 0x65, 0x7A
    };

    I input it here:

    AES Encryption: Encrypt and decrypt online - cryptii

    It matches the encrypted text here:

    /* Encrypted buffer of gCryptoAesCbc128PlainText */
    static uint8_t gCryptoAesCbc128CipherText[APP_CRYPTO_AES_CBC_128_INOUT_LENGTH] __attribute__ ((aligned (APP_CRYPTO_AES_CBC_128_CATCHE_ALIGNMENT))) =
    {
        0x28, 0x33, 0xdc, 0xc7, 0x24, 0xdc, 0x6a, 0xff,
        0x5a, 0x72, 0xe4, 0x3d, 0xdf, 0xb6, 0x63, 0x35
    };
    

  • Hi Sravya,

    In the online calculators that you use, is the IV (Initialization Vector) the same as the one you try to use in the SDK? We do have internal test suites to make sure the encryptions happen according to the AES Standards.

    Also, is the output format & padding same? (hex, base64 etc)

    Thanks Kier for the very quick response!

    Regards,
    Shaunak