Dept. of Computer Science and Engineering

Slides:



Advertisements
Similar presentations
Management Information Base for Version 2 of the Simple Network Management Protocol Presented by Zhou Ji (MIB for SNMPv2) By SNMPv2 Working Group.
Advertisements

Programming Languages and Paradigms
TCP/IP Protocol Suite 1 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 24 Network Management: SNMP.
Data Types and Expressions
1 Jim Binkley SNMP SMI Structure of Management Information Network Mgmt/Sec.
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.
CSCE 515: Computer Network Programming Chin-Tser Huang University of South Carolina.
Chapter 3 Program translation1 Chapt. 3 Language Translation Syntax and Semantics Translation phases Formal translation models.
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.
COMP4690, by Dr Xiaowen Chu, HKBU
1 Kyung Hee University Prof. Choong Seon HONG SNMP Management Information.
SNMP (Simple Network Management Protocol) Jon Sevy Geometric and Intelligent Computing Laboratory Department of Mathematics and Computer Science Drexel.
Chapter 3 Basic Foundations: Standards, Models, and Language.
Chapter 6 Overview Simple Network Management Protocol
SNMP Management Information
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.
Network Management Computer Networks Natawut Nupairoj, Ph.D.
AML ASN.1 Markup Language A markup notation for ASN.1 values Copyright © 2001 Griffin Consulting, All Rights Reserved. Griffin Consulting 1625 Glenwood.
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)
Definition A string is a sequence of symbols. Examples “Hi, Mom.” “YAK” “abbababba” Question In what ways do programmers use strings?
Abstract Syntax Notation One ASN.1. Abstract Syntax Notation One  Both the information and communications models need to be specified syntactically and.
An Introduction to Abstract Syntax Notation 1 (ASN.1)
Internet Standard Management Framework
Object-Oriented Program Development Using Java: A Class-Centered Approach, Enhanced Edition.
Recognizing PL/SQL Lexical Units. 2 home back first prev next last What Will I Learn? List and define the different types of lexical units available in.
Management Information Base for Version 2 of the Simple Network Management Protocol (MIB for SNMPv2)
Internet & World Wide Web How to Program, 5/e. © by Pearson Education, Inc. All Rights Reserved.2.
Compiler Construction By: Muhammad Nadeem Edited By: M. Bilal Qureshi.
ELEE 4303 Digital II Introduction to Verilog. ELEE 4303 Digital II Learning Objectives Get familiar with background of HDLs Basic concepts of Verilog.
 Introduction  Structure of Management Information  Practical Issues  Summary 2.
Programming Languages and Design Lecture 2 Syntax Specifications of Programming Languages Instructor: Li Ma Department of Computer Science Texas Southern.
Chapter 3 Basic Foundations: Standards, Models, and Language.
Application support functions Chapter Introduction ASN.1 Security Data encryption Nonrepudiation Authentication Public key certification authorities.
© 2006 Pearson Addison-Wesley. All rights reserved 1-1 Chapter 1 Review of Java Fundamentals.
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.
9/21/2016 Presentation layer Abstract Syntax Notation #1 Basic Encoding Rules.
Manajemen Jaringan, Sukiswo ST, MT 1 SNMP Management Information Sukiswo
Jaringan Telekomunikasi, Sukiswo ST, MT Sukiswo
Network management Communication model
Presentation Services
SNMP.
Simple Network Management Protocol (SNMP)
Lec7: SNMP Management Information
Network Management: SNMP
The ITU-T X.500 series and X.509 in a changing world
ASN.1: Introduction Zdeněk Říha.
Revision Lecture
Network Management Information model
Network Management Computer Networks.
ASN.1 소개 건아정보기술 SW개발팀 김강민 주임연구원.
Basic Foundations: Standards, Models, and Language
System and Network Management
Lexical and Syntax Analysis
Chapter 3 Basic Foundations: Standards, Models, and Language
R.Rajkumar Asst.Professor CSE
مهندسی فناوری اطلاعات ارائه دهنده دکتر سيد امين حسيني
New Perspectives on XML
COMS/CSEE 4140 Networking Laboratory Lecture 10
Chap 2. Identifiers, Keywords, and Types
Simple Network Management Protocol
A Brief Introduction to Internet Network Management
COMPILER CONSTRUCTION
Standards, Models and Language
Standards, Models and Language
Presentation transcript:

Dept. of Computer Science and Engineering ASN.1 & BER J. Won-Ki Hong Dept. of Computer Science and Engineering POSTECH Tel: 054-279-2244 Email: jwkhong@postech.ac.kr 1 1

