OBJECT IDENTIFIER

The Go representation for OBJECT IDENTIFIER depends on whether the -oid-as-astring option is used. Without this option, the representation is a slice of integers; with it, the representation is a string.

Standard case (slice of integers)

By default, the ASN.1 OBJECT IDENTIFIER type is mapped to the Go ObjectIdentifier type defined within the ASN.1 run-time (asn1rt.ObjectIdentifier). This in turn is mapped to a uint64 slice ([]uint64), with each uint64 representing a single subidentifier. For example:

ASN.1:

   MyOID ::= OBJECT IDENTIFIER

Generated Go code:

   type MyOID asn1rt.ObjectIdentifier

String case

When -oid-as-string is used, OBJECT IDENTIFIER is mapped to asn1rt.ObjectIdentifierStr, defined in the ASN.1 run-time as string. The advantage of this representation is that it supports arbirtrarily large subidentifier values. The string must be in dotted-number format (e.g. "0.5.1234").

For example:

ASN.1:

   MyOID ::= OBJECT IDENTIFIER

Generated Go code:

   type MyOID asn1rt.ObjectIdentifierStr