About vlm/asn1c
The asn1c is an open-source ASN.1 compiler that takes ASN.1 module files and generates C++ compatible C source code. This code can be used to serialize native C structures into compact and unambiguous BER, DER, OER, PER, and XER based data files, and deserialize them back. It supports multiple encoding standards and includes an interoperability table showing compatible API functions for each encoding. Widely used in industry for encoding X.509 certificates (HTTPS), mobile network control data, and intelligent transportation car-to-car communication. It is considered the most evolved open-source ASN.1 compiler, though it does not support all ASN.1 standards (e.g., CER and APER are not supported).
Key Features
Generates C++ compatible C source code from ASN.1 module files
Supports BER, DER, OER, PER, and XER encoding/decoding
Interoperability table for compatible API functions across encoding variants
Command-line compiler tool (asn1c)
Comprehensive documentation (asn1c-usage.pdf, FAQ, quick start guide)
Handles multiple interdependent ASN.1 specifications
Pros & Cons
Pros
- Free and open-source
- Supports multiple ASN.1 encoding standards (BER, DER, OER, PER, XER)
- Generates C and C++ compatible code, easy to integrate into existing projects
- Widely used in industry (X.509, mobile networks, automotive)
- Described as the most evolved open-source ASN.1 compiler
Cons
- Does not support all ASN.1 standards (e.g., CER and APER encoding are not supported)
- Requires manual compilation and integration into projects
- Steep learning curve for developers unfamiliar with ASN.1
Best For
Encoding X.509 certificates for HTTPS handshakeExchanging control data between mobile phones and cellular networksCar-to-car communication in intelligent transportation networksGeneral serialization and deserialization of native C structures into ASN.1-based data files
FAQ
What is asn1c?
asn1c is an open-source compiler that converts ASN.1 module files into C/C++ source code for encoding and decoding data using various ASN.1 transfer syntaxes (BER, DER, OER, PER, XER).
Which encoding formats are supported?
asn1c supports BER, DER, OER (both BASIC and CANONICAL), UPER (both BASIC and CANONICAL), and XER (both BASIC and CANONICAL). It does not support CER or APER.
How do I install asn1c?
Refer to the INSTALL.md file in the repository for a short installation guide. The compiler can be built from source using the provided build system.