summaryrefslogtreecommitdiff
path: root/src/encoding/asn1
diff options
context:
space:
mode:
authorHiroshi Ioka <hirochachacha@gmail.com>2017-04-08 15:12:17 +0900
committerBrad Fitzpatrick <bradfitz@golang.org>2017-04-11 23:24:58 +0000
commit927f8a04cce3960f1415c4efe246eb64bdb945fa (patch)
tree5df7b6d02a009eab5670a8d15064caf46c8e2a21 /src/encoding/asn1
parent826a09cd65bbbf39bd377f34e24a5870275014ad (diff)
downloadgo-git-927f8a04cce3960f1415c4efe246eb64bdb945fa.tar.gz
encoding/asn1: document "utc" and "generalized" tags
Also reformat tables. Fixes #19889 Change-Id: I05083d2bab8bca46c4e22a415eb9b73513df6994 Reviewed-on: https://go-review.googlesource.com/40071 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/encoding/asn1')
-rw-r--r--src/encoding/asn1/asn1.go12
-rw-r--r--src/encoding/asn1/marshal.go10
2 files changed, 12 insertions, 10 deletions
diff --git a/src/encoding/asn1/asn1.go b/src/encoding/asn1/asn1.go
index 044f74ab46..c2c0ee420a 100644
--- a/src/encoding/asn1/asn1.go
+++ b/src/encoding/asn1/asn1.go
@@ -975,12 +975,12 @@ func setDefaultValue(v reflect.Value, params fieldParameters) (ok bool) {
//
// The following tags on struct fields have special meaning to Unmarshal:
//
-// application specifies that a APPLICATION tag is used
-// default:x sets the default value for optional integer fields (only used if optional is also present)
-// explicit specifies that an additional, explicit tag wraps the implicit one
-// optional marks the field as ASN.1 OPTIONAL
-// set causes a SET, rather than a SEQUENCE type to be expected
-// tag:x specifies the ASN.1 tag number; implies ASN.1 CONTEXT SPECIFIC
+// application specifies that a APPLICATION tag is used
+// default:x sets the default value for optional integer fields (only used if optional is also present)
+// explicit specifies that an additional, explicit tag wraps the implicit one
+// optional marks the field as ASN.1 OPTIONAL
+// set causes a SET, rather than a SEQUENCE type to be expected
+// tag:x specifies the ASN.1 tag number; implies ASN.1 CONTEXT SPECIFIC
//
// If the type of the first field of a structure is RawContent then the raw
// ASN1 contents of the struct will be stored in it.
diff --git a/src/encoding/asn1/marshal.go b/src/encoding/asn1/marshal.go
index 225fd0849c..fdadb3996e 100644
--- a/src/encoding/asn1/marshal.go
+++ b/src/encoding/asn1/marshal.go
@@ -643,10 +643,12 @@ func makeField(v reflect.Value, params fieldParameters) (e encoder, err error) {
// In addition to the struct tags recognised by Unmarshal, the following can be
// used:
//
-// ia5: causes strings to be marshaled as ASN.1, IA5 strings
-// omitempty: causes empty slices to be skipped
-// printable: causes strings to be marshaled as ASN.1, PrintableString strings.
-// utf8: causes strings to be marshaled as ASN.1, UTF8 strings
+// ia5: causes strings to be marshaled as ASN.1, IA5String values
+// omitempty: causes empty slices to be skipped
+// printable: causes strings to be marshaled as ASN.1, PrintableString values
+// utf8: causes strings to be marshaled as ASN.1, UTF8String values
+// utc: causes time.Time to be marshaled as ASN.1, UTCTime values
+// generalized: causes time.Time to be marshaled as ASN.1, GeneralizedTime values
func Marshal(val interface{}) ([]byte, error) {
e, err := makeField(reflect.ValueOf(val), fieldParameters{})
if err != nil {