Abstract Syntax Notation One

Abstract Syntax Notation One

In telecommunications and computer networking, Abstract Syntax Notation One (ASN.1) is a standard and flexible notation that describes data structures for representing, encoding, transmitting, and decoding data. It provides a set of formal rules for describing the structure of objects that are independent of machine-specific encoding techniques and is a precise, formal notation that removes ambiguities.

ASN.1 is a joint ISO/IEC and ITU-T standard, originally defined in 1984 as part of . ASN.1 moved to its own standard, X.208, in 1988 due to wide applicability. The substantially revised 1995 version is covered by the X.680 series. The latest available version is dated 2002, and is backward compatible with the 1995 version.

ASN.1 in transfer

ASN.1 defines the abstract syntax of information but does not restrict the way the information is encoded. Various ASN.1 encoding rules provide the transfer syntax (a concrete representation) of the data values whose abstract syntax is described in ASN.1.

The standard ASN.1 encoding rules include:
*Basic Encoding Rules (BER)
*Canonical Encoding Rules (CER)
*Distinguished Encoding Rules (DER)
*XML Encoding Rules (XER)
*Packed Encoding Rules (PER)
*Generic String Encoding Rules (GSER)

ASN.1 together with specific ASN.1 encoding rules facilitates the exchange of structured data especially between application programs over networks by describing data structures in a way that is independent of machine architecture and implementation language.

