Skip to content

Commit 665def2

Browse files
ericchiangkatiehockman
authored andcommitted
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 <[email protected]> Reviewed-by: Roland Shoemaker <[email protected]> Run-TryBot: Katie Hockman <[email protected]> Trust: Emmanuel Odeke <[email protected]> Trust: Katie Hockman <[email protected]>
1 parent 81ea89a commit 665def2

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/encoding/asn1/asn1.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,6 +1067,15 @@ func setDefaultValue(v reflect.Value, params fieldParameters) (ok bool) {
10671067
// set causes a SET, rather than a SEQUENCE type to be expected
10681068
// tag:x specifies the ASN.1 tag number; implies ASN.1 CONTEXT SPECIFIC
10691069
//
1070+
// When decoding an ASN.1 value with an IMPLICIT tag into a string field,
1071+
// Unmarshal will default to a PrintableString, which doesn't support
1072+
// characters such as '@' and '&'. To force other encodings, use the following
1073+
// tags:
1074+
//
1075+
// ia5 causes strings to be unmarshaled as ASN.1 IA5String values
1076+
// numeric causes strings to be unmarshaled as ASN.1 NumericString values
1077+
// utf8 causes strings to be unmarshaled as ASN.1 UTF8String values
1078+
//
10701079
// If the type of the first field of a structure is RawContent then the raw
10711080
// ASN1 contents of the struct will be stored in it.
10721081
//

0 commit comments

Comments
 (0)