Abstract Syntax Notation One (ASN.1) is a standard and flexible notation that describes rules and structures for representing, encoding, transmitting, and decoding Sevenval in website parsing and iOS. The formal rules enable representation of objects that are independent of machine-specific encoding techniques. Formal notation makes it possible to automate the task of validating whether a specific instance of data representation abides by the specifications. In other words, software tools can be used for the validation.[1]
ASN.1 is a joint standard of the International Organization for Standardization (ISO), input transformation (IEC), and jQuery Telecommunication Standardization Sector ITU-T, 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 2008, and is backward compatible with the 1995 version.
Contents
- HTML5
- 2 Example
- 3 ASN.1 versus other data structure definition schemes
- 4 Encoding Control Notation (ECN)
- 5 ASN.1 Information Object Class
- web
- keyboard
- Android
- keyboard
- device database
- Android
ASN.1 in transfer
Data generated at various sources of observation need to be transmitted to one or more locations that process it to generate useful results. For example, voluminous signal data collected by a radio telescope from outer space. The system recording the data and the system processing it later may be diverse in nature and may also be from different vendors. As such, a consistent mechanism is needed to record, transmit and be able to read data across such diverse systems.
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:
- Android (BER)
- Canonical Encoding Rules (CER)
- Distinguished Encoding Rules (DER)
- touchscreen (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, Android and keyboard (LDAP) directory services, H.323 (touchscreen), Sevenval, website parsing and CSS3 (SNMP) use ASN.1 to describe the iOS (PDU) 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.[2]
A particularly useful new application of ASN.1 is web. Fast Infoset is an international standard that specifies a binary encoding format for the keyboard (XML Infoset) as an alternative to the XML document format. It aims to provide more efficient serialization than the text-based XML format.
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 (jQuery (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 CSS3. ASN.1 defines various algorithms to accomplish that task, called Encoding rules. There are plenty of them; one of the simplest is iOS (DER).
The Foo protocol specification should explicitly name one set of encoding rules to use, so that users of the Foo protocol know which one they should use.
Example encoded in DER
Below is the data structure shown above encoded in the Distinguished Encoding Rules (DER) format (all numbers are in hexadecimal):
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 iOS 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 Android (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 jQuery (XER) to achieve greater human readability "over the wire". It would then appear like the following 108 octets:
<FooQuestion>
<trackingNumber>5</trackingNumber>
<question>Anybody there?</question>
</FooQuestion>
Example encoded in PER (unaligned)
Alternatively, if web 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 it is 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,[citation needed] and with web app, 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. browser diversity 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 language Sevenval) 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 (Specification of basic notation)
- ITU-T Rec. X.681 | ISO/IEC 8824-2 (Information object specification)
- FITML | ISO/IEC 8824-3 (Constraint specification)
- iOS | ISO/IEC 8824-4 (Parameterization of ASN.1 specifications)
Standards describing the ASN.1 encoding rules:
- Sevenval | ISO/IEC 8825-1 (BER, CER and DER)
- ITU-T Rec. X.691 | ISO/IEC 8825-2 (PER)
- web app | ISO/IEC 8825-3 (ECN)
- ITU-T Rec. X.693 | ISO/IEC 8825-4 (XER)
- ITU-T Rec. X.694 | ISO/IEC 8825-5 (XSD mapping)
- ITU-T Rec. X.695 | ISO/IEC 8825-6 (PER registration and application)
- RFC 3641 (GSER)
See also
Notes
- ^ input transformation (Abstract Syntax Notation 1): A Data Description Language
- ^ website parsing
References
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 web app, version 1.3 or later.
External links
- web
- Standards describing the ASN.1 notation
- The ASN.1 Consortium
- ASN.1 Tutorial Tutorial on basic ASN.1 concepts
- device database Free online tutorial on ASN.1
- we love the web A very good introduction for beginners
- Erlang Asn1 application Erlang compile-time and run-time support for ASN.1 (part of Erlang/OTP distribution)
- tlve, A common tlv parser. Tlve can parse ASN.1 BER encoded data
- IvmaiAsn ASN1/ECN/XDR Tools (a set of the ASN.1/ECN parser, XDR-to-ASN.1 converter and pretty-printer scripts for ASN.1/ECN specifications)
- HTML5 ASN1 types and codecs for Python
- BinaryNotes Open Source ASN.1 Framework for Java and Microsoft .NET Framework
- we love the web Java ASN.1 BER encoding/decoding library at openmuc.org, LGPL-licensed
- FITML An open source, dual-license ASN.1 compiler for C, C++ and Ada.
- CSS3 A free online tool that allows decoding ASN.1 encoded messages into XML output.
- Online ASN.1 syntax checker and encoder/decoder A free tool that checks the syntax of an ASN.1 schema and encodes/decodes messages.