Presentation is loading. Please wait.

Presentation is loading. Please wait.

ASN.1 소개 건아정보기술 SW개발팀 김강민 주임연구원.

Similar presentations


Presentation on theme: "ASN.1 소개 건아정보기술 SW개발팀 김강민 주임연구원."— Presentation transcript:

1 ASN.1 소개 건아정보기술 SW개발팀 김강민 주임연구원

2 목 차 개요 ASN.1 필요성 관련 규범 ASN.1 문법 Basic Encoding Rule(BER) Q&A

3 개 요 ASN.1은 Abstract Syntax Notation One의 약자입니다.
국제전기통신 연합(ITU)에서 네트워크 데이터 교환을 정의한 프로토콜로 X.680 ~ X.699에서 정의하고 있습니다. ASN : Abstract Syntax Notation one. (추상적인 문법 표기 1) ITU : international Telecommunication Union

4 ASN.1 필요성 Sun과 Windows간 데이터 전송에는 Little endian, Big endian 차이로 인해 데이터 변환이 필요합니다. 1:1이 아니라 N개의 시스템간 통신을 위해서는 이론상 시스템 하나에 N-1개의 데이터 변환기가 필요합니다. 이 부분의 낭비를 줄이기 위해 ASN.1이란 표준을 사용합니다. ASN.1

5 관련 규범(1/2) ISO : Intelligent transport systems (ITS) — Data exchange involving roadside modules communication ISO General principles and documentation framework of application profiles ISO  Application profile-data exchange (AP-DATEX) KS X ISO : 교통 정보 및 제어 시스템-ITS를 위한 센터간 데이터 인터페이스 KS X ISO 메시지 정의 요구사항. KS X ISO DATEX-ASN KS X ISO : ISO 문서를 번역해서 기술적 내용 및 규격서의 서식을 변경하지 않고 작성한 한국산업규격이다.

6 관련 규범 (2/2) ※ ITU 참고사항 (2009년 1월) :
ITU-T ASN.1 Standards Projects Abstract Syntax Notation One X.680 – Basic Notation X.681 – Information Objects X.682 – General Constraint Notation X.683 – Parameterization X.690 – Basic (BER), Cannoical(CER), and Distinguished (DER) Encoding Rules X.691 – Packed Encoding Rules (PER) Latest X.692 – Encoding Control Notation (ECN) X.693 – XML Encoding Rules (XER)

7 ASN.1 문법 (1/10) 예제

8 ASN.1 문법 (2/10) Module Built-in Types Tagged Type assignment
Value assignment Built-in Types Simple Type Structured Type Tagged

9 ASN.1 문법 (3/10) Module (x.680 - 3.6.43) Module definition
One or more instances of the use of the ASN.1 notation for type, value, value set, information object class, information object, and information object set (as well as the parameterized variant of those), encapsulated using the ASN.1 module notation Module definition

10 Assignment lexical Item
ASN.1 문법 (4/10) 모듈 분석 Assignment lexical Item Object Identifier (X.660) Module definition Format Type Assignment Module Body Comment (one line)

11 ASN.1 문법 (5/10) Assignment Type Example
InventoryList { } DEFINITIONS ::= BEGIN { ItemId ::= SEQUENCE partnumber IA5String, quantity INTEGER, wholesaleprice REAL, saleprice REAL } StoreLocation ::= ENUMERATED Baltimore (0), Philadelphia (1), Washington (2) } END

12 ASN.1 문법 (6/10) Assignment Value Example gadget ItemId ::= {
partnumber "7685B2", quantity 73, wholesaleprice , saleprice }

13 ASN.1 문법 (7/10) Built-in Type Simple type Simple Type Tag Typical use
BOOLEAN 1 Model logical, two-state variable values INTEGER 2 Model integer variable values BIT STRING 3 Model binary data of arbitrary length OCTET STRING 4 Model binary data whose length is a multiple of eight NULL 5 Indicate effective absence of a sequence element OBJECT IDENTIFIER 6 Name information objects REAL 9 Model real variable values ENUMERATE 10 Model values of variables with at least three states CHARACTER STRING * Models values that are strings of characters from a specified characterset Character Sting Type Tag Typical use NumericString 18 0,1,2,3,4,5,6,7,8,9, and space PrintableString 19 Upper and lower case letters, digits, space, apostrophe, left/right parenthesis, plus sign, comma, hyphen, full stop, solidus, colon, equal sign, question mark TeletexString (T61String) 20 The Teletex character set in CCITT's T61, space, and delete VideotexString 21 The Videotex character set in CCITT's T.100 and T.101, space, and delete VisibleString (ISO646String) 26 Printing character sets of international ASCII, and space IA5String 22 International Alphabet 5 (International ASCII) GraphicString 25 All registered G sets, and space 27 All registered C and G sets, space and delete

14 ASN.1 문법 (8/10) Built-in Type Structured type Structured Type Tag
Typical Use SEQUENCE 16 Models an ordered collection of variables of different type SEQUENCE OF Models an ordered collection of variables of the same type SET 17 Model an unordered collection of variables of different types SET OF Model an unordered collection of variables of the same type CHOICE * Specify a collection of distinct types from which to choose one type SELECTION Select a component type from a specified CHOICE type ANY Enable an application to specify the type Note: ANY is a deprecated ASN.1 Structured Type. It has been replaced with X.680 Open Type.

15 ASN.1 문법 (9/10) Tagged Example a) seats SET {
maximum [APPLICATION 0] INTEGER, occupied [APPLICATION 1] INTEGER, vacant [APPLICATION 2] INTEGER } b) seats SET maximum [APPLICATION 0] IMPLICIT INTEGER, occupied [APPLICATION 1] IMPLICIT INTEGER, vacant [APPLICATION 2] IMPLICIT INTEGER c) seats SET maximum [0] INTEGER, occupied [1] INTEGER, vacant [2] INTEGER 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.

16 ASN.1 문법 (10/10) Lexical Items Comment Range separator : “..”
a "comment" begins with a pair of adjacent hyphens, it shall end with the next pair of adjacent hyphens or at the end of the line. Ex) // comment one line a "comment" begins with "/*", it shall end with a corresponding "*/", whether this "*/" is on the same line or not. Ex) /* comment with several lines */ Range separator : “..” Assignment lexical item : “::=“ bstring : 0,1로 구성되며 끝에 ‘B를 붙인다. Ex) ‘ ’B hstring : 0,1,2..F로 구성되며 끝에 ‘H를 붙인다. Ex) ‘AB019’H

17 Basic Encoding Rule(BER) (1/5)
The encoding of a data value shall consist of four components which shall appear in the following order a) identifier octets b) length octets c) contents octets d) end-of-contents octets

18 Basic Encoding Rule(BER) (2/5)
Structure of an encoding end-of-contents은 반드시 존재해야 하는 것은 아니다. Identifier octets Length octets Contents octets End-of-contents octets

19 Basic Encoding Rule(BER) (3/5)
Identifier Octet Length Octet Short length the length octets shall consist of a single octet in which bit 8 is zero and bits 7 to 1 encode the number of octets in the contents octets (which may be zero), as an unsigned binary integer with bit 7 as the most significant bit. L = 38 can be encoded as Long length a) bit 8 shall be one; b) bits 7 to 1 shall encode the number of subsequent octets in the length octets, as an unsigned binary integer with bit 7 as the most significant bit c) the value shall not be used. L = 201 can be encoded as:

20 Basic Encoding Rule(BER) (4/5)
Contents octets The contents octets shall consist of zero, one or more octets, and shall encode the data value as specified End-of-contents octets The end-of-contents octets shall be present if the length is encoded as specified

21 Basic Encoding Rule(BER) (5/5)
예제 SEQUENCE의 L 부분은 element 인 First와 Second의 길이를 모두 나타낸다. Seq ::= SEQUENCE { first INTEGER, second INTEGER } seqVa1 Seq ::= { 10, 20 } Tag Length Value SEQUENCE V의 길이* INTEGER V의 길이 10 20

22 Q & A


Download ppt "ASN.1 소개 건아정보기술 SW개발팀 김강민 주임연구원."

Similar presentations


Ads by Google