• AVR Freaks

RSA on dsPIC33E

New Member
  • Total Posts : 1
  • Reward points : 0
  • Joined: 2019/10/09 05:31:39
  • Location: 0
  • Status: offline
2019/10/11 01:10:06 (permalink)

RSA on dsPIC33E

Dear Forum Users,
for a project with dsPIC33E, I need to use RSA. I have found a RSA library into Microchip Libraries for Applications v2018-11-26, this library works well, I can encrypt with public key and decrypt with private key inside my main just for test. The problem is, that I need to decrypt chipertext produced with OpenSSL, but the dsPIC library produces a different decryption.
On PC side I use:
openssl rsautl -encrypt -pubin -inkey  public.key  -in plainbyte.txt -out cipherbyte.txt
On dsPIC side:
I have paste the cipherbyte into a global array uint8 and
    /* Test RSA-1024 encryption error conditions */

    sys_obj = RSA_SW_Initialize (RSA_SW_INDEX, NULL);
    if (sys_obj != SYS_MODULE_OBJ_STATIC)
        return false;

    if (drv_handle != RSA_SW_HANDLE)
        return false;
    cfg = RSA_SW_Configure (drv_handle, xbuf, ybuf, sizeof (xbuf), sizeof (ybuf), (RSA_SW_RandomGet)getZeroThenRandom, RSA_SW_PAD_DEFAULT);
    if (cfg == -1)
        return false;

/* decrypt the ciphertext */
    if ((status = RSA_SW_Decrypt (drv_handle, dec_m, c, &dec_m_byte_len, &rsaPrivateKey )) != RSA_SW_STATUS_READY)
        return 22;

The ciphertext is in c, instead the plaintext is in dec_m. There are same different RSA implementation between MLA and OpenSSL?
The Microchip exmple used for my test is rsa_demo in "C:\microchip\mla\v2018_11_26\apps\crypto_sw\rsa\firmware\rsa_demo.X"
Thanks for your support

0 Replies Related Threads

    Jump to:
    © 2019 APG vNext Commercial Version 4.5