Table of Contents Abstract Syntax Notation One (ASN.1) Overview Properties & Restrictions Type and Value Definitions ASN.1 Simple Types ASN.1 Structured Types ASN.1 Macro Definitions Basic Encoding Rules (BER) Tags, Lengths & Values Encoding Examples 3

Overview of ASN.1 a machine independent data description language CCITT (X.208) and ISO (ISO 8824) standard define abstract syntax of application data define the structure of application and presentation protocol data units (PDUs) define SNMP and OSI Management Information Base (MIB) 4

ASN.1 Terminology Abstract Syntax Data Type Encoding Encoding Rules describes the generic structure of data allows data types and values to be defined Data Type a named set of values -- may be simple or structured Encoding sequence of octets used to represent a data value Encoding Rules specifies the mapping from one syntax to another Transfer Syntax describes how data are actually represented in terms of bit patterns while in transit 4

Abstract & Transfer Syntaxes Application component data transfer (e.g, TCP, OSI session) Local storage (e.g, MIB) User local mapping user presentation Abstract Syntax (e.g., ASN.1) encoding rules Transfer (e.g., BER) 4

ASN.1 Module Definition <modulereference> DEFINITIONS ::= BEGIN The basic building block of an ASN.1 specification is the module See Figure B.2 (BNF grammar for ASN.1) Modules have the following basic form <modulereference> DEFINITIONS ::= BEGIN EXPORTS IMPORTS AssignmentList END Definitions in this module that may be imported by other modules. Definitions that are to be imported from other modules. Type assignments, value assignments, and macro definitions that are defined in this module. 4

Lexical Conventions Comments begin with two hyphens (“--”) and terminated either by another set (“--”) or the end of line character Identifiers begin with a letter, and may contain letters, digits, and hyphens, but may not end with a hyphen or contain two consecutive hyphens The type identifier must start with an uppercase letter The value identifier must start with a lowercase letter Reserved keywords are all uppercase Multiple spaces and blank lines can be considered as a single space 4

Categories of ASN.1 Data Types Simple (Primitive) atomic types, with no components Structured types with components Tagged types derived from other types Other CHOICE and ANY types Every ASN.1 data type, with the exception of CHOICE and ANY types, has an associated TAG, which consists of a class name and nonnegative integer tag number 4

Classes of TAG UNIVERSAL APPLICATION CONTEXT-SPECIFIC PRIVATE Built-in types, application independent types See Table B.2 APPLICATION Application specific types CONTEXT-SPECIFIC limited to a context within an application PRIVATE defined by users and not covered by any standard 4

ASN.1 Simple Types INTEGER OCTET STRING OBJECT IDENTIFIER (OID) NULL the positive and negative whole numbers, including zero OCTET STRING a sequence of zero or more octets (8-bit bytes) OBJECT IDENTIFIER (OID) the set of values associated with information objects allocated by the standard NULL the single value NULL Other ASN.1 simple types include boolean, bit string, real, enumerated, PrintableString, etc. 4

ASN.1 Structured Types SET SET OF SEQUENCE SEQUENCE OF CHOICE a collection of one or more types SET OF a collection of zero or more occurrences of a given type SEQUENCE an ordered collection of one or more types SEQUENCE OF an ordered collection of zero or more occurrences of a given type CHOICE a list of alternatives 4

Informal Description of Personnel Record ASN.1 Example Informal Description of Personnel Record Name: James W Hong Title: Associate Professor Employee Number: 20292 Date of Hire: May 26, 1995 Name of Spouse: In-Young B Hong Number of Children: 2 Child Information Name: Suk D Hong Date of Birth: 29 March 1988 Name: Myungdo M Hong Date of Birth: 10 August 1994 4

ASN.1 Description of the Record Structure PersonalRecord ::= [APPLICATION 0] IMPLICIT SET { Name, title [0] VisibleString, number EmployeeNo, dateOfHire [1] Date, nameOfSpouse [2] Name, children [3] IMPLICIT SEQUENCE OF ChildInfo DEFAULT {} } ChildInfo ::= SET { dateOfBirth [0] Date} Name ::= [APPLICATION 1] IMPLICIT SEQUENCE { givenName VisibleString, initial VisibleString, familyName VisibleString} EmployeeNo ::= [APPLICATION 2] IMPLICIT INTEGER Date ::= [APPLICATION 3] IMPLICIT VisibleString 4

