ASN.1 & BER

Содержание

Слайд 2

ASN.1 Purpose of ASN.1 One of the fundamental problems confronting users

ASN.1

Purpose of ASN.1
One of the fundamental problems confronting users communicating with

different systems is the efficient transfer of data in such a way that the data received is the same data transmitted. In the OSI model, the representation of data types and structures to facilitate this transfer is a function of the Application Layer; the encoding of the data into a specific sequence of bits for transfer isattributed to the Presentation Layer.
Слайд 3

The fundamental unit of ASN.1 is the module. The sole purpose

The fundamental unit of ASN.1 is the module. The sole purpose

of a module is to name a collection of type definitions and/or value definitions (assignments) that constitute a data specification.

ASN.1

Слайд 4

A type definition is used to define and name a new

A type definition is used to define and name a new

type by means of a type assignment and a value definition is used to define and name a specific value, when it is necessary, by means of a value assignment.

ASN.1

Слайд 5

A type assignment consists of a type reference (the name of

A type assignment consists of a type reference (the name of

the type), the character sequence ::= (‘‘is defined as’’), and the appropriate type.

ASN.1 - Type Assignment

Слайд 6

InventoryList {1 2 0 0 6 1} DEFINITIONS ::= BEGIN {

InventoryList {1 2 0 0 6 1} DEFINITIONS ::=
BEGIN
{
ItemId ::= SEQUENCE
{
partnumber

IA5String,
quantity INTEGER,
wholesaleprice REAL,
saleprice REAL
}
StoreLocation ::= ENUMERATED
{
Baltimore (0),
Philadelphia (1),
Washington (2)
}
}
END

ASN.1 – Type Assignment example

Слайд 7

A value assignment consists of a value reference (the name of

A value assignment consists of a value reference (the name of

the value), the type of the value, ::= (``is assigned the value''), and a valid value notation. A value reference must begin with a lower case letter, but otherwise has the same syntax as a type assignment.

ASN.1 - Value assignment

Слайд 8

gadget ItemId ::= { partnumber "7685B2", quantity 73, wholesaleprice 13.50, saleprice

gadget ItemId ::=
{
partnumber "7685B2",
quantity 73,
wholesaleprice 13.50,
saleprice 24.95
}

ASN.1 - Value assignment example

{
ItemId ::=

SEQUENCE
{ partnumber IA5String,
quantity INTEGER,
wholesaleprice REAL, saleprice REAL
}
Слайд 9

ASN.1 – Simple Types

ASN.1 – Simple Types

Слайд 10

ASN.1 – Character String Type

ASN.1 – Character String Type

Слайд 11

ASN.1 – Structured types

ASN.1 – Structured types

Слайд 12

{ "American", "1106", { 320, 107, 213 }, { "BWI", "LAX"

{
"American", "1106", { 320, 107, 213 }, { "BWI", "LAX" },

10
}
AirlineFlight ::= SEQUENCE
{
airline IA5String,
flight NumericString,
seats SEQUENCE
{
maximum INTEGER,
occupied INTEGER,
vacant INTEGER
},
airport SEQUENCE
{
origin IA5String,
stop1 [0] IA5String OPTIONAL,
stop2 [1] IA5String OPTIONAL,
destination IA5String
},
crewsize ENUMERATED
{
six (6),
eight (8),
ten (10)
},
cancel BOOLEAN DEFAULT FALSE
}

ASN.1 – Structured types example

Слайд 13

Type TAGGED is used to enable the receiving system to correctly

Type TAGGED is used to enable the receiving system to correctly

decode values from several datatypes that a protocol determines may be transmitted at any given time. TAGGED has no value notation of its own. Its type notation consists of three elements: a user-defined tag, possibly followed by IMPLICIT or EXPLICIT, followed by the value notation of the type being tagged.

ASN.1 – Tagged

Слайд 14

The user-defined tag consists of a class and class number contained

The user-defined tag consists of a class and class number contained

in braces. Class is
UNIVERSAL, APPLICATION, PRIVATE, CONTEXT-SPECIFIC.
The UNIVERSAL class is restricted to the ASN.1 built-in types. It defines an application-independent data type that must be distinguishable from all other data types. The other three classes are user defined.
The APPLICATION class distinguishes data types that have a wide, scattered use within a particular presentation context.
PRIVATE distinguishes data types within a particular organization or country.
CONTEXT-SPECIFIC distinguishes members of a sequence or set, the alternatives of a CHOICE, or universally tagged set members.
Only the class number appears in braces for this data type; the term COONTEXT-SPECIFIC does not appear.

ASN.1 – Tagged

Слайд 15

ASN.1 – Tagged

ASN.1 – Tagged

Слайд 16

As we indicated in the above discussion of type SET, the

As we indicated in the above discussion of type SET, the

representation in a) is invalid in ASN.1 because its instances can be ambiguous.
The tagging in representations b), c), and d) overcome the problem and allow instances to be transmitted uniquely.
IMPLICIT in c) indicates that an original tag is replaced by any of the three user-defined tags.
EXPLICIT tagging would be appropriate when strong-type-checking is more important than compact representation; it can be used when the original tag is accompanied by a user-defined tag.
The context-specific tagging in d) is similar to the APPLICATION class tagging in b) except that the class of the tag is not specifically transmitted.

ASN.1 – Tagged

Слайд 17

ASN.1 – Listing of Universal Tags

ASN.1 – Listing of Universal Tags

Слайд 18

ASN.1 – Listing of Universal Tags

ASN.1 – Listing of Universal Tags

Слайд 19

ASN.1 – Listing of Universal Tags

ASN.1 – Listing of Universal Tags

Слайд 20

Abstract Syntax und Transfer Syntax

Abstract Syntax und Transfer Syntax

Слайд 21

Задача Дефиниране на типове данни за следния обект: LAN – мрежова

Задача

Дефиниране на типове данни за следния обект:
LAN – мрежова карта:
Индекс :

0
Производител : 3Com
Получени пакети: 521
Изпратени пакети: 130
Слайд 22

Type assignments

Type assignments

Слайд 23

Value assignments LAN – Network Card Interface

Value assignments

LAN – Network Card Interface

Слайд 24

BER - кодиране End - LABEL Next Byte gives Tag Type

BER - кодиране

End - LABEL

Next Byte gives Tag

Type Datatype Tag Number
00:

Universal 0: simple 0 .. 30
01: Application 1: structured 31: next Byte gives Tag Number
10: Context Specific
11: Private
Слайд 25

BER - кодиране 81 80 62 02 A1 16 02 A0 60

BER - кодиране

81

80

62

02

A1

16

02

A0

60

Слайд 26

BER - кодиране LAN – Network Card Interface

BER - кодиране

LAN – Network Card Interface