-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error during RSA Key parse. #7786
Comments
Please try with
Also, please note that Mbed TLS 2.16 has not been supported since December 2021. Please upgrade to Mbed TLS 2.28 LTS (which will be supported until December 2024) or the current releases (3.x). |
Try this please |
@ljluestc
Actual behavior
I want the second data to be a PKCS#8 private key, but it's not working. Does the code you gave me work only with mbedTLS 3.x? BR, |
PKCS#1 vs PKCS#8 are representation formats. Once the key is parsed, it's an RSA key, regardless of what its format was before parsing.
|
I just want to check if the data I input is in PKCS#8 format. I wonder if the above code works normally in version 2.28 or higher, or if it is only supported in 3.x. |
Mbed TLS doesn't have an API for that. If you really need this information, you can do some of the parsing manually:
I can't think of a relevant difference between 2.28 and 3.x here.
Yes. |
I'm closing this issue because the reported code is working as documented. |
Summary
First of all, I'm not sure if I can leave a question here as it's my first time here.
Calling mbedtls_pk_parse_key returns 3d00.
I am trying to write a code that checks whether the RSA private key data input from the outside is PKCS#1 or PKCS#8.
The code I'm testing is:
System information
Mbed TLS version (number or commit id):
-> mbedtls version: 2.16.3
Operating system and version:
-> ubuntu 20.04
Configuration (if not default, please attach
mbedtls_config.h
):Compiler and options (if you used a pre-built binary, please indicate how you obtained it):
Additional environment information:
-> I just downloaded the package from ubuntu as below.
Expected behavior
If I run the above test code, I hope the log will come out as below.
This is a PKCS#1 private key
This is a PKCS#8 private key
Actual behavior
mbedtls version: 2.16.3
Failed to parse PKCS#1 private key :: 3d00
Steps to reproduce
Just compile and run the test code above.
Additional information
The key data used the following site.
https://keytool.online/
The text was updated successfully, but these errors were encountered: