Talk:Abstract Syntax Notation One

From Wikipedia, the free encyclopedia
Jump to: navigation, search
          This article is of interest to the following WikiProjects:
WikiProject Computing / Networking (Rated Start-class, Low-importance)
WikiProject icon This article is within the scope of WikiProject Computing, a collaborative effort to improve the coverage of computers, computing, and information technology on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
Start-Class article Start  This article has been rated as Start-Class on the project's quality scale.
 Low  This article has been rated as Low-importance on the project's importance scale.
Taskforce icon
This article is supported by Networking task force (marked as Mid-importance).
WikiProject Telecommunications (Rated Start-class)
WikiProject icon This article is within the scope of WikiProject Telecommunications, a collaborative effort to improve the coverage of Telecommunications on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
Start-Class article Start  This article has been rated as Start-Class on the project's quality scale.
 ???  This article has not yet received a rating on the project's importance scale.

Captial letters[edit]

Why the capital letters in the article's title while lower-case is used in the first sentence? Which is correct? (Wikipedia articles conventionally do not capitalize words in article titles unless they would otherwise be capitalized, except that the first letter is case-insensitive and always gets rendered as a capital.) Michael Hardy 20:26, 13 Sep 2004 (UTC)

I spotted this in the page history, 02:18, 26 January 2006 Mulad m (moved Abstract syntax notation one to Abstract Syntax Notation One: Being a standard, this should be uppercase)--Kelby 23:19, 8 June 2006 (UTC)

More accurately, this is a proper name for a particular standard, not a general term. Proper names can be capitalized in English. Sources almost always do in this case. W Nowicki (talk) 21:40, 11 July 2011 (UTC)

ASN.1 versus text encodings[edit]

This recently added section is problematic as there are multiple ASN.1 encoding rules which produce textual output, such as GSER. Additionally one doesn't need a compiler to produce encoders/decoders for binary encodings, and one may use a compiler to produce encoders/decovers for textual encodings. I recommend this section be deleted or significantly rewritten. Kdz 20:57, 25 February 2006 (UTC)

Agreed. GSER is not a good example as it's primarily meant merely for inputting/representing data by/for the user, but XER entirely qualifies as a textual representation of ASN.1. -- intgr 22:01, 25 February 2006 (UTC)

I tried to fix this and be more complete and consise, as I think the text-vs-binary debate in an important point in the real world of protocol design. Perhaps this discussion should be somewhere else, but it is often associated with ASN.1.

Website advertising in the external links?[edit]

There are 6 external links that all lead to pages on This number of links make it feel like advertising for the website. I suggest there should be just a single link to the website. --Kelby 23:27, 8 June 2006 (UTC)

Agreed. I removed all the links except for one that links to the homepage. -- intgr 12:41, 12 June 2006 (UTC)

A small error in DER encoding example?[edit]

Shouldn't the length of the "Anybody there?" string be 14 instead of 13?

-- mjsv

Note that all values are in hexadecimal, so we have: 1 (length of integer tag) + 1 (length of integer length) + 1 (length of integer value) + 1 (length of string tag) + 1 (length of string length) + 0e (length of string value) = 13. Rasmus (talk) 20:06, 18 June 2006 (UTC)

DER example -- VisibleString tag wrong?[edit]

The example says:

04 -- tag indicating VisibleString
0e -- length in octets

However, in X.680 section 37.1, VisibleString is listed as having universal tag 26 (0x1A). It's true that all strings are B/C/DER encoded like an OCTET STRING (universal tag 4), but it seems the encoded tag should still be 0x1A, see for instance the example of X.690 section

Of course, the involved standards are quite complex and tersely written, so I may be mistaken, which is why I ask here instead of just changing it. -- Kwi | Talk 23:32, 17 July 2006 (UTC)

The SEQUENCE tag should be 0x30, the VisibleString tag should be 0x1A. Verified with an ASN.1 compiler. So, there were two wrong tags, not one.
-- Vlm 20 September 2006


Or Keep It Simple, Stupid! Example section is meant for people who completely don't understand what ASN.1 is about. And not for people who want to learn how unaligned PER is "better" than XER. I've noticed a trend to overly complicate this section.

So be gentle and don't throw all information at once. Step by step, step by step. Simple language. One new term per paragraph :)

--Kubanczyk 23:02, 18 December 2006 (UTC)

Proposal for edits[edit]

Please find below a proposal for edits to the current article. There are minor changes in text, links and layout, but also a new paragraph - Encoding Control Notation (ECN).

