ASN.1 C Compiler Overview

ASN.1 C Compiler can automatically translate ASN.1 specifications into C data structures plus metadata for encoding and decoding ASN.1 messages using one of the encoding rules (BER, CER, DER, PER). Developers can easily integrate these codes into their applications.

In addition to the ASN.1 C Compiler, ASN.1 C Runtime Library is also part of the package. The ASN.1 C Runtime Library is delivered as a set of low-level primitive C routines for encoding and decoding the base ASN.1 types (BOOLEAN, INTEGER, etc.) and a rich collection of utility functions to operate on application messages. The ASN.1 C Runtime Library is ANSI C compliant, so that it can run on a wide-variety of platforms and processors from mainframes to embedded systems.

ASN.1 C Compiler Features

  • The mapping between ASN.1 types and C structs is quite straightforward and intuitive, and easy to use.

    The ASN.1 C Compiler always generates type as primitive as possible, such minimize your time and effort to get familiar with the generated codes.

  • Minimal generated codes size, higher code reuse rate.

    The ASN.1 C Compiler generates only C data structures and metadata for ASN.1 types, such minimize the codes generated, resulting a higher code reuse rate.

  • Low memory consumption, more suitable for embedded systems.

    Since lesser codes generated, and with delicated design of metadata, the final program take up lesser RO section memory.

  • High speed encoding/decoding with multi-thread support.

    As a light-weight library, ASN.1 C Runtime Library has made some assumptions, which greatly improve the speed of encoding/decoding. Of course these assumptions also pose some limitations.

  • Full sopport for encoding rules BER, CER, DER, PER, includes a rich collection of utility functions to operate messages.

Known Limitations

  • ASN.1 Development Tools Limitations

    Because ASN.1 C Compiler extent the ASN.1 Development Tools, it has all the limitations of ASN.1 Development Tools.

  • Tag

    The long integer are used to hold the encoded tag for optimization reason, which limits the representable tag code to less than 221 but for reasonable ASN.1 specifications this should not be a problem.

  • Length

    The length of enumerated items, bit string, octet string, components or alternatives can't exceed maximum of unsigned int.


    The value of INTEGER should be in the range of long long (or __int64_t for Windows) type in C. Now support huge size integers (up to 128 bits, but can configure to support even larger integers).

  • REAL

    The value of REAL is allways encoded/decoded in binary form, the precision should never exceed double type in C.

  • SET OF

    SET OF value dynamic sort is not supported, it's recommended to use SEQUENCE OF type instead of SET OF type.


Continue to Getting started with the ASN.1 C Compiler.