ASN1C icon ASN.1 to Go

ASN.1 to Go diagram

The ASN1C ASN.1 compiler can generate Go source code for encoding and decoding ASN.1 messages. The following ASN.1 encoding rules are supported:

  • BER, DER, PER - aligned (PER) and unaligned (UPER), JSON (JER)

A separate Go type is generated for each production defined in an ASN.1 specification. Functions are generated to encode or decode data to and from an instance of the type.


  • Intuitive mapping between ASN.1 and Go types.
  • Supports generation of optional methods to print data.
  • Supports generation of random test data and a main.go program containing a reader and writer.
  • Comprehensive ASN.1 feature coverage including support for table constraints, content constraints, extension element groups, all ASN.1 types, and ASN.1 value notation.
  • Full Go source code generated including base run-time.