Skip to content

crypto/x509: unable to parse certificate with a negative serial number #8265

Closed
@gopherbot

Description

@gopherbot

by ayazdi:

go version: go1.2.1 linux/amd64

Trying to parse an X509 certificate with a negative serial number results in the
following error:

x509: negative serial number

(see http://play.golang.org/p/zpXKadV5mo for an example)

This means an SSL/TLS connection cannot be established to a server that uses this kind
of certificate.

Although RFC 5280 [1] section 4.1.2.2 specifies that serial numbers MUST be positive, it
also says that implementations SHOULD handle non-positive serial numbers gracefully. 

Note that RFC 2459 (obsoleted by RFC 3280, which was in turn obsoleted by 5280) did not
require the SN to be positive.

[1] http://www.ietf.org/rfc/rfc5280.txt

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions