-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
crypto/x509: no support for parsing encrypted PKCS8 private keys #8860
Comments
No plans to implement this. If it's encrypted at the PEM layer, you can use http://godoc.org/crypto/x509#DecryptPEMBlock. If it's actually the PKCS#5/PKCS#8 encryption then you're correct that there's no Go support. Status changed to LongTerm. |
Related bug #6722 that when solved could help close this one. |
This lib worked for me: |
I have no opinion on the subject. Not a domain expert. |
Change https://golang.org/cl/264159 mentions this issue: |
It's unfortunate that we don't implement PKCS#8 encryption (#8860) so we can't recommend an alternative but PEM encryption is so broken that it's worth deprecating outright. Fixes #41949 Fixes #32777 Change-Id: Ieb46444662adec108d0de3550b693a50545c2344 Reviewed-on: https://go-review.googlesource.com/c/go/+/264159 Trust: Filippo Valsorda <[email protected]> Trust: Roland Shoemaker <[email protected]> Run-TryBot: Filippo Valsorda <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Roland Shoemaker <[email protected]>
@FiloSottile should this issue be closed as well? Since |
I believe the "golang.org/x/" packages have a chance to be included in the standard library in the future. Its still valid to ask for standard library support even if there are 3rd party or "golang.org/x/" pacakge(s) for it. If something is essential enough, a standard library support is usually better. |
We can and do vendor packages from x/crypto to implement the standard library, that's not a problem. The hard part here as always is figuring out a good API and deciding where to expose it. |
Is there any progress on this? We offer legacy PEM encryption in golang-jwt (formerly https://github.com/dgrijalva/jwt-go), but want/need to deprecate it as well (see golang-jwt/jwt#45). Since we are very keen on only relying to the Go stdlib, we are a little bit stuck with regards to alternatives. |
@oxisto here is one implementation that I created that imitates the deprecated APIs, but work with PKCS#8 encrypted keys: func DecryptPKCS8PrivateKey(data, password []byte) ([]byte, error)
func EncryptPKCS8PrivateKey(rand io.Reader, data, password []byte, alg x509.PEMCipher) (*pem.Block, error) @FiloSottile: I'm open to creating a PR and add it to |
@maraino I'm looking into using your implementation, but it seems to lack password verification ( |
@jorygeerts just added an issue to implement it. |
…certificados. Referência para a biblioteca obtida em: golang/go#8860 (comment).
Is this still a |
by alex.gaynor:
The text was updated successfully, but these errors were encountered: