]> Cypherpunks repositories - gostls13.git/commitdiff
crypto/x509: correct default X.509 version.
authorAdam Langley <agl@golang.org>
Thu, 10 Mar 2016 23:12:19 +0000 (15:12 -0800)
committerAdam Langley <agl@golang.org>
Thu, 10 Mar 2016 23:42:23 +0000 (23:42 +0000)
The default version of an X.509 certificate is v1, which is encoded on
the wire as a zero.

Fixes #13382.

Change-Id: I5fd725c3fc8b08fd978ab694a3e2d6d2a495918b
Reviewed-on: https://go-review.googlesource.com/20548
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/crypto/x509/x509.go

index 341a4602006a385d95b223231cd4d0dbc5ef4b6b..d8470bb1d086f823346b694c278d96a9e6f36b5b 100644 (file)
@@ -126,7 +126,7 @@ type certificate struct {
 
 type tbsCertificate struct {
        Raw                asn1.RawContent
-       Version            int `asn1:"optional,explicit,default:1,tag:0"`
+       Version            int `asn1:"optional,explicit,default:0,tag:0"`
        SerialNumber       *big.Int
        SignatureAlgorithm pkix.AlgorithmIdentifier
        Issuer             asn1.RawValue