encoding/asn1: string type tags are not documented to work in Unmarshal #42570
Labels
Documentation
Issues describing a change to documentation.
FrozenDueToAge
help wanted
NeedsFix
The path to resolution is known, but the work has not been done.
Milestone
What version of Go are you using (
go version
)?1.14
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?linux amd64
What did you do?
I have the following struct:
Note that ComponentRevision is tag:1, so context specific. The fact that it's a string means that getUniversalType() will return PrintableString, and this will not be overridden because there's no explicit tag type in the encoded stream.
The spec definition of this struct is:
ie, componentRevision is a UTF8String, not a PrintableString. The certificate I'm parsing has an @ sign in, which is legitimate in a UTF8String but not a PrintableString. Since we have no explicit information in the stream to treat this as a UTF8String we continue treating it as a PrintableString, and then fail because of the "invalid" character.
What did you expect to see?
A string containing an @ sign.
What did you see instead?
asn1: syntax error: PrintableString contains invalid character
The text was updated successfully, but these errors were encountered: