-
Notifications
You must be signed in to change notification settings - Fork 17.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
encoding/pem: be more permissive about decoding empty blocks.
As noted in bug #10980, an empty PEM block is encoded as -----BEGIN foo----- -----END foo----- However, Decode failed to process this. RFC 1421 doesn't answer what the encoding of the empty block should be because PEM messages always contain at least one header. However, PEM these days is just the encoding format – nobody uses the rest of PEM any longer. Having the empty block not contain a newline seems most correct because https://tools.ietf.org/html/rfc1421#section-9 clearly says that the optional “pemtext” carries the leading new-line with it. So if omitted, the new-line should be omitted too. None the less, this changes makes encoding/pem permissive, accepting any number of blank lines in an empty PEM block. Fixes #10980 Change-Id: If36bdfbf991ee281eccd50b56ddc95f24c6debb2 Reviewed-on: https://go-review.googlesource.com/10516 Reviewed-by: Brad Fitzpatrick <[email protected]> Run-TryBot: Adam Langley <[email protected]>
- Loading branch information
Showing
2 changed files
with
113 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters