Skip to content

crypto/tls: better error message for X509KeyPair #11092

Description

@taylorhughes
  1. What did I do?

    // mixed up order of key and cert:
    http.ListenAndServeTLS(..., key, cert, ...)

  2. What happened?

    This resulted in the following cryptic error message:

    crypto/tls: failed to parse certificate PEM data

  3. What did I expect?

    I spent about an hour debugging various PEM format possibilities before finding the mixup.

    An error message explaining that the type of PEM block was unexpected would have saved me some time:

    crypto/tls: failed to parse certificate PEM data, expected type "CERTIFICATE", got "PRIVATE KEY"

Related issue: #7042

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions