Talk:ASN.1

Captial letters
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
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?
There are 6 external links that all lead to pages on http://asn1.elibel.tm.fr/ 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?
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?
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 8.21.5.4.

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

KISS
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
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
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
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.

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 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
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
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:

 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)
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
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
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)

Yes!
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)
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
Online ASN.1 encoder/decoder A free tool that encodes/decodes ASN.1 messages defined by 3GPP. The link: http://3gpp-message-analyser.com/

List/Comparison of open-source ASN.1 software
I have compiled a (non-exhaustive) list of open-source ASN.1 implementations and their features: https://github.com/alexvoronov/geonetworking/tree/master/asn1-datatypes#other-asn1-tools. 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
Hello fellow Wikipedians,

I have just modified 2 one 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:
 * Added archive https://web.archive.org/web/20120801231940/http://www.nal.usda.gov:80/pgdic/Probe/v2n2/using.html to http://www.nal.usda.gov/pgdic/Probe/v2n2/using.html
 * Added archive https://web.archive.org/web/20140109174656/http://www.marben-products.com/asn.1/services/decoder-asn1.html to http://www.marben-products.com/asn.1/services/decoder-asn1.html

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

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

Requested move 3 June 2020

 * The following is a closed discussion of a requested move. Please do not modify it. Subsequent comments should be made in a new section on the talk page. Editors desiring to contest the closing decision should consider a move review after discussing it on the closer's talk page. No further edits should be made to this discussion. 

The result of the move request was: page moved. (non-admin closure)  ~SS49~   {talk}  22:43, 10 June 2020 (UTC)

Abstract Syntax Notation One → ASN.1 – Per WP:COMMONNAME, the most commonly used name should be used as a title. Per the Google Ngram viewer ASN.1 is more commenly used Afvalbak (talk) 15:10, 3 June 2020 (UTC) Afvalbak (talk) 15:10, 3 June 2020 (UTC)


 * The discussion above is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.

Is there an error in the 'Example encoded in PER (unaligned)'?
The provided example for encoding using unalligned PER is:

There are 13 (0x0d) octets describing the string, however the described length is 14 (0x0e). Is this correct? Is the length in terms of 7 bit characters (as in the example), or in 8 bit octets (as described earlier in the text)?

I think the example should get an additional note explaining this. I cannot add it myself, since I do not know the answer. — Preceding unsigned comment added by 85.149.106.126 (talk) 15:08, 14 December 2020 (UTC)

Who the fuck thought verth was a good idea????
This is completely unreadable. stw (talk) 21:54, 25 November 2023 (UTC)


 * Excuse my language, I should have gone to bed... To anyone confused, I was talking about the vertical table headings in the "Encodings" section. I stand by my point, though: it's atrocious. How about this: BER which renders as BER. I don't know about usability on mobile or for the visually impaired. stw (talk) 08:27, 26 November 2023 (UTC)

5G link gives 404: did it ever link to useful info?
https://www.3gpp.org/news-events/3gpp-news/1987-imt2020_workshop, as linked in the Applications table, resolves to a 404. The wayback machine has a link ( https://www.3gpp.org/news-events/3gpp-news/1987-imt2020_workshop ) but I'm not sure if that link conveys any relevant information about 5G's usage of ASN.1 I'd prefer that someone who knows the either subject better than me take a look. 130.45.54.53 (talk) 20:50, 15 July 2024 (UTC)