An Introduction to Abstract Syntax Notation 1 (ASN.1)

Slides:



Advertisements
Similar presentations
SDL+ The Simplest, Useful Enhanced SDL-Subset The documentation is the design, the design is the system! Copyright © SDL Task Force Consortium.
Advertisements

Chapter 2: Using Objects Part 1. To learn about variables To understand the concepts of classes and objects To be able to call methods To learn about.
1 Pertemuan 05 Model Informasi - SMI Matakuliah: H0372/Manajemen Jaringan Tahun: 2005 Versi: 1/0.
Second part needs improvement (encoding, Compilers)
1 Pertemuan 03 Garis besar manajemen jaringan Matakuliah: H0372/Manajemen Jaringan Tahun: 2005 Versi: 1/0.
TCP/IP Protocol Suite 1 Chapter 21 Upon completion you will be able to: Network Management: SNMP Understand the SNMP manager and the SNMP agent Understand.
Jacob Boston Josh Pfeifer. Definition of HyperText Transfer Protocol How HTTP works How Websites work GoDaddy.com OSI Model Networking.
Chapter 3 Program translation1 Chapt. 3 Language Translation Syntax and Semantics Translation phases Formal translation models.
1 Review of Important Networking Concepts Introductory material. This module uses the example from the previous module to review important networking concepts:
Computer Science A 2: 6/2. Course plan Introduction to programming Basic concepts of typical programming languages. Tools: compiler, editor, integrated.
CSTA is a kind of standard communication protocol used between PBX and computer that is famous in Europe. What is CSTA ? Control Requests Event Notifications.
JavaScript, Third Edition
Jump to first page PKI2001 (TIFR, Mumbai) ASN.1 Abstract Syntax Notation One ASN.1 is a standard way to describe a message(a unit application data) that.
Chapter 3 Basic Foundations: Standards, Models, and Language Network Management: Principles and Practice © Mani Subramanian Chapter 3.
SNMP Management Information
These materials are prepared only for the students enrolled in the course Distributed Software Development (DSD) at the Department of Computer.
SNMP: Simple Network Management Protocol
Abstract Syntax Notation One ASN.1
ASN.1 CNS 4650 Fall 2004 Rev. 2.
Abstract Syntax Notation Computer Networks courses Villanova University.
Protocol Layering Chapter 10. Looked at: Architectural foundations of internetworking Architectural foundations of internetworking Forwarding of datagrams.
Network Management Computer Networks Natawut Nupairoj, Ph.D.
Protocols and the TCP/IP Suite
Architectures. Many tasks involved in encoding, protecting and transmitting user application data as bit stream. Network Architecture is how tasks are.
Presentation Services  need for a presentation services  ASN.1  declaring data type  encoding data types  implementation issues  reading: text, section.
Abstract Syntax Notation ASN.1 Week-5 Ref: “SNMP…” by Stallings (Appendix B)
JAVA BASICS: Variables and References SYNTAX, ERRORS, AND DEBUGGING.
Chapter 3 Basic Foundations: Standards, Models, and Language Network Management: Principles and Practices © Mani Subramanian 2011 Chapter 3 Basic Foundations:
Lec 6 Data types. Variable: Its data object that is defined and named by the programmer explicitly in a program. Data Types: It’s a class of Dos together.
Introduction to PHP A user navigates in her browser to a page that ends with a.php extension The request is sent to a web server, which directs the request.
Prof. Younghee Lee 1 1 Computer Networks u Lecture 14: Network Management Prof. Younghee Lee * Some part of this teaching materials are prepared referencing.
TCOM 509 – Internet Protocols (TCP/IP) Lecture 03_b Protocol Layering Instructor: Dr. Li-Chuan Chen Date: 09/15/2003 Based in part upon slides of Prof.
Standards, Models, and Language
Abstract Syntax Notation One ASN.1. Abstract Syntax Notation One  Both the information and communications models need to be specified syntactically and.
Internet Standard Management Framework
Standards, Models, and Language The Internet Model: Widely used for network management. It is simple scalar model and, hence, easy to implement. The OSI.
Network Management Lecture 2. Basic Foundations: Standards, Models, and Language 3-1 Chapter 3.
IEEE MEDIA INDEPENDENT HANDOVER DCN: Title: Data Type Encoding Date Submitted: May 12, 2007 Presented at IEEE.
Ch 9. Network Management Myungchul Kim
Chapter 3 Basic Foundations: Standards, Models, and Language.
McGraw-Hill © ©The McGraw-Hill Companies, Inc., 2000 Chapter 1 Introduction.
Application support functions Chapter Introduction ASN.1 Security Data encryption Nonrepudiation Authentication Public key certification authorities.
 Variables are nothing but reserved memory locations to store values. This means that when you create a variable you reserve some space in memory. 
 Data Type is a basic classification which identifies different types of data.  Data Types helps in: › Determining the possible values of a variable.
IP ADDRESS An IP (Internet Protocol) address is a unique identifier for a node or host connection on an IP network. An IP address is a 32 bit binary number.
BER ENCODING Basic Encoding Rules. Basic Encoding Rules What is it?  BER is the original rules laid out by the ASN.1 standard for encoding information.
Chapter 27 Network Management Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
SESSION 1 Introduction in Java. Objectives Introduce classes and objects Starting with Java Introduce JDK Writing a simple Java program Using comments.
9/21/2016 Presentation layer Abstract Syntax Notation #1 Basic Encoding Rules.
Packet Structure and Encoding ● Network Layer details ● Application Layer details – Abstract Syntax Notation One (ASN.1) – Encoding Application Services.
Manajemen Jaringan, Sukiswo ST, MT 1 SNMP Management Information Sukiswo
Jaringan Telekomunikasi, Sukiswo ST, MT Sukiswo
Presentation Services
The ITU-T X.500 series and X.509 in a changing world
ASN.1: Introduction Zdeněk Říha.
CS 326 Programming Languages, Concepts and Implementation
Network Management Information model
Dept. of Computer Science and Engineering
ASN.1 소개 건아정보기술 SW개발팀 김강민 주임연구원.
Basic Foundations: Standards, Models, and Language
System and Network Management
Chapter 3 Basic Foundations: Standards, Models, and Language
Tutorial 10: Programming with javascript
COMS/CSEE 4140 Networking Laboratory Lecture 10
Review of Important Networking Concepts
Programming Languages
Simple Network Management Protocol
Standards, Models and Language
Standards, Models and Language
Presentation transcript:

An Introduction to Abstract Syntax Notation 1 (ASN.1) Steinar Andresen/Rolv Bræk/Finn Arve Aagesen Norwegian University of Science and Technology, Trondheim

The need of a “common language” In order to cooperate the following needs arise A shared interpretation of what the data means and a common protocol for interchange A shared view on data structure The ASN.1 Notation Transfer coding rules The ASN.1 Encoding schemes: BER, PER, .. L A N - O r g A P U B L I C W A N L A N O r g C L A N O r g B

The history of ASN.1 General purpose notation and encoding scheme: Developed to be applied to the MHS protocols (X.400) (“born” in 1982) Generalised as general tools ISO 8824 Notation and ISO 8825 Encoding rules in 1990, Revised in 1995 General use in many application fields today

The original “realm” of ASN Applied first to the Presentation layer in the “Open Systems Interconnection”. Soon used to define the protocols of the Applications layer: FTAM, ROSE, MHS, etc. Also used for lower layers

Why ASN.1 and BER? ASN.1 for the data syntax PDU PDU BER for the I P r o t o c o l S t a c k O S I P r o t o c o l S t a c k A p p l i c a t i o n A p p l i c a t i o n ASN.1 for the data syntax P r e s e n t a t i o n P r e s e n t a t i o n PDU PDU s S e s s i o n S e s s i o n n o T r a n s p o r t T r a n s p o r t N e t w o r k BER for the (sequential) transfer syntax N e t w o r k D a t a l i n k D a t a l i n k P h y s i c a l P h y s i c a l

ASN.1 Use PDU PDU ASN.1 ASN.1 BER Encode Decode A PDU can be a complex element (letter, document, …) and: specified using datatypes of SDL, LOTOS, UML, ... implemented using datatypes of CHILL, C++, Java, ... ASN.1 provides a language independent syntax and ASN.1 compilers take care of the mapping C++, Java, SDL... PDU PDU C++, Java, SDL... ASN.1 ASN.1 BER Encode Decode C++, Java,... C++, Java,... 1 |

ASN.1 Module A module is a set of ASN.1 definitions assembled for a specific purpose. The structure of a module is: ModuleDefinition::= ModuleIdentifier DEFINITIONS DEFINITIONS::= BEGIN ModuleBody END

ASN.1 Module Identifier ModuleIdentifer is an element of type Object Identifiers Object Identifiers are adminstrered by ISO, ITU-T, etc. A Module Identifier represents an official reference to the Module.

Module Body ModuleBody::= Exports -- definitions that may be exported to other modules Imports -- definitions that are imported from other modules AssignmentList --this modules definitions | -- “|” means “or” empty

Assignments Type assignment Value assignment W h e a t r R p o : = S EQUENCE{ . } N m f y n c d i Value assignment s a m p l e W R e p o r t W h e a t h e r R e p o r t : : = { . . . . . . } N a m e o f a v a l u e T h e t y p e o f t h i s v a l u e A c t u a l v a l u e s p e c .

Type assignment A type assignment has three syntactic elements: the type reference (the name allocated to it), the symbol “::=“ (means defined as) and the appropriate type notation WheatherReport ::= SEQUENCE { stationNumber INTEGER {1..99999} timeOfReport UTCTime ......... }

Value assignment A value assignment has four syntactic elements: the value reference (the name allocated), the type to which the value belongs the symbol “::=“ (means defined as) and the appropriate value notation Sample value assignment: sampleReport WheatherReport ::= { stationNumber 73290 timeOfReport “900102125703Z” ......... }

Sequence Letter ::= SEQUENCE { opening OCTETSTRING, body OCTETSTRING, closing OCTETSTRING, address AddressType } AddressType ::= SEQUENCE { name OCTETSTRING, number INTEGER, street OCTETSTRING, postOffice OCTETSTRING, state OCTETSTRING, zipCode INTEGER

Optional AddressType ::= SEQUENCE { name OCTETSTRING, number INTEGER, street OCTETSTRING, apartNumber INTEGER OPTIONAL, postOffice OCTETSTRING, state OCTETSTRING, zipCode INTEGER }

Tags Letter ::= SEQUENCE { opening OCTETSTRING, body OCTETSTRING, closing OCTETSTRING, receiverAddr AddressType OPTIONAL, senderAddr AddressType OPTIONAL } receiverAddr [0] AddressType OPTIONAL, senderAddr [1] AddressType OPTIONAL

Spelling Conventions Reserved words: only CAPITAL letters (INTEGER, CHOICE,…) Types: first letter Capital (TransactionID) Value reference: first letter Lowercase (application(0)) Identifier: first letter Lowercase (destination, responder) Macro: only CAPITAL letters

ASN.1 Tagged Types Four classes: 1. UNIVERSAL (ASN.1 In-build types) 2. Application specific types (non-ambiguous within module) 3. Context specific types (non-ambiguous within construct) 3. Private (non-ambiguous within some ”enterprise”) UNIVERSAL: Simple types (BOOLEAN, INTEGER, ENUMERATED, …) Constructor types (SEQUENCE, SEQUENCE OF, SET, SETOF) Additional predefined (NumericString, Teletxstring, GeneralizedTime, …) OBJECT IDENTIFIER Tagging is needed to recognise the types in the transfer syntaxt (when decoding a received PDU)

Universal Types Universal Tag ASN.1 Type 1 BOOLEAN 2 INTEGER 3 BITSTRING 4 OCTETSTRING 5 NULL 6 OBJECTIDENTIFIER 7 ObjectDescriptor 8 EXTERNAL 9 REAL 10 ENUMERATED 11-15 reserved for addenda 16 SEQUENCE, SEQUENCE OF 17 SET, SET OF … ...

Example Example DEFINITIONS::= BEGIN TransactionID ::= INTEGER Component ::= INTEGER {application(0), networkManager(1), systemManager(2)} Request ::= PrintableString EntityIdentifier ::= [PRIVATE 1] IMPLICIT OCTETSTRING RequestPDU ::= SEQUENCE { responseRequired BOOLEAN, TransactionID, requestor EntityIdentifier, request CHOICE { command [0] IMPLICIT SET {destination Component, Request} shutdown [1] IMPLICIT NULL}} ResponsePDU ::= SEQUENCE { TransactionID, responder EntityIdentifier OPTIONAL, result INTEGER {success(0), failure(1)}} END

A Value assignment example aRequestPDU RequestPDU ::= { ResponseRequired TRUE, 45, requestor “MySystem”, request { command {destination systemManager, ‘status’} }} aResponsePDU ResponsePDU::= { 45, result INTEGER {success}}

ASN.1 Transfer Syntax Type Length Value Defines how to encode the values before sending over the line Basically it is a Type, Length, Value encoding scheme with one or more octets for each of the fields. Type Length Value identified by tagging Basic Encoding Rules BER Packed Encoding Rules PER Canonical Encoding Rules CER Disting. Encoding Rules DER

TLV encoding scheme Octet 1 Octet 2 Octet 3 ... Octet n Type Length bit8 bit 7 ...bit1 Type Length Value … Data Element Data Element Data Element

ASN.1 Transfer Syntax ... T A G F I E L D (=Type identifier field) class f n u m b e r | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | Class: 00 UNIVERSAL 01 APPLICATION 10 Context specific 11 Private f: 0 primitive encoding 1 constructed encoding number: <31 directly >=31 as below: last ... class f 11111 1 … 1 … 0 …

Examples BOOLEAN: UNIVERSAL 1 = 00000001 hex INTEGER: UNIVERSAL 2 = 00000002 hex SEQUENCE: UNIVERSAL 16 constructed = 00110000 = 30 hex [PRIVATE 35] IMPLICIT INTEGER = 11011111 00100011 | c l a s f n u m b e r 1 B O L E A N | c l a s f n u m b e r 1 I N T E G R

Length field ... ... Definite form short: length < 128 long: length > 128 Indefinite form: only for constructed types 0 <length> ... 1 <length of length field> <length field> <length field> ... 10000000 <value> <value> 00000000 00000000

V A L U E F I E L D S B O O L E A N E x . F A L S E | | | | | 1 | | | | | | | | 1 | | | | | | | 1 | | | | | | | | c l a s s | f | n u m b e r | | l e n g t h | | c o n t e n t s | ( T R U E w i t h c o n t e n t v a l u e d i f f e r e n t f r o m ) I N T E G E R E x . 1 ( d e c i m a l ) | c l a s f n u m b e r 1 | l e n g t h 1 | 1 | 1 | | | 1 | | | c o n t e n t s |

How to encode RequestPDU ::= SEQUENCE { responseRequired BOOLEAN, TransactionID, requestor EntityIdentifier, request CHOICE { command [0] IMPLICIT SET {destination Component, Request} shutdown [1] IMPLICIT NULL}} where: ResponseRequired = FALSE, TransactionID = 10, requestor = “MySystem”, request = command { destination = networkManager, Request = ‘status’} ??

Encoding summary ... class f 11111 1 … 1 … 0 … Universal Tag ASN.1 Type 1 BOOLEAN 2 INTEGER 3 BITSTRING 4 OCTETSTRING 5 NULL 6 OBJECTIDENTIIER 7 ObjectDescriptor 8 EXTERNAL 9 REAL 10 ENUMERATED 11-15 reserved for addenda 16 SEQUENCE, SEQUENCE OF 17 SET, SET OF … ... Class: 00 UNIVERSAL 01 APPLICATION 10 Context specific 11 Private f: 0 primitive encoding 1 constructed encoding class f n u m b e r | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | number: <31 directly >=31 as below: ... class f 11111 1 … 1 … 0 …