Skip to main content
molecule.192
Associate
Jan 13, 2020 1:28 AM UTC
Question

How to make X-CUBE-CRYPTOLIB V3.1.0 to perform AES-192 encryption compatible with other online tools?

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.

This topic has been closed for replies.

1 reply

molecule.192
Associate
Jan 15, 2020 9:31 AM UTC

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.