Skip to content

Commit 1b8d4ca

Browse files
committed
crypto/x509: correct default X.509 version.
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 <[email protected]>
1 parent 1c2bdfb commit 1b8d4ca

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/crypto/x509/x509.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ type certificate struct {
126126

127127
type tbsCertificate struct {
128128
Raw asn1.RawContent
129-
Version int `asn1:"optional,explicit,default:1,tag:0"`
129+
Version int `asn1:"optional,explicit,default:0,tag:0"`
130130
SerialNumber *big.Int
131131
SignatureAlgorithm pkix.AlgorithmIdentifier
132132
Issuer asn1.RawValue

0 commit comments

Comments
 (0)