diff options
author | Eric Chiang <ericchiang@google.com> | 2020-11-12 19:13:02 -0800 |
---|---|---|
committer | Katie Hockman <katie@golang.org> | 2021-01-12 18:32:48 +0000 |
commit | 665def2c11bb49749b075d612e98b6db293266a7 (patch) | |
tree | 86fbf0b080044786d7318d07fb031f48b61eadf3 /src/encoding | |
parent | 81ea89adf38b90c3c3a8c4eed9e6c093a8634d59 (diff) | |
download | go-git-665def2c11bb49749b075d612e98b6db293266a7.tar.gz |
encoding/asn1: document unmarshaling behavior for IMPLICIT string fields
Fixes #42570.
Change-Id: I73e339cdebe1720c141861a12e28a94cef13c75b
Reviewed-on: https://go-review.googlesource.com/c/go/+/269798
Reviewed-by: Katie Hockman <katie@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Run-TryBot: Katie Hockman <katie@golang.org>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
Trust: Katie Hockman <katie@golang.org>
Diffstat (limited to 'src/encoding')
-rw-r--r-- | src/encoding/asn1/asn1.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/encoding/asn1/asn1.go b/src/encoding/asn1/asn1.go index 7c260b49d9..f9b9cb4930 100644 --- a/src/encoding/asn1/asn1.go +++ b/src/encoding/asn1/asn1.go @@ -1067,6 +1067,15 @@ func setDefaultValue(v reflect.Value, params fieldParameters) (ok bool) { // 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 // +// When decoding an ASN.1 value with an IMPLICIT tag into a string field, +// Unmarshal will default to a PrintableString, which doesn't support +// characters such as '@' and '&'. To force other encodings, use the following +// tags: +// +// ia5 causes strings to be unmarshaled as ASN.1 IA5String values +// numeric causes strings to be unmarshaled as ASN.1 NumericString values +// utf8 causes strings to be unmarshaled as ASN.1 UTF8String values +// // 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. // |