-
Notifications
You must be signed in to change notification settings - Fork 18k
proposal: crypto/x509: add support for PBES2 private keys #39241
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
Comments
From OpenSSL manual:
So my key is encrypted using PBES2. It seems to be default for I wrote quick and dirty function to decrypt PBES2: https://play.golang.org/p/BK9rxDD87ur Feel free to use it if you decide to implement this feature. EDIT: Added padding handling to my function. |
Thank you for filing this issue @shibe2 and welcome to the Go project! I shall tag some experts @FiloSottile @katiehockman @retornam to also beware of this change. @shibe2 if all goes great, perhaps this could be an addition to crypto/x509 or x/crypto/. Thank you. |
What would it mean for crypto/x509 to support encrypted private keys? Where would it get the decryption keys? |
Sorry, I missed x509.DecryptPEMBlock. I assume the proposal is to handle PBES2 in that function in addition to the current DEK-Info-based switch. Is there any header that is set in the PBES2-encrypted keys? |
PBES2 key blocks can be identified by PEM label (type) "ENCRYPTED PRIVATE KEY" and |
This proposal has been added to the active column of the proposals project |
Based on the discussion above, this proposal seems like a likely decline. |
No change in consensus, so declined. |
What version of Go are you using (
go version
)?1.14.3
Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?linux/amd64
What did you do?
I generated ECDSA private key with OpenSSL 1.1.1g using
req -newkey
. It asked for a password and encrypted the key. However, it didn't add headers like "Proc-Type" and "DEK-Info". If I decrypt the key using OpenSSL, it is usable for Go TLS, but Go itself cannot decrypt it.https://play.golang.org/p/cU7jBbRIHt9
What did you expect to see?
IsEncryptedPEMBlock: true
key type: *ecdsa.PrivateKey
What did you see instead?
IsEncryptedPEMBlock: false
x509: no DEK-Info header in block
The text was updated successfully, but these errors were encountered: