encoding/pem: should allow whitespace in the base64 body #54054
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What did you do?
Paste valid PEM data in the example above. The whitespace indentation must be included. Typical output:
What did you expect to see?
Take the whitespace out of the PEM and see something like this:
Per RFC 7468 says whitespace SHOULD be ignored. It's not a bug for this module to reject whitespace. But the RFC is absolutely clear that PEMs with whitespace can exist in the world, and is tolerated by some parsers, and I would expect this general purpose module to tolerate the whitespace as well.
Further, RFC 2045 is more explicit and says non-base64 characters MUST be ignored. Since the inner body of the PEM is base64, I would expect whitespace to be ignored by the golang parser.
What did you see instead?
Leading whitespace within the lines of the PEM octets causes the parser to fail.
The text was updated successfully, but these errors were encountered: