220 likes | 454 Views
ASN.1. CNS 4650 Fall 2004 Rev. 2. What is ASN.1. Abstract Syntax Notation One Overcome how different computer systems transmit data Model parameters exchanged between application entities. Why ASN.1?. What was available at the time Different hardware Different development languages.
E N D
ASN.1 CNS 4650 Fall 2004 Rev. 2
What is ASN.1 • Abstract Syntax Notation One • Overcome how different computer systems transmit data • Model parameters exchanged between application entities
Why ASN.1? • What was available at the time • Different hardware • Different development languages
“Endian” Problem • Taken from Gulliver’s Travels • Whether eggs should be broken on top or bottom • “Little Endian” refers to machines that read bytes right to left (Intel) • “Big Endian” refers to machines that read bytes left to right (Motorola, IBM, SUN) • Data cannot be transferred directly between the two • Tanenbaum’s Stegosaurus”
How to Solve the “Endian” Problem • Marshalling of data • Single “Syntax” • Solutions today • CORBA • ASN.1 • Java and .Net (kind of…)
Development Languages • Languages do not all contain the same data types • For instance C does not really have a boolean it is usually simulated • C requires ‘\0’ to terminate a string, this is not always the case in other languages • Without “standard” types who has to manipulate the data? The sender or receiver?
Backus-Naur Format (BNF) • Formal way to describe formal languages • Most often used to describe computer languages • Designed to be unambiguous
Built-in Language Types • Boolean • Integer • Octet string • Null • Sequence • Set • Many more
Built-in Syntax Definitions • IA5 String • Numeric String • UTC Time • Printable String
BNF Examples • Begin with general then to specifics • Uses := { } [ ] | • := is the left must be replaced by the right • { } [ ] is for formating and grouping • | is for “or”
BNF ASN.1 Example File := SEQUENCE { Owner Owner, fileName PrintableString, createDate UTCTime, contents Any } Owner := SEQUENCE { personalName IA5String, organizationalName IA5String }
Encoding Rules • Basic Encoding Rules (BER) • Distinguished Encoding Rules (DER) • Canonical Encoding Rules (CER) • Packet Encoding Rules (PER)
Basic Encoding Rules (BER) • Represent ASN.1 values as an octect string • Three encoding methods\ • Primitive, definite length • Constructed, definite length • Constructed, indefinite length
BER Parts • TLV • Tag octet • Length octet • Value octet
Distinguished Encoding Rules (DER) • Subset of BER • Exactly one way to represent the octet string • Restricts certain types (BIT STRING) beyond BER • Used for digital certificates
ASN.1 and OIDs • Used by LDAP, Kerberos, and SNMP • Value used to uniquely identify every objectclass and attribute • Object Indentifer (OID) is same as ASN.1
OIDs • Sub-arc • Example: 1.3.6.1.4.1.17946.1 • No standard on how to delegate number after arc • De-facto standard is to place all objectclasses under a sub-arc and all attributes under a separate sub-arc