2023-11-02 04:04 AM
Hi,
I would use the STM32 Crypto Library. I have the 4.0.1 version.
I just compiled and run the RSA\PKCS1v1.5_SignVerify example on my L4 micro and it is successful.
Then, I generated with openssl a new 1024 key pair and signed a custom message. Then I copied private exponent, modulus and messagge arrays on firmware but signature is different. I checked also if SHA-1 hashes are equals, and they are. So, different behaviour in signature function. Where am I wrong?
Thank you
Solved! Go to Solution.
2023-11-02 07:50 AM
Hello @lukin ,
did you remove the heading 00 of the modulus and private exponent ?
Best regards
Jocelyn
2023-11-02 04:41 AM - edited 2023-11-02 04:42 AM
Check error returns from any lib function that can return error result. Some lib functions require a memory buffer, but IIRC there's no way to know the required size beforehand, and it changes from version to version. If you use such functions, try to double the buffer size.
2023-11-02 04:52 AM
Hi, I checked and no errors from any lib function call. I even tryed to double the size of working buffer, but signature results is the same. Thanks for suggestion.
2023-11-02 07:03 AM
2023-11-02 07:50 AM
Hello @lukin ,
did you remove the heading 00 of the modulus and private exponent ?
Best regards
Jocelyn
2023-11-02 01:48 PM
Hi Jocely,
it worked! I had a 0x00 on the heading of modulus. I did not realized it could affect results. It seems this extra byte comes from ASN.1 coding. Thank you and thanks to @Pavel A.