ASN.1 Description of a Record Value { {givenName “James”, initial “W”, familyName “Hong”}, title “Associate Professor” number 20292 dateOfHire “19950526” nameOfSpouse {givenName “In-Young”, initial “B”, familyName “Hong”}, children { { {givenName “Suk”, initial “D”, dateOfBirth “19880329”}, { {givenName “Myungdo”, initial “M”, dateOfBirth “19940810”} } 4

ASN.1 Macro Definitions ASN.1 macro notation can be used to extend the syntax of ASN.1 to define new types and values a macro definition is expressed in the macro notation and used to define a set of macro instances a macro instance is generated from a macro definition by substituting values for variables the macro is used to extend the ASN.1 syntax but does not extend the encoding 4

Macro Definition Format <macroname> MACRO ::= BEGIN TYPE NOTATION ::= <new-type-syntax> VALUE NOTATION ::= <new-value-syntax> <supporting-productions> END 4

Macro Definition Example OBJECT-TYPE MACRO ::= BEGIN TYPE NOTATION ::= “SYNTAX” type (TYPE ObjectSyntax) “ACCESS” Access “STATUS” Status VALUE NOTATION ::= value (VALUE ObjectName) Access ::= “read-only” | “read-write” | “write-only” | “not-accessible” Status ::= “mandatory” | “optional” | “obsolete” END 4

Fields of a BER encoded ASN.1 value Overview of BER BER – Basic Encoding Rules an encoding specification CCITT (X.209) and ISO (ISO 8825) standard describes a method for encoding values of each ASN.1 type as a string of octets based on the use of a type-length-value (TLV) structure Type Length Value Fields of a BER encoded ASN.1 value 4

Not used in the SNMP protocol BER Type Field Class BIT 8 7 6 5 4 3 2 1 Constructed Most significant Least significant Tag number CLASS Bit 8 Bit 7 Description Universal Built-in types Application 1 SNMP defined types Context-Specific 1 Used in context Private 1 1 Not used in the SNMP protocol 4

Tag Values for SNMP Types SNMPv1 protocol SNMPv2 protocol Tag Number Tag Value Type ASN.1 Tag INTEGER/Integer32 UNIVERSAL 2 0x02 0x02 OCTET STRING UNIVERSAL 4 0x04 0x04 NULL UNIVERSAL 5 0x05 0x05 OBJECT IDENTIFIER UNIVERSAL 6 0x06 0x06 SEQUENCE UNIVERSAL 16 0x10 0x30 IpAddress APPLICATION 0 0x00 0x40 Counter/Counter32 APPLICATION 1 0x01 0x41 Gauge/Gauge32 APPLICATION 2 0x02 0x42 TimeTicks APPLICATION 3 0x03 0x43 Opaque APPLICATION 4 0x04 0x44 Counter64 APPLICATION 6 0x06 0x46 4

Encoding Methods The TLV structure is recursive – for any ASN.1 value that consists of one or more components, the “value” portion of its TLV encoding itself consists of one or more TLV structures Three methods for encoding an ASN.1 value: Primitive, definite-length encoding Constructed, definite-length encoding Constructed, indefinite-length encoding The method chosen depends on the ASN.1 type of the value to be encoded and whether or not the length of the value is known based on the type (see Table B.4) 4

Short(0)/Long(1) form indicator BER Length Field two forms of length field exist: short form: specified in a single octet long form: specified in multiple octets Value = 102 1 Short(0)/Long(1) form indicator Value 1 1 1 1 1 1 = 7559605 Short/Long form indicator Length of length Length value 4

BER Examples - Integers 1 Tag Universal 2 Length 1 Value 0 What value was encoded? 1 Tag Universal 2 Length 2 Value (1 of 2) Value (2 of 2) What value was encoded? 4

BER Example - Octet String 1 Tag Universal 4 Length 4 1st octet 2nd octet 3rd octet 4th octet Overall Length = 6 Value of Octet String encoded is ‘EB069937’ 4

BER Example - SEQUENCE Message ::= SEQUENCE { version INTEGER { version-1(0) }, community OCTET STRING } Given the above definition, what is the BER encoding of sampleMessage ::= { 0, ‘EB069937’h } ? 4

... and its BER encoding is 1 Value (6 of 9) OCTET STRING 1 Value (6 of 9) OCTET STRING Value (7 of 9) OCTET STRING Value (8 of 9) OCTET STRING Value (1 of 9) integer Value (2 of 9) integer Value (3 of 9) integer Tag universal 16 Length 9 Value (4 of 9) OCTET STRING Value (5 of 9) OCTET STRING Value (9 of 9) OCTET STRING 4

Summary We have covered a subset of ASN.1 and BER which are used in SNMP and OSI Management Frameworks ASN.1 is widely used in defining application data and protocol data units BER is widely used in defining transfer syntaxes READ: Stallings, SNMP, SNMPv2, SNMPv3 and RMON 1 and 2, 3rd Edition, Addison-Wesley, Appendix B 4