ASN.1 is a computer language designed by
the CCITT/ITU for the specification of data types and values, especially in communication
protocols. Although it has been designed for the OSI presentation layer,
it can be used for many other purposes, e. g. the lower OSI layer protocols
and many other protocol architectures.
ASN.1 is typically used to define the protocol
data units (PDUs) of communication protocols. To map a PDU into a
concrete sequence of octets, the ASN.1 standard offers several encoding
rules. There are two main encoding rules:
The ASN.1 compiler supports both these encoding rules
(and its variants like CER and DER) and generates datatypes, values, encoding,
and decoding functions for a specific programming language (C or Java)
according to the definitions in the ASN.1 file supplied by the user.
Basic encoding rules (BER): The basic encoding rules
prefixes each component of the PDU by an identifying tag and the data length.
These encoding rules are very simple but space consuming and are mostly
used for the encoding in old standards.
Packed encoding rules (PER): The packed encoding
rules encode the values in a very compact format and are often using the minimum
number of bits required. These encoding rules are very complex and are
mostly used in recent standards.