Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
encoding/asn1: marshaling GeneralizedTime and UTCTime don't follow DER restriction #19890
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
When looking for a fix for #15842 recently, I have had a look into X.690 and its section regarding GeneralizedTime (11.7), which is followed by 11.8 UTCTime. When reading about this issue I thought a fix that would improve conformance with X.690 could be similar to this patch: A time.Time value's zone gets converted to UTC first (just in case it had been associated with another location); all encoded values will have a 'Z' suffix. The patch also fixes edge cases near 1950 and 2050 -- when the time value will shift out of the UTCTime range --, for which I have supplied test cases too.
PS: Still no fractional part of a second is encoded, as this would probably make it necessary to create a new field parameter or extend