1

(8 replies, posted in wolfCrypt)

Hi Anthony,

Thank you for your tips, I tried to import the function and I added a custom function to import all the parameters from the generated key to other keys (private and public) using the available functions. It seems to work fine. However, I don't think there is a way to check if the imported keys (using wc_RsaPrivateKeyDecodeRaw & wc_RsaPublicKeyDecodeRaw) are good or not. The wc_CheckRsaKey function works well for the generated RSA key, but I don't think I can use it to check if the public key is good, nor the key pair (public + private) are a match, and even when I try to check the private key which contains all the parameters and seems to be identical to the generated key, it doesn't work. Also, wc_RsaPrivateKeyDecodeRaw and wc_RsaPublicKeyDecodeRaw always returned 0 for me, even when I put random numbers such as the d parameter for the private key and without filling dP and dQ so that the function needs to calculate them, which seems weird.

I'm not sure I will play with the library for the next days, so maybe I will wait for the next release, even though I'm not sure it will fix all my issues.

Sorry for being annoying with these problems !

Warm regards, Adrien

2

(8 replies, posted in wolfCrypt)

Hi,

I will need to take a closer look at this then but this helps.

I first used wolfSSL through the STM32CubeIDE and the Software Packs Manager that includes the 5.7.0 release version of wolfSSL from March. However, with this version, I don't have the last updates including the new wc_RsaPrivateKeyDecodeRaw function from a few weeks ago and I need to figure out how to integrate the github repository to my project.

If you have any suggestions, I take it !

Best regards, Adrien

3

(8 replies, posted in wolfCrypt)

Hi,

I may have one more question. In order to use wc_RsaPrivateKeyDecodeRaw, we need the different values n, e, d, p and q we can easily get from wc_RsaExportKey, however, however there's no such a function to get dP & dQ, right ? Do I need to flatten these parameters by mysleft or is there a hidden function to do this ?

4

(8 replies, posted in wolfCrypt)

Hi Anthony,

Thank you very much for your help !
I was looking for such a function but didn't find it, I finally found it on your GitHub !
I think this will fix my issue. Thanks again !

Best regards, Adrien

5

(8 replies, posted in wolfCrypt)

Hello !

I'm new on this forum and I recently started working with wolfCrypt on STM32(H725).

I would like to get a secured communication with a Python application with which the STM32 is communicating using RSA data encryption/decryption and digital signature. I started small trying to manually populate the keys its components (n, e for public key, n, d, p, q, dP, dQ, u for private key) in order for each entity to know the public key of the other entity. When doing so and verifying the key using wc_CheckRsaKey, I got ret = RSA_KEY_PAIR_E (-262, from rsa.c -> wc_CheckRsaKey -> _ifc_pairwise_consistency_test -> wc_RsaSSL_Sign -> ret = -234 -> ret = -262).

I know it is possible to create a RsaKey object in Python using Crypto.PublicKey.RSA with (n, e, d, p, q, dP, dQ, u) and I would like to do the same thing using wolfCrypt on STM32. Is it possible ?

Also, I would like to store the STM32 RSA private key on internal flash memory to get it back after a reboot. Is there a solution ?

Thanks for your help !