Skip to content

crypto/tls: X509KeyPair skips over invalid pem blocks but doesn't error #7042

Description

@jmhodges
What steps will reproduce the problem?
If possible, include a link to a program on play.golang.org.
1. Put three pem certs together in a file, but put the second one's BEGIN line on the
same line as the first one's end
2. Load with LoadX509KeyPair or X509KeyPair.
3. See 2 certificates loaded (the first and the last) but the second one is silently
skipped

What is the expected output?
Error when the file doesn't parse.

What do you see instead?
Loads the first and third certs with no acknowledgment of the second one.

Which operating system are you using?
This occurs on OS X and Linux


Which version are you using?  (run 'go version')
go version go1.2 darwin/amd64

`openssl x509` manages to error out both in this case and when the certs are broken up
incorrectly and the trailing dashes on the first is less by one than expected and the
leading dashes on the second is greater by one than expected.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions