ASN.1 and its Encoding Rules

advertisement
International Telecommunication Union
ASN.1 Today and
Tomorrow
© 2002 OSS Nokalva
What is ASN.1?
What are Encoding Rules?
 ASN.1 (Abstract Syntax Notation One)
defines the syntax of messages to be
exchanged between peer applications
independently of local representation.
 Encoding Rules define how application
messages should be encoded while in
transit between peers.
Sample ASN.1 Definition
Age ::= INTEGER (0..7)
User ::= SEQUENCE {
name
IA5String (SIZE(1..128)),
age
Age,
address IA5String OPTIONAL,
...
}





Power to express both simple and complex types.
Types may be constrained in size and/or value.
More powerful constraints are available.
Fields may be marked as OPTIONAL.
Type extensibility allows for smooth enhancements.
Rich Set of Types
BOOLEAN
INTEGER
BIT STRING
OCTET STRING
NULL
REAL
ENUMERATED
SEQUENCE
SEQUENCE OF
GeneralizedTime
IA5String
BMPString
UTF8String
What are the Basic Encoding Rules
Age ::= INTEGER (0..7)
firstGrade Age ::= 6
Application 1
02 01 06
Application 2
Value
Length
Tag


}
Total of
24 bits
BER specifies how data should be encoded for transmission,
independently of machine type, programming language, or representation
within an application program.
BER is highly structured, prefixing all values with a tag and a length.
What are the Packed Encoding Rules?
Age ::= INTEGER (0..7)
firstGrade Age ::= 6
Application 1
110
Application 2
total length of 3 bits



Like BER, PER specifies how data should be encoded for transmission,
independently of machine type, programming language, or representation
within an application program.
Unlike BER, tags are never transmitted, while lengths and values are not
transmitted if known by both peers.
PER’s reason for existence is to conserve bandwidth. It is valuable in
audio and video over the Internet, air-ground communication, radiopaging, or wherever bandwidth is at a premium.
What are the XML Encoding Rules?
Age ::= INTEGER (0..7)
firstGrade Age ::= 6
Application 1
<Age>6</Age>
Application 2
total length of 12 octets




Just like BER and PER, XER also specifies how data should be encoded
for transmission, independently of machine type, programming language,
or representation within an application program.
Unlike the more compact encoding rules, XER is immediately legible.
XER’s reason for existence is ease of legibility (no tools are needed), but
XER uses significantly more bandwidth.
ECN
Encoding Control Notation
 Customize the encoding
 Modify (improve) the standard ASN.1
encoding rules
 Retrofit ASN.1 syntax to non-ASN.1
protocols
Some Benefits of ASN.1
 Application protocol designers can focus on the information that






needs to be exchanged
Provides implementors with a more precise description of the
messages to be exchanged
Application programmers can focus on the substance of their
application
Allows you to choose the most suitable programming language
Development time significantly reduced with use of quality ASN.1
tools
Proven technology
Widely adopted International Standard
Using ASN.1
ASN.1 can be used with most modern programming languages,
including Java and C++, as well as older ones such as C and COBOL.
ASN.1
PersonalInfo ::= SEQUENCE {
married BOOLEAN,
age
INTEGER (123456..124000),
name
PrintableString
}
Generated C header file: typedef struct PersonalInfo {
ossBoolean married;
int
age;
char
*name;
} PersonalInfo;
Encoding/decoding:
ossEncode(world, PersonalInfo_PDU,
&inBuf, &outBuf);
ossDecode(world, &pdunum, &inBuf,
&outBuf);
Development Work Flow
ASN.1
Syntax
ASN.1
Compiler
C Header
File
Encoder/
Decoder
Libraries
include
Application
Source Code
C/C++
Compiler
Linker
Executable Application
Current Uses of ASN.1
 Audio & Video over the Internet
AT&T, Intel, IBM, Microsoft, 3COM
 Electronic Commerce
American Express, GTE, MasterCard, VISA
 Telephony
AT&T, MCI, Motorola, Nokia, Sprint
 Aviation
FAA, ICAO
 Manufacturing
Ford, Mercedes Benz, Mitsubishi
 Network Management
Bull, Compaq, Hewlett-Packard, Sun
 Routers
Bay Networks, Cisco, Racal, Xyplex
ASN.1 and Encoding Rules Standards Documents
 ITU-T Rec. X.680 | ISO/IEC 8824-1 - Basic ASN.1





Notation
ITU-T Rec. X.681 | ISO/IEC 8824-2 - Information Object
Classes
ITU-T Rec. X.682 | ISO/IEC 8824-3 - Constraints
ITU-T Rec. X.683 | ISO/IEC 8824-4 - Parameterization
ITU-T Rec. X.690 | ISO/IEC 8825-1
Basic Encoding Rules (BER)
Canonical Encoding Rules (CER)
Distinguished Encoding Rules (DER)
ITU-T Rec. X.691 | ISO/IEC 8825-2
Packed Encoding Rules (PER)
Newest ASN.1 and Encoding Rules
Standards Documents
 ITU-T Rec. X.692 | ISO/IEC 8825-3
Encoding Control Notation (ECN)
 ITU-T Rec. X.693 | ISO/IEC 8825-4
XML Encoding Rules (XER)
 ITU-T Rec. X.694 | ISO/IEC 8825-5
Encoding XML-Defined Data Using ASN.1
ASN.1 Into the Future
 Security standards: XML Cryptographic




Message Syntax (XCMS)
Biometrics Information Management and
Security (X9.84)
Intelligent Transportation System (ITS)
Electric Power Utilities
Cellular telephones (UMTS)
The future: Why ASN.1?
 XML
ASN.1 as an XML schema notation is simpler
than and about as powerful as XSD. Users can
benefit from the browser display capabilities of
XML and still have compact ASN.1 encodings.
 PER
The compact encodings of PER are ideal for lowbandwidth applications of which there are many.
PER can go where XML encodings can not. It
makes XML usable in applications that it
otherwise cannot touch.
The future: Why ASN.1? (cont.)

ECN
Apply ASN.1 to legacy protocols. Replace error-prone hand
encodings and bitmaps with machine-processable cutomized
encodings.

DER
Used in every secure web purchase, secure email, digital
signatures, etc.

Extensibility
The extensibility built into ASN.1 allows version 1 systems to
seamlessly interwork with version 2 systems.
ASN.1 Consortium
 Share technical information and solutions
 Develop implementor’s agreement on limits to




impose on ASN.1
Coordinate with the ASN.1 Project to promote
the use of ASN.1
Keep interested parties abreast of upcoming
applications of ASN.1 in industry
Create test suite database
http://www.asn1.org
Download