ASN1C icon ASN.1 to Python

ASN.1 to Python diagram

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


A separate Python class is generated for each production defined in an ASN.1 specification. This contains methods for encoding and decoding an instance of the class using any of the ASN.1 encoding rules listed above.


  • Intuitive mapping between ASN.1 type and Python classes.
  • In-memory and stream-based encoding and decoding.
  • Supports generation of optional methods to print (__str__), compare (__eq__), and copy data.
  • Supports generation of random test data and reader and writer programs
  • Comprehensive ASN.1 feature coverage including support for table constraints, content constraints, extension element groups, all ASN.1 types, and ASN.1 value notation.