Application layer protocols such as X.400 electronic mail, X.500 and LDAP directory services, H.323 (VoIP), BACnet and SNMP use ASN.1 to describe the protocol data units (PDUs) they exchange. It is also extensively used in the Access and Non-Access Strata of UMTS. There are many other application domains of ASN.1 [ [http://asn1.elibel.tm.fr/en/uses/index.htm ASN.1 Site - Uses ] ] .

Example

Data structures of FooProtocol defined using the ASN.1 notation:

FooProtocol DEFINITIONS ::= BEGIN

FooQuestion ::= SEQUENCE { trackingNumber INTEGER, question IA5String }

FooAnswer ::= SEQUENCE { questionNumber INTEGER, answer BOOLEAN }

END

This could be a specification published by creators of Foo protocol. ASN.1 does not define conversation flows, this is up to the textual description of the protocol.

Assuming a message, which complies with Foo protocol and which will be sent to the receiving party. This particular message (PDU) is:

myQuestion FooQuestion ::= { trackingNumber 5, question "Anybody there?"}

To send the above message through the network one needs to encode it to a string of bits. ASN.1 defines various algorithms to accomplish that task, called Encoding rules. There are plenty of them; one of the simplest is Distinguished Encoding Rules (DER).

The Foo protocol specification should explicitly name one set of encoding rules to use, so that users of the Foo protocol know they should use DER.

Example encoded in DER

Below is the data structure shown before encoding in the DER format:

30 -- tag indicating SEQUENCE13 -- length in octets

02 -- tag indicating INTEGER01 -- length in octets05 -- value

16 -- tag indicating IA5String0e -- length in octets41 6e 79 62 6f 64 79 20 74 68 65 72 65 3f -- value ("Anybody there?" in ASCII)

(Note DER uses a pattern of tag-length-value triplets)

So what one actually gets is the string of 21 octets:

30 13 02 01 05 16 0e 41 6e 79 62 6f 64 79 20 74 68 65 72 65 3f

The scope of ASN.1 and DER ends here. It is possible to transmit the encoded message to the party by any means (utilizing TCP or any other protocol). The party should be able to decode the octets back using DER.

Example encoded in XER

Alternatively, it is possible to encode the same ASN.1 data structure with XER (XML Encoding Rules) to achieve greater human readability "over the wire". It would then appear like the following 108 octets:

5 Anybody there?

Example encoded in PER (unaligned)

Alternatively, if Packed Encoding Rules are employed, the following 122 bits (less than 16 octets) will be produced:

01 05 0e 83 bb ce 2d f9 3c a0 e9 a3 2f 2c af c0

ASN.1 versus other data structure definition schemes

As commonly used for defining messages for communication protocols, ASN.1, with its associated encoding rules, results in a binary encoding.

Other communication protocols, such as Internet protocols HTTP and SMTP, define messages using text tags and values, sometimes based on the Augmented Backus-Naur form (ABNF) notation. The definition also defines the encoding, which is in text.

There has been much debate over the two approaches, and both have their merits; the ASN.1 approach is believed to be more efficient, and with Packed Encoding Rules, certainly provides a more compact encoding. The textual approach is claimed to be easier to implement (through creation and parsing of text strings) and easier to debug, as one can simply read an encoded message. In the case of the Megaco protocol, consensus between the two points of view was not reached and so two encodings, one based on ASN.1 and one on ABNF, were defined.

The ASN.1 XML Encoding Rules (XER) attempts to bridge the gap by providing a textual encoding of data structures defined using ASN.1 notation. Generic String Encoding Rules were also defined for the sole purpose of presenting and inputting data to/from a user.

Encoding Control Notation (ECN)

The Encoding Control Notation (ECN) is a notation to specify specific encodings of ASN.1 types. ECN is useful to describe legacy protocols in ASN.1. It is possible to specify only the encoding of some types and then complete with a standard encoding rules (usually unaligned PER).

ASN.1 Information Object Class

Information Object Classes is a concept used in ASN.1 to address specification needs similar to the ones addressed by CORBA/IDL specifications.

Using ASN.1 in practice

One may use an ASN compiler which takes as input an ASN.1 specification and generates computer code (for example in the C programming language) for an equivalent representation of the data structures. This computer code, together with supplied run-time libraries, can then convert encoded data structures to and from the computer language representation. Alternatively, one can manually write encoding and decoding routines.

tandards

Standards describing the ASN.1 notation:
* [http://www.itu.int/rec/T-REC-X.680/en ITU-T Rec. X.680] | ISO/IEC 8824-1
* [http://www.itu.int/rec/T-REC-X.681/en ITU-T Rec. X.681] | ISO/IEC 8824-2
* [http://www.itu.int/rec/T-REC-X.682/en ITU-T Rec. X.682] | ISO/IEC 8824-3
* [http://www.itu.int/rec/T-REC-X.683/en ITU-T Rec. X.683] | ISO/IEC 8824-4Standards describing the ASN.1 encoding rules:
* [http://www.itu.int/rec/T-REC-X.690/en ITU-T Rec. X.690] | ISO/IEC 8825-1 (BER, CER and DER)
* [http://www.itu.int/rec/T-REC-X.691/en ITU-T Rec. X.691] | ISO/IEC 8825-2 (PER)
* [http://www.itu.int/rec/T-REC-X.693/en ITU-T Rec. X.693] | ISO/IEC 8825-4 (XER)
* [http://www.itu.int/rec/T-REC-X.694/en ITU-T Rec. X.694] | ISO/IEC 8825-5 (XSD mapping)
*RFC 3641 (GSER)

ee also

*TTCN
*TTCN-3
*EBML
*Transfer Syntax Notation One (TSN.1), a different approach

Notes

References

* [http://asn1.elibel.tm.fr/ A comprehensive ASN.1 information site]
* [http://www.oss.com/asn1/dubuisson.html A free book about ASN.1 from Olivier Dubuisson]
* [http://www.oss.com/asn1/larmouth.html A free book about ASN.1 from John Larmouth]

External links

* [http://lionet.info/asn1c/ ASN.1C] , free, open source ASN.1 to C compiler
* [http://www.openasn1.org openASN.1] An Open Source ASN.1 toolkit for Java
* [http://asn1forj.sourceforge.net/ asn1forj] An Open Source ASN.1 toolkit for Java
* [http://bnotes.sf.net/ BinaryNotes] : The Open Source ASN.1 Framework for Java and .NET
* [http://pyasn1.sf.net pyasn1] : ASN.1 types and codecs implemented in Python
* [http://www.itu.int/ITU-T/studygroups/com17/languages/ Standards describing the ASN.1 notation]
* [http://www.itu.int/ITU-T/studygroups/com17/languages/ Standards describing the ASN.1 encoding rules]
* [http://www.asn1.org/ The ASN.1 Consortium]
* [http://www.oid-info.com/ The Object Identifier (OID) repository]
* [http://www.oss.com/products/products.html OSS ASN.1 Tools page]
* [http://luca.ntop.org/Teaching/Appunti/asn1.html A Layman's Guide to a Subset of ASN.1, BER, and DER] A very good introduction for beginners


Wikimedia Foundation. 2010.

Игры ⚽ Нужен реферат?

Look at other dictionaries:

  • Abstract Syntax Notation One — ASN.1 Pile de protocoles 7 • Application 6 • Présentation 5 • Session 4 • Transport …   Wikipédia en Français

  • Abstract Syntax Notation One — Die Abstract Syntax Notation One (ASN.1) ist eine Beschreibungssprache zur Definition von Datenstrukturen sowie Festlegungen zur Umsetzung von Datenstrukturen und Elementen in ein netzeinheitliches Format. Sie ist gemeinsamer Standard der ITU T… …   Deutsch Wikipedia

  • Abstract Syntax Notation — ASN.1 Pile de protocoles 7 • Application 6 • Présentation 5 • Session 4 • Transport …   Wikipédia en Français

  • Abstract Syntax Notation 1 — ASN.1 Pile de protocoles 7 • Application 6 • Présentation 5 • Session 4 • Transport …   Wikipédia en Français

  • Abstract syntax — The abstract syntax of data is its structure described as a data type (possibly, but not necessarily, an abstract data type), independent of any particular representation or encoding. To be implemented either for computation or communications, a… …   Wikipedia

  • Encoding Control Notation — The Encoding Control Notation (ECN) is a standardized formal language that is part of the Abstract Syntax Notation One (ASN.1) family of international standards [cite web url=http://www.itu.int/rec/T REC X.680 200203 I/en title=ITU T Rec. X.680 / …   Wikipedia

  • Cryptographic Message Syntax — (CMS) ist ein Standard vom IETF für gesicherte kryptographische Mitteilungen. CMS ist die Obermenge des PKCS #7 (Public Key Cryptography Standards #7) welche auf S/MIME aufsetzt. Der Version 2 lag der gleiche Standard zugrunde. Ab Version 3… …   Deutsch Wikipedia

  • Reverse Polish notation — (or just RPN) by analogy with the related Polish notation, a prefix notation introduced in 1920 by the Polish mathematician Jan Łukasiewicz, is a mathematical notation wherein every operator follows all of its operands. It is also known as… …   Wikipedia

  • ASN.1 — Abstract Syntax Notation One (Computing » General) Abstract Syntax Notation One (Computing » Telecom) …   Abbreviations dictionary

  • ASN.1 — Abstract Syntax Notation One von der CCITT vorgeschlagene und der ISO übernommene Notation für die syntaktische Beschreibung auszutauschender Dateneinheiten, meist synonym zu X.409 …   Acronyms

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”