-
Notifications
You must be signed in to change notification settings - Fork 18k
encoding/pem: pem.Decode should take care of PEM file's encapsulation boundaries #16335
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
/cc @agl |
I don't immediately see where the RFC requires that the PEM block end with a newline. I'm usually happy to make things strict but this case isn't clear to me. |
it is not about newline, it's about the footer of the PEM file. there should be five |
Ha, right. Sorry I didn't see that. Patch coming. |
CL https://golang.org/cl/27391 mentions this issue. |
@agl I don't think this PR was rolled out as thoughtfully as it should have been; this made the same production Go code (and the same config files) when redeployed with an updated version of Go break.... all because some config files were missing a dash. 😿 Since not being strict here wasn't really a security issue I would suggest that in the future fixes for issues of trivial severity, but potentially high impact, like this warn/log for a Go version before they start enforcing. Thanks! |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.6.2 darwin/amd64
What operating system and processor architecture are you using (
go env
)?What did you do?
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
code: https://play.golang.org/p/kjL-dBzhI5
according to rfc1421 4.4 Encapsulation Mechanism, the key is in invaild format
when I run the command
openssl rsa -noout -text -in test.key
, the following error occurred:similar issue goes here:
http://stackoverflow.com/questions/18460035/unable-to-load-private-key-pem-routinespem-read-biono-start-linepem-lib-c6
output message:
fail to decode the key
output message:
success to decode the key
maybe the following patch help
The text was updated successfully, but these errors were encountered: