Abstract
The ASN.1 group of ISO/IEC/ITU-T has produced a new standard that specifies an XML encoding of messages that can be defined in the ASN.1 language. For the writers and implementors of protocols that use ASN.1, the newly standardized XML Encoding Rules are an alternative to the traditional binary encodings of ASN.1 types. This along with enhancements that have been made to the language itself makes ASN.1 a complete schema language for XML and a viable alternative to both W3C XML Schema and RELAX NG.
ASN.1 is a mature and stable notation for defining protocol messages and is widely deployed in the telecommunications networks and used in many protocols in the areas of cellular telephony, security, videoconferencing, air transportation, messaging, directory, and more.
A key aspect of ASN.1 is the clean separation between the "abstract syntax" (or "message description") and the "transfer syntax" (or "encoding") of data structures and messages. The ASN.1 notation defines a set of simple data types, more complex set of types such as choices, structures and arrays, and subtype constraints for restricting the values of all types. These types are "abstract", in the sense that no particular representation (encoding) of the data is normally stated or implied in the type definitions themselves.
The greatest benefit of the separation between the abstract syntax and the encoding is that the applications that implement protocols that use ASN.1 don't need to be concerned with how the data is encoded on the line, and therefore can concentrate on the data itself, its relationships and semantics.
Any existing ASN.1 message description can be encoded either in a compact binary form, or in XML by using the XML Encoding Rules. In addition to this, what makes ASN.1 different from the other XML schema languages is the higher level of abstraction in the description of the structure of the XML instances, which is reflected in the application interfaces.
In this paper, several examples are given and four main scenarios are envisioned:
1) A set of networked systems implementing an ASN.1-based protocol and exchanging binary-encoded messages is shown. Some machines produce additional XML encodings of the same data for use locally. The XML messages can be produced for diagnostics, monitoring or other purposes.
2) A system producing XML documents conforming to an XML Schema specification is shown. An ASN.1 specification equivalent to the XML Schema specification can be written, and an ASN.1-based system implemented to process and re-package the data. This makes it possible to receive XML messages from the XML-based system, then decode and re-encode them into a more-compact binary encoding.
3) A protocol specified both in ASN.1 and (compatibly) in XML Schema and allowing use of both binary and XML encodings is shown. This grants much freedom to implementors, who can decide whether to write the application by using an XML Schema toolkit or an ASN.1 toolkit.
4) An XML-based protocol specified in ASN.1 as the primary XML schema language is shown. This provides users with a simple data model, a simple API and excellent tool support.
Keywords
Table of Contents
The ASN.1 language is a mature and stable notation for defining protocol messages, and is widely deployed in the telecommunications networks.
It is used by many protocols in the areas of cellular telephony, security, biometrics, videoconferencing, air transportation, messaging, directory, etc.
Until recently, ASN.1 messages could only be encoded in binary form, by using one of several standardized sets of encoding rules.
The ASN.1 group of ISO/IEC/ITU-T has recently produced a new standard - ITU-T Recommendation X.693 | ISO/IEC 8825-4: XML Encoding Rules (XER) - which specifies an XML encoding of the messages that can be defined in the ASN.1 language.
With the introduction of the XML Encoding Rules, the ASN.1 language has become a schema definition language for XML.
The following example shows a set of ASN.1 type definitions.
PersonnelRecord ::= SEQUENCE {
name Name,
title VisibleString,
number EmployeeNumber,
dateOfHire Date,
workingDays SEQUENCE OF INTEGER,
nameOfSpouse Name,
children SEQUENCE OF
child ChildInformation DEFAULT {} }
ChildInformation ::= SEQUENCE {
name Name,
dateBirth Date }
Name ::= SEQUENCE {
givenName VisibleString,
initial VisibleString,
familyName VisibleString }
EmployeeNumber ::= INTEGER
Date ::= VisibleString -- YYYYMMDDThe type PersonnelRecord defined in the example above is the formal description of a message, or part of a message.
This notation describes the pure data structure of a message without regard to any possible representations - or encodings - of message instances.
Any message defined in ASN.1 can be encoded by using any of the standardized Encoding Rules of ASN.1:
The classic Basic Encoding Rules (BER)
The more efficientPacked Encoding Rules (BER)
The newly standardized XML Encoding Rules (XER)
The following example shows a value of the PersonnelRecord message as encoded by the XML Encoding Rules of ASN.1.
<?xml version="1.0" encoding="UTF-8"?> <PersonnelRecord> <name> <givenName>John</givenName> <initial>P</initial> <familyName>Smith</familyName> </name> <title>Director</title> <number>51</number> <dateOfHire>19710917</dateOfHire> <workingDays> <INTEGER>1</INTEGER> <INTEGER>2</INTEGER> <INTEGER>5</INTEGER> <INTEGER>6</INTEGER> </workingDays> <nameOfSpouse> <givenName>Mary</givenName> <initial>T</initial> <familyName>Smith</familyName> </nameOfSpouse> <children> <child> <name> <givenName>Ralph</givenName> <initial>T</initial> <familyName>Smith</familyName> <dateBirth>19571111</dateBirth> </child> <child> <name> <givenName>Susan</givenName> <initial>B</initial> <familyName>Jones</familyName> </name> <dateBirth>19590717</dateBirth> </child> </children> </PersonnelRecord>
By default, the application of XML Encoding Rules to an ASN.1 message definition produces a simple XML document with:
No namespace declarations
No attributes
No space-separated lists
No processing instructions
ASN.1 identifiers or type names used directly as element names
XML encoding properties can be assigned to ASN.1 types and components in order to alter the XML that is generated.
XML encoding properties allow fine control over the XML encoding and support namespaces, attributes, space-separated lists, and the insertion of processing instructions.
The following example shows an assignment of XML encoding properties to the PersonnelRecord type definition.
PersonnelRecord ::= SEQUENCE {
name Name,
title VisibleString,
number EmployeeNumber,
dateOfHire Date,
workingDays SEQUENCE OF INTEGER,
nameOfSpouse Name,
children SEQUENCE OF
child ChildInformation DEFAULT {} }
--Other type definitions--
NAME PersonnelRecord as "pr"
NAMESPACE-DECLARATION PersonnelRecord
AS "http://www.blablabla.com/blabla"
NAME PersonnelRecord.number AS "EN"
ATTRIBUTE PersonnelRecord.title
LIST PersonnelRecord.workingDays
UNTAGGED PersonnelRecord.children
The following example shows a value of the PersonnelRecord message as encoded by the XML Encoding Rules with the application of the XML encoding properties shown above.
<?xml version="1.0" encoding="UTF-8"?> <pr xmlns="http://www.blablabla.com/blabla" title="Director"> <name> <givenName>John</givenName> <initial>P</initial> <familyName>Smith</familyName> </name> <EN>51</EN> <dateOfHire>19710917</dateOfHire> <workingDays>1 2 5 6</workingDays> <nameOfSpouse> <givenName>Mary</givenName> <initial>T</initial> <familyName>Smith</familyName> </nameOfSpouse> <child> <name> <givenName>Ralph</givenName> <initial>T</initial> <familyName>Smith</familyName> </name> <dateBirth>19571111</dateBirth> </child> <child> <name> <givenName>Susan</givenName> <initial>B</initial> <familyName>Jones</familyName> </name> <dateBirth>19590717</dateBirth> </child> </pr>
Usually there may be more than one way to encode a given message value - all the standard ASN.1 Encoding Rules provide a number of encoder's options.
Each standard set of Encoding Rules has a canonical variant, which provides a unique representation for each of the possible message values.
This uniqueness is necessary when cryptographic techniques - such as digital signatures - are to be applied to a message or part of a message.
The Canonical XML Encoding Rules of ASN.1 enable the application of such cryptographic techniques to XML documents.
The ANSI X9F3 committee is working on the specification of an XML Cryptographic Message Syntax (X9.96), which will be defined in ASN.1.
The following example shows a value of the PersonnelRecord message as encoded by the Canonical XML Encoding Rules.
<PersonnelRecord><name><givenName>John</givenName><initial>P</initial><familyName>Smith</familyName></name><title>Director</title><number>51</number><dateOfHire>19710917</dateOfHire><workingDays><INTEGER>1</INTEGER><INTEGER>2</INTEGER><INTEGER>5</INTEGER><INTEGER>6</INTEGER></workingDays><nameOfSpouse><givenName>Mary</givenName><initial>T</initial><familyName>Smith</familyName></nameOfSpouse><children><child><name><givenName>Ralph</givenName><initial>T</initial><familyName>Smith</familyName></name><dateBirth>19571111</dateBirth></child><child><name><givenName>Susan</givenName><initial>B</initial><familyName>Jones</familyName></name><dateBirth>19590717</dateBirth></child></children></PersonnelRecord>
The following example shows a value of the PersonnelRecord message as encoded by the Canonical XML Encoding Rules with the application of the XML encoding properties shown above.
<pr xmlns="http://www.blablabla.com/blabla" title="Director"><name><givenName>John</givenName><initial>P</initial><familyName>Smith</familyName></name><EN>51</EN><dateOfHire>19710917</dateOfHire><workingDays>1 2 5 6</workingDays><nameOfSpouse><givenName>Mary</givenName><initial>T</initial><familyName>Smith</familyName></nameOfSpouse><child><name><givenName>Ralph</givenName><initial>T</initial><familyName>Smith</familyName></name><dateBirth>19571111</dateBirth></child><child><name><givenName>Susan</givenName><initial>B</initial><familyName>Jones</familyName></name><dateBirth>19590717</dateBirth></child></pr>
ASN.1 as an XML schema language can describe the structure of any XML document that can be described by other XML schema languages.
The whole set of features that are currently available in the ASN.1 language, however, do not match exactly those available in other schema languages.
The main targets of the XML-related work in the ASN.1 group were to:
Enable ASN.1 to produce any well-formed XML document that a given XML-based system or application may expect to receive and that conforms to a given schema.
Enable ASN.1 to process any well-formed XML document that a given XML-based system or application may send, given knowledge of the schema.
By using ASN.1 as an XML schema language, users benefit from the immediate availability of the other standard sets of Encoding Rules - such as the Packed Encoding Rules - for all those applications where the size of the messages is important.
A set of networked systems implementing an ASN.1-based protocol and exchanging compact binary-encoded messages is shown. Some machines produce additional XML encodings of the same data for use locally. The XML messages can be produced for diagnostics, monitoring or other purposes.
A system producing XML messages conforming to a W3C XML Schema schemais shown.An ASN.1 schema equivalent to the W3C XML Schema schema has been written and an ASN.1-based system implemented to process and re-package the data. XML messages received from the XML-based system are decoded and re-encoded into a more-compact binary encoding.
A protocol specified both in ASN.1 and in W3C XML Schema and allowing use of both binary and XML encodings is shown. This grants much freedom to implementors, who can decide whether to write the application by using an XML Schema toolkit or an ASN.1 toolkit.
An XML-based protocol specified in ASN.1 as the primary XML schema language is shown. This provides users with a simple data model, a simple API and excellent tool support.
The ASN.1 language standards are jointly developed by ITU-T and ISO/IEC. The 1997 edition is currently in force, while the 2002 edition will be approved this Summer.
ITU-T Recommendation X.680 (1997) | ISO/IEC 8824-1:1998: Specification of Basic Notation (plus Amd. 3 for XML)
ITU-T Recommendation X.681 (1997) | ISO/IEC 8824-2:1998: Information Object Specification (plus Amd. 2 for XML)
ITU-T Recommendation X.682 (1997) | ISO/IEC 8824-3:1998: Constraint Specification
ITU-T Recommendation X.683 (1997) | ISO/IEC 8824-4:1998: Parameterization of ASN.1 Specifications
ITU-T Recommendation X.690 (1997) | ISO/IEC 8825-1:1998: Basic Encoding Rules (BER), Canonical Encoding Rules (CER), and Distinguished Encoding Rules (DER)
ITU-T Recommendation X.691 (1997) | ISO/IEC 8825-2:1998: Packed Encoding Rules (PER)
ITU-T Recommendation X.693 (2002) | ISO/IEC 8825-4:2002: XML Encoding Rules (XER)
The ITU-T Languages Recommendations are available free of charge in electronic form from the ITU-T website at:
http://www.itu.int/ITU-T/studygroups/com17/languages
The ASN.1 language is a member of the ITU-T family of languages for telecommunication systems, which also includes:
SDL (Specification and Description Language)
MSC (Message Sequence Charts)
TTCN (Tree and Tabular Combined Notation)
Books:
ASN.1 - Communication Between Heterogeneous Systems
(Olivier Dubuisson, Morgan Kaufmann, 2001)
Can be downloaded free of charge from:
http://www.oss.com/asn1/dubuisson.html
ASN.1 Complete
(John Larmouth, Morgan Kaufmann, 2000)
Can be downloaded free of charge from:
http://www.oss.com/asn1/larmouth.html
Links:
http://asn1.elibel.tm.fr
http://www.itu.int/ITU-T/asn1
France Telecom ASN.1 Syntax Checker and Pretty-Printer (Web based):
http://asn1.elibel.tm.fr/asnp
OSS Nokalva ASN.1 Syntax and Semantics Checker:
http://www.oss.com/products/checksyntax.html
A comprehensive list of existing ASN.1 tools - many of which free - can be found at:
http://asn1.elibel.tm.fr/en/links/index.htm#tools
http://asn1.elibel.tm.fr/en/links/index.htm#xml
The objectives of the ASN.1 Project at ITU-T are:
Promote use of ASN.1 within the ITU-T and in other standards development organizations (ISO, ETSI, ECMA, IETF, etc.).
Help users understand and write ASN.1 specifications.
Provide tools and ensure quality of the specifications to be published.
The ITU-T ASN.1 Project maintains an ASN.1 Module Database, which contains the complete ASN.1 specifications of many ITU-T protocols. The ASN.1 Module Database can be found at:
http://www.itu.int/itu-t/asn1/database
The Object Identifier Repository is a Web-based Registry of object identifiers (OID's). It can be found at:
http://asn1.elibel.tm.fr/oid
The home page of the ITU-T ASN.1 Project is at:
http://www.itu.int/itu-t/asn1
The ASN.1 Consortium is a non-profit organization with the following main objectives:
Share resources and information among ASN.1 tool vendors and users.
Promote use of ASN.1 (press, companies, universities, organizations that develop standards and applications, etc.).
The home page of the ASN.1 Consortium is at:
http://www.asn1.org
Group says ASN.1 can field XML, save bandwidth (in EE Times, Aug 9, 2001)
"As digital communications spreads from cell phones to wireless personal organizers and XML-powered informations appliances, [ASN.1] claims to have the interoperability Rosetta stone in place."
ASN.1 Markup Language (in The XML Cover Pages, Aug 8, 2001)
Work is also underway to allow messages described using XML to be converted to ASN.1, thereby circumventing the verbosity of XML encodings and allowing them to be encoded very compactly.
ASN.1 and XML Messaging (in Dr. Dobb's Journal, Jul 17, 2001)
"It makes it possible for XML to go places that right now it just cannot go. Specifically, [the ASN.1 group] expects that cellphones, PDAs, and other constrained devices will want to use ASN.1 to transform XML messages into a bandwith-friendly for transmission."
OASIS XCBF Technical Committee for XML Common Biometric Format (in The XML Cover Pages, Feb. 11, 2002)
"The encodings created will be specified in accordance with the ASN.1 schema definitions published in ANS X9.84:2000 Biometrics Information Management and Security for The Financial Services Industry"
![]() ![]() |
Design & Development by deepX Ltd. 2002 |