diff --git a/src/pkg/asn1/asn1.go b/src/pkg/asn1/asn1.go index fb33afcc28..b8cea93592 100644 --- a/src/pkg/asn1/asn1.go +++ b/src/pkg/asn1/asn1.go @@ -324,7 +324,11 @@ func isPrintable(b byte) bool { b == ' ' || b == ':' || b == '=' || - b == '?' + b == '?' || + // This is techincally not allowed in a PrintableString. + // However, x509 certificates with wildcard strings don't + // always use the correct string type so we permit it. + b == '*' } // IA5String diff --git a/src/pkg/asn1/marshal_test.go b/src/pkg/asn1/marshal_test.go index 8050031a7c..67878f9bb9 100644 --- a/src/pkg/asn1/marshal_test.go +++ b/src/pkg/asn1/marshal_test.go @@ -75,6 +75,7 @@ var marshalTests = []marshalTest{ marshalTest{"test", "130474657374"}, marshalTest{ia5StringTest{"test"}, "3006160474657374"}, marshalTest{printableStringTest{"test"}, "3006130474657374"}, + marshalTest{printableStringTest{"test*"}, "30071305746573742a"}, marshalTest{rawContentsStruct{nil, 64}, "3003020140"}, marshalTest{rawContentsStruct{[]byte{0x30, 3, 1, 2, 3}, 64}, "3003010203"}, marshalTest{RawValue{Tag: 1, Class: 2, IsCompound: false, Bytes: []byte{1, 2, 3}}, "8103010203"},