Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

encoding/asn1: dates past 2049 are not properly marshalled #6976

Closed
gopherbot opened this issue Dec 17, 2013 · 6 comments
Closed

encoding/asn1: dates past 2049 are not properly marshalled #6976

gopherbot opened this issue Dec 17, 2013 · 6 comments

Comments

@gopherbot
Copy link

by cppcoder:

What steps will reproduce the problem?
Create two certificates with different validity dates:
http://play.golang.org/p/YAK0tEvGv9

What is the expected output?
generating key pair...
generating certificate...
generating key pair...
generating certificate...

What do you see instead?
generating key pair...
generating certificate...
generating key pair...
generating certificate...
long time:  asn1: structure error: cannot represent time as UTCTime

Which compiler are you using (5g, 6g, 8g, gccgo)?
6g

Which operating system are you using?
OSX 10.6

Which version are you using?  (run 'go version')
go version go1.2 darwin/amd64

Please provide any additional information below.
the problem lies in encoding/asn1/marshal.go - marshalBody()

line 381 assumes that any timeType should be marshalled as UTC where the RFC states
quite clearly any date beyond 2049 must be encoded as GeneralizedTime
(http://tools.ietf.org/html/rfc5280#page-22) which is a standard asn.1 type.
@robpike
Copy link
Contributor

robpike commented Dec 19, 2013

Comment 1:

Lovely ASN.1.

Status changed to Accepted.

@robpike
Copy link
Contributor

robpike commented Dec 19, 2013

Comment 2:

Labels changed: added repo-main.

@gopherbot
Copy link
Author

Comment 3 by cppcoder:

patch marshal.go for consideration.  Updated marshalUTCTime as marshalTime and added
handler for years past 2049.  Added marshalFourDigits (for the year) and updated
marshalBody.

Attachments:

  1. marshal.patch (658 bytes)

@rsc
Copy link
Contributor

rsc commented Mar 3, 2014

Comment 4:

Please submit changes as described at golang.org/doc/contribute.html. Thanks.

Labels changed: added release-none.

@rsc
Copy link
Contributor

rsc commented Mar 3, 2014

Comment 5:

+agl in case there are security implications. Assuming not, this is very low priority.

@agl
Copy link
Contributor

agl commented Mar 21, 2014

Comment 6:

This issue was closed by revision 050b60a.

Status changed to Fixed.

@golang golang locked and limited conversation to collaborators Jun 25, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants