encoding/asn1 ia5 string in AttributeTypeAndValue

144 views
Skip to first unread message

Paul van Brouwershaven

unread,
Aug 20, 2015, 8:38:35 AM8/20/15
to golang-nuts, Adam Langley
I'm trying to add a domain component (oid 0.9.2342.19200300.100.1.25) via the pkix.Name.ExtraNames AttributeTypeAndValue and this works fine except that the string of a domain component must always be an ia5 string according to rfc2247.

My first idea was to create a new sting type and instruct it via the options to ia5 ASN.1 encoding, but that would only work if the value is a struct.

type ia5string string `asn1:"ia5"`

result in a "syntax error: unexpected string literal, expecting semicolon or newline"

Any idea how to change the sting encoding in a AttributeTypeAndValue?

Thanks,

Paul

Matt Harden

unread,
Aug 20, 2015, 9:43:37 AM8/20/15
to Paul van Brouwershaven, golang-nuts, Adam Langley

You could use an asn1.RawValue{Tag: 22, Bytes: []byte(mystring)}.


--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Paul van Brouwershaven

unread,
Aug 20, 2015, 10:17:09 AM8/20/15
to golang-nuts, pa...@vanbrouwershaven.com, a...@golang.org
Sorry, I have been thinking of doing it this way but expected the ASN.1 raw value structure to be marshalled instead of used as raw value.

Should have tested this myself directly, but it works now.

Thanks!
Reply all
Reply to author
Forward
0 new messages