* Adding and Overriding Tags
- Universal Tag가 디폴트
ex) IQ ::= INTEGER -- 'Universal 2' 의 tag를 가짐
- EXPLICIT : 기본 Type 의 Tag에 새로운 Tag 추가
ex) IQ ::= [21] EXPLICIT INTEGER -- EXPLICIT 는 생략 가능
- IMPLICIT : 기본 Type 의 tag가 새로운 tag로 대체
IQ는 'Context-specific 21'의 tag 로 대체 됨
ex) IQ ::= [21] IMPLICIT INTEGER
- Tag 예제
BinaryFile ::= [APPLICATION 13] OCTET STRING
IDNumber1 ::= [PRIVATE 1] INTEGER
Present ::= [21] BOOLEAN
-- CLASS가 명시되지 않으면 Context-specific
IDNumber2 ::= [PRIVATE 1] IMPLICIT INTEGER
PersonnelRecord ::= SEQUENCE {
name [0] OCTET STRING,
location [1] INTEGER { homeOffice (0),
fieldOffice (1),
roving (2) },
-- Named Number List
age [2] INTEGER OPTIONAL }
* Explicit vs. Implicit Tags and the Tag Default
MyModule DEFINITIONS ::= BEGIN
Tags without IMPLICIT or EXPLICIT are treated as if EXPLICIT were specified.
MyModule DEFINITIONS EXPLICIT TAGS ::= BEGIN
Tags without IMPLICIT or EXPLICIT are treated as if EXPLICIT were specified.
MyModule DEFINITIONS IMPLICIT TAGS ::= BEGIN
Tags without IMPLICIT or EXPLICIT are treated as if IMPLICIT were specified, except in a few special cases where EXPLICIT is required.
MyModule DEFINITIONS AUTOMATIC TAGS ::= BEGIN
Tags without IMPLICIT or EXPLICIT are treated as if IMPLICIT were specified, except in a few special cases where EXPLICIT is required.
Components of SEQUENCE, SET and CHOICE are automatically assigned tags that satisfy tag requirements imposed on those types,
as if they were written with IMPLICIT except when EXPLICIT is required.
* 다른 Module의 Type 이용
- 다른 Module에서 정의된 데이터 type 이용 가능
- Simple Way
Common DEFINITIONS ::= BEGIN
Timestamp ::= [0] GeneralizedTime
Initiator ::= OCTET STRING
END
Application1 DEFINITIONS ::= BEGIN
InvokedID ::= [0] INTEGER
InvokedPDU ::= SEQUENCE {
invokeTime Common.Timestamp,
initiator Common.Initiator }
- IMPORTS, EXPORTS 이용
Common {iso(1) identified-organization(3) 9999 common(1234)}
DEFINITIONS ::= BEGIN
EXPORTS Timestamp, Initiator;
IMPORTS ;
Timestamp ::= [0] GeneralizedTime
Initiator ::= OCTET STRING
END
Foo DEFINITIONS ::= BEGIN
IMPORTS Timestamp FROM Common;
X ::= INTEGER
END
참고 ) 특별히 EXPORTS 가 없으면 EXPORTS ALL 을 옵션으로 처리 된다.
'PKI > ASN.1' 카테고리의 다른 글
ASN.1 Value Notation (1/2) (0) | 2022.11.03 |
---|---|
ASN.1 Constraints (0) | 2022.11.03 |
ASN.1 Type Notation (2/3) (0) | 2022.11.02 |
ASN.1 Type Notation (1/3) (0) | 2022.11.02 |
RFC3280-PKIX1Implicit88 ASN.1 (0) | 2022.11.02 |