]> Cypherpunks repositories - gostls13.git/commit
encoding/asn1: support fractions of a second when unmarshaling GeneralizedTime
authorMichael Teichgraeber <mteichgraeber@gmx.de>
Thu, 19 Apr 2018 23:22:30 +0000 (01:22 +0200)
committerGopher Robot <gobot@golang.org>
Tue, 28 Mar 2023 16:22:36 +0000 (16:22 +0000)
commitf7156f63b52af3242e8415a209ff6fea119f5903
tree9a706939a110e7cf8b0d4331df6ce1de676404e8
parent4c49d52439805c248f4a01d529b90b22e821b7d6
encoding/asn1: support fractions of a second when unmarshaling GeneralizedTime

A GeneralizedTime value may contain an optional fractional seconds
element (according to X.680 46.2, restricted by X.690 11.7.3). This
change adds support for this fractional part, up to nine digits, so that
Unmarshal won't fail when decoding a DER encoded GeneralizedTime value
with fractional digits.  Also, test cases related to this change have
been added.

X.680 and X.690 can be found at:
https://www.itu.int/rec/T-REC-X.680
https://www.itu.int/rec/T-REC-X.690

Fixes #15842

Change-Id: If217c007e01b686db508a940e9e2ed3bfb901879
Reviewed-on: https://go-review.googlesource.com/c/go/+/108355
Run-TryBot: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
src/encoding/asn1/asn1.go
src/encoding/asn1/asn1_test.go