Skip to content
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 when importing PEM private key #37

Closed
ptitdoc opened this issue Jun 11, 2019 · 2 comments

Comments

@ptitdoc
Copy link

commented Jun 11, 2019

When importing a traditional RSA PEM key, the following error is displayed:
Error (class org.bouncycastle.asn1.pkcs.PrivateKeyInfo cannot be cast to class org.bouncycastle.openssl.PEMKeyPair (org.bouncycastle.asn1.pkcs.PrivateKeyInfo and org.bouncycastle.openssl.PEMKeyPair are in unnamed module of loader burp.eb2 @361a5085))

@ptitdoc

This comment has been minimized.

Copy link
Author

commented Jun 11, 2019

This occurs when a key is in the format :

-----BEGIN PRIVATE KEY-----
..
-----END PRIVATE KEY-----

I converted it using openssl rsa -in mykey.key -text and retrieved from -----BEGIN RSA PRIVATE KEY----- to -----END RSA PRIVATE KEY-----

@ptitdoc ptitdoc closed this Jun 11, 2019
@mindfuckup

This comment has been minimized.

Copy link
Contributor

commented Jun 11, 2019

Hi

As you figured out, only traditional RSA keys are accepted.

For the other readers:

Traditional RSA key format:

------ BEGIN RSA PRIVATE KEY-----
[...]
-----END RSA PRIVATE KEY-----

PKCS8 Format:

------ BEGIN PRIVATE KEY-----
[...]
-----END PRIVATE KEY-----

Grz and have fun ;-),
Emanuel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.