Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Feature Request - Support for pkcs8 #174

Open
Gazza7205 opened this issue Oct 21, 2017 · 3 comments
Open

Feature Request - Support for pkcs8 #174

Gazza7205 opened this issue Oct 21, 2017 · 3 comments

Comments

@Gazza7205
Copy link

Simple read function for pkcs8 files - I've built something for this (in the process of.. simple as), will push for review if successful. Additional function in pem.js

Use case:
Verify/Read any pkcs8 file

Openssl steps

1.) Create a private key pair
openssl req -x509 -newkey rsa:4096 -keyout test.pem -out test.crt -days 365 -subj "/C=Test/ST=Test/L=London/O=Pemjs/OU=Pemjs/CN=Pemjs.com" -passout pass:Password

2.) Convert to PKCS8 format
openssl pkcs8 -inform pem -in test.pem -topk8 -outform der -out test.p8 -v1 PBE-SHA1-3DES -passin pass:Password -passout pass:Password

3.) Extract private key from pkcs8 file.
openssl pkcs8 -in test.p8 -inform DER -v1 PBE-SHA1-3DES -passin pass:Password

4.) Do something with it....

Considerations
1.) Inform could be an unknown, check DER, check PEM
2.) Encryption alg could be an unknown, explicit support for strong algs only?

@Dexus
Copy link
Owner

Dexus commented Oct 23, 2017

You are welcome to open a PR when you need it fast...

@ljfio
Copy link

ljfio commented Apr 11, 2018

I've added in a simple function to convert a private key from RSA to PKCS8 in my fork

This works for my use case: openssl pkcs8 -topk8 -in private_key.pem -nocrypt

Before I make a pull request, would we prefer having support for all the other options like: -v1 alg and -outform DER?

@Dexus
Copy link
Owner

Dexus commented Apr 11, 2018 via email

@Dexus Dexus added this to the 2.0 milestone Jan 25, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

3 participants