cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 Crypto LIB using RSA and OpenSSL

arivas
Associate
Posted on November 18, 2015 at 11:25

Hi All,

I'm trying to sign with a private key in the STM32 and then verify on Linux with OpenSSL, to do this I'm doing the next experiments:

1. Generating the key pair (private/public) for RSA 1014 on linux with OpenSSL

2. Generating the exponents and modulus and copying it on the STM32

3. Signing a known text like ''this is a test'' with the private key and comparing the result with the same text signed in linux with the same private key... But.. the results are different...

Can anybody help me to know how to use the same key in linux and in the STM32 Crypto library to get the same results?

Thanks

4 REPLIES 4
Nesrine M_O
Lead II
Posted on November 18, 2015 at 15:03

Hi alis.alejandro,

Is the CRC disabled? If yes, please enable it; it has to be enabled before using the STM32 Crypto library.

-Syrine-

arivas
Associate
Posted on November 18, 2015 at 16:20

Hi Syrine,

The CRC is activated, in fact, if I use the keys in sample code provided by ST the programs can sign and verify ok.. but.. my problem is to use this library with OpenSSL or similar to sign in the microcontroller and veryfy in a computer.

Thanks

dm
Associate
Posted on May 31, 2016 at 22:58

Hi!

Just solved the similar problem.

Check:

in hal_conf.h enabled:

 #define HAL_CRC_MODULE_ENABLED   

 #define HAL_CRYP_MODULE_ENABLED  

in your system init function:

 /* Enable CRC clock */

  __CRC_CLK_ENABLE();

For me for now works!

P.S I used AES-OFB-256 stuff.

Good luck!

emil23
Associate
Posted on December 01, 2016 at 12:44

I had a similar problem, where I was successfully able to sign and verify a file locally on the STM32 and similarly on a Linux machine running OpenSSL. It turns it that there are two ways of performing RSA signing in OpenSSL, as described 

http://stackoverflow.com/questions/9951559/difference-between-openssl-rsautl-and-dgst

Signing with dgst instead of rsautl worked for me.