mbedtls icon indicating copy to clipboard operation
mbedtls copied to clipboard

Using private key (n,d) make signature, but get failure when use public key(n,e) make verify

Open 840180795github opened this issue 2 years ago • 1 comments

Summary

 I using private key (n,d) make signature on other third rsa algorithm lib, but get failure when use public key(n,e) make verify under mbedtls lib . But I success make signature and verify using "mbedtls_rsa_rsassa_pkcs1_v15_sign" and "mbedtls_rsa_pkcs1_verify" .  Also  achieve success signature and verify on other third rsa algorithm lib.
  I confirm that the difference only exist  private key format between  the third rsa algorithm lib and mbedtls lib.
  Configure pkcs1_v15 and sha256 on both lib.

System information

Mbed TLS version (number or commit id): mbedtls-2.14.1 Operating system and version: Win10 Configuration (if not default, please attach mbedtls_config.h): Use default configuration Compiler and options (if you used a pre-built binary, please indicate how you obtained it): VS2012 express Additional environment information:

Expected behavior

I using private key (n,d) make signature on other third rsa algorithm lib, and get success when use public key(n,e) make verify under mbedtls lib .

Actual behavior

I using private key (n,d) make signature on other third rsa algorithm lib, but get failure when use public key(n,e) make verify under mbedtls lib .

Steps to reproduce

Using python cryptography do signature with private key (n,d)

Additional information

840180795github avatar Sep 06 '22 02:09 840180795github

Can you please give a summary of the Python code you're using to generate the signature and the C code you're using to verify it so that we can try to reproduce?

davidhorstmann-arm avatar Sep 08 '22 16:09 davidhorstmann-arm