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

encrypted PKCS#8 API private keys are not supported #475

Open
obno opened this issue Jan 30, 2024 · 1 comment
Open

encrypted PKCS#8 API private keys are not supported #475

obno opened this issue Jan 30, 2024 · 1 comment

Comments

@obno
Copy link

obno commented Jan 30, 2024

Private keys created from either openssl genrsa or oci setup config are in encrypted PKCS#8 format by default. However x509.ParsePKCS8PrivateKey only supports unecrypted private keys.

This is a bit of a let down for golang based CLIs where users typically expect to use keys generated from oci setup config.

You could use github.com/youmark/pkcs8 for parsing keys, which supports encrypted keys, instead of the golang std library.

@JoshuaWR
Copy link
Member

JoshuaWR commented Feb 9, 2024

Hi @obno, not sure if this is your exact use case, but could you use helpers.PrivateKeyFromBytesWithPassword ? It should take the key, decrypt it, and then parse with x509.ParsePKCS8PrivateKey.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants