ASN.1 Principles

ASN.1 or Abstract Syntax Notation number 1 is a presentation transfer syntax used by application layer protocols for representation of the information exchanged between application entities. It specifies both high and (in practice) low-level structure of actual data on the network. High level information: application specific data- structuring and value constraints. In a ;SPM_quot;tuned;SPM_quot; context-specific way, applications can define complex structures, pass data or carry out transactions regardless of underlying differences such as byte-order or language constraints. Low level information: a machine-independent encoding scheme. although there is the possibility of divergent encoding schemes e.g. encrypted, in practice CCITT aligned standards are using a common octet level encoding method. It's syntax displays several properties: It is important to note that ASN.1 is BNF-defined but is not BNF itself. when reading the ASN.1 specification be sure to differentiate between them. For example, consider the following fragment of 'C' code which shows the definition of a simple data structure that could be used to represent the contents of a line in /etc/passwd, as in figure #fn71#1520>. This data structure consists of a series of pointers to strings, and embedded integers. At run-time a given instance of this structure would look like this:

#figure1521#
Figure: Example Data Structure

If the content of file /etc/passwd is: verbatim47 Then an instance of struct passwd at run-time would appear as in figure #fn72#1524>.

#figure1525#
Figure: Data Structure at runtime

Assuming that the separate field sizes were as on a typical 32-but RISC architecture machine.

Note: A typical ASN.1 representation of this structure is shown in #fn73#1534>. A more complex example is illustrated in #fnasn75#1535>.

#figure1536#
Figure: ASN.1 version of C Data Structure

Note that this assumes the following about memory templates for objects:

#table1541#
Table: ASN Base Data Types

The list in #fn74#1547> has only two construction types: the SET and the SEQUENCE. using these along with a MACRO notation and a CHOICE selector arbitrarily complex structures can be built up. o Sub-types and ranges can also be defined from the primitive types allowing finer control of the value of the primitive elements. o The use of named types also providing some clarity for readers since names like T61String and Videotex String don't really tell you much about the context. o By its nature ASN.1 can be ambiguous. Although definitions can carry a lot of tagging and identification this increases the volume of transmitted octets hugely. o Typically reduced definitions are used where the context can define the encoding of following objects. This is not without it's dangers, and you should be very careful to determine whether a piece of ASN.1 defines something of global or localized significance. o Annexe A to CCITT X/409 is a guide for the use of ASN.1, which can help avoid creating such ambiguities. Example: an ASN.1 definition for autotellers Here is a small set of ASN.1 definitions for objects which might plausibly be exchanged during the use of high street cash dispensers, assuming anyone was rash enough to attach them to an OSI network!

#figure1548#
Figure: Example ASN Specification- Cash Dispenser