From 1af630936713fa12070ad6c5f1ef40de36f5d371 Mon Sep 17 00:00:00 2001 From: Andrew Ayer Date: Sat, 20 Aug 2016 19:43:10 -0700 Subject: [PATCH] Define tagUTCTime and tagGeneralizedTime They're only exported in Go1.6 and I'd like to support Go1.5 as well. Closes: #15 --- asn1time.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/asn1time.go b/asn1time.go index 29e0d8a..694bf7f 100644 --- a/asn1time.go +++ b/asn1time.go @@ -17,6 +17,11 @@ import ( "unicode" ) +const ( + tagUTCTime = 23 + tagGeneralizedTime = 24 +) + func isDigit(b byte) bool { return unicode.IsDigit(rune(b)) } @@ -242,9 +247,9 @@ func parseGeneralizedTime(bytes []byte) (time.Time, error) { func decodeASN1Time(value *asn1.RawValue) (time.Time, error) { if !value.IsCompound && value.Class == 0 { - if value.Tag == asn1.TagUTCTime { + if value.Tag == tagUTCTime { return parseUTCTime(value.Bytes) - } else if value.Tag == asn1.TagGeneralizedTime { + } else if value.Tag == tagGeneralizedTime { return parseGeneralizedTime(value.Bytes) } }