Feel free to contact us regarding any of the changes made. If there are no comments within the next days the edits are considered supported and we will publish the revised article. ITU-T 11:43, 10 December 2007 (UTC)

Abstract Syntax Notation One[edit]

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 CCITT X.409:1984. 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[edit]

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:

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 [1].


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


    FooQuestion ::= SEQUENCE {
        trackingNumber INTEGER,
        question       IA5String

    FooAnswer ::= SEQUENCE {
        questionNumber INTEGER,
        answer         BOOLEAN


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 need 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[edit]

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

30 -- tag indicating SEQUENCE
13 -- length in octets

02 -- tag indicating INTEGER
01 -- length in octets
05 -- value

16 -- tag indicating IA5String
0e -- length in octets
41 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 (it is out of concern utilizing TCP or other protocol for data transfer). The party should be able to decode the octets back using DER.

Example encoded in XER[edit]

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 those 108 octets:

    <question>Anybody there?</question>
Example encoded in PER (unaligned)[edit]

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[edit]

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)[edit]

ECN is a notation to specify specific encodings of ASN.1 types. ECN is useful to describe in ASN.1 legacy protocols. It is possible to specify only the encoding of some types and then complete with a standard encoding rules (usually unaligned PER). An ECN specification uses two kinds of module:

  • Encoding definition modules which describes encodings as sets of encoding objects;
  • Encoding link modules which associate ASN.1 types and encoding object sets

Using ASN.1 in practice[edit]

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.


Standards describing the ASN.1 notation:

  • ITU-T Rec. X.680 | ISO/IEC 8824-1
  • ITU-T Rec. X.681 | ISO/IEC 8824-2
  • ITU-T Rec. X.682 | ISO/IEC 8824-3
  • ITU-T Rec. X.683 | ISO/IEC 8824-4

Standards describing the ASN.1 encoding rules:

  • ITU-T Rec. X.690 | ISO/IEC 8825-1 (BER, CER and DER)
  • ITU-T Rec. X.691 | ISO/IEC 8825-2 (PER)
  • ITU-T Rec. X.693 | ISO/IEC 8825-4 (XER)
  • ITU-T Rec. X.694 | ISO/IEC 8825-5 (XSD mapping)
  • RFC 3641 (GSER)

See also[edit]



This article is based on material taken from the Free On-line Dictionary of Computing prior to 1 November 2008 and incorporated under the "relicensing" terms of the GFDL, version 1.3 or later.

External links[edit]


I like this new version. To go further, I think we could put some effort into expanding the "Using ASN.1 in practice" section. Kim SJ (talk) 11:15, 13 December 2007 (UTC)

Thanks a lot for your thoughts and support, we will post the edits. “Using the ASN.1 in practice” could indeed be expanded. Please add what you find valuable and do not hesitate to contact us and discuss the article further. ITU-T 11:05, 17 December 2007 (UTC)

Example encoded in PER (unaligned)[edit]

The text says "122 bits (less than 16 octets)" then shows 16 hexadecimal pairs which would be 16 full octets or 128 bits. There is an example at the end showing 17 octets, but none has the highest bit set. If these are septets, that's 119 bits. I notice that the first three pairs don't change between the two examples, so if I read the second example as three octets followed by 14 septets that makes 122, but the text should lead me to a 122 bit explanation.  Randall Bart   Talk  17:53, 12 January 2013 (UTC)

Propose to add link to Online ASN.1 encoder/decoder of 3GPP messages[edit]

Online ASN.1 encoder/decoder A free tool that encodes/decodes ASN.1 messages defined by 3GPP. The link:

List/Comparison of open-source ASN.1 software[edit]

I have compiled a (non-exhaustive) list of open-source ASN.1 implementations and their features: I now wonder if it would be appropriate if I create a "Comparison of ASN.1 tools" page based on that list. --Alexey Voronov (talk) 09:41, 20 February 2016 (UTC)

External links modified[edit]

Hello fellow Wikipedians,

I have just modified 2 external links on Abstract Syntax Notation One. Please take a moment to review my edit. If you have any questions, or need the bot to ignore the links, or the page altogether, please visit this simple FaQ for additional information. I made the following changes:

When you have finished reviewing my changes, please set the checked parameter below to true or failed to let others know (documentation at {{Sourcecheck}}).

Question? Archived sources still need to be checked

Cheers.—InternetArchiveBot (Report bug) 01:01, 3 October 2016 (UTC)