2020-01-12 05:28 PM
I am using X-CUBE-CRYPTOLIB V3.1.0 on STM32L0 to perform AES-192 encryption with a 192-bits key and 128-bits IV. Encrypted Data by STM32L0 can be correctly decrypted by STM32L0 using the same library.
However, when I copy the encrypted data, key and IV to some common online tools for decryption on PC, none of them can get the correct data.
The only way I can get the correct decrypted data from PC is to use OpenSSL with "-nopad" option enable. It looks the problem is related to block padding in encryption. May I know how to configure the AES-192 encryption in X-CUBE-CRYPTOLIB V3.1.0 so that other online tool is able to decrypt?
Thank you for your kind attention.
2020-01-15 01:31 AM
The X-CUBE-CRYPTOLIB V3.1.0 library does not append any padding during AES encoding. After padding the input using PKCS#7 such that input length is a multiple of AES block size, this problem is solved.