PKI/ASN.1

ASN.1 Advanced

JayKim🙂 2022. 11. 3. 14:17

* Information Objects

PRODUCT ::= CLASS {
&code        INTEGER (1..99999) UNIQUE,
&description VisibleString (SIZE (1..100)),
&price       REAL
} WITH SYNTAX { CODE &code , DESCRIPTION &description , PRICE &price}

ProductCatalog PRODUCT ::= {
{CODE 101, DESCRIPTION "iPhone v4", PRICE 250.00} |
{CODE 102, DESCRIPTION "Android Galaxy", PRICE 250.00} |
{CODE 103, DESCRIPTION "Win7 Nokia", PRICE 150.00}
}

Item ::= SEQUENCE {
itemCode        PRODUCT.&code ({ProductCatalog}),
itemDescription PRODUCT.&description ({ProductCatalog}{@itemCode}),
quantity        INTEGER (1..1000),
unitPrice       PRODUCT.&price ({ProductCatalog}{@itemCode}),
itemTotal       REAL,
isTaxable       BOOLEAN
}

 

* Open Types

PRODUCT ::= CLASS {
&code        INTEGER (1..99999) UNIQUE,
&description VisibleString (SIZE (1..100)),
&price       REAL,
--OpenType-- &Feature    
} WITH SYNTAX { CODE &code , DESCRIPTION &description , PRICE &price , FEATURE &Feature }

ProductCatalog PRODUCT ::= {
{CODE 101, DESCRIPTION "iPhone", PRICE 250.00, FEATURE Generation } |
{CODE 102, DESCRIPTION "Android Galaxy", PRICE 250.00, FEATURE Generation } |
{CODE 103, DESCRIPTION "Win7 Nokia", PRICE 150.00, FEATURE Generation } |
{CODE 104, DESCRIPTION "Bookshelf", PRICE 100.00, FEATURE Weight} |
{CODE 105, DESCRIPTION "Glass Egg", PRICE 2000.00, FEATURE NULL}
}

Generation ::= ENUMERATED {two-G, three-G, four-G}
Weight ::= INTEGER

Item ::= SEQUENCE {
itemCode        PRODUCT.&code ({ProductCatalog }),
itemDescription PRODUCT.&description({ProductCatalog}{@itemCode}),
feature         PRODUCT.&Feature ({ProductCatalog}{@itemCode}),
quantity        INTEGER (1..1000),
unitPrice       PRODUCT.&price ({ProductCatalog}{@itemCode}),
itemTotal       REAL,
isTaxable       BOOLEAN
}

 

* Versioning / Extensibility - Foward and Backward Compatibility

CustomerInfo ::= SEQUENCE {
companyName        VisibleString (SIZE (3..50)),
billingAddress     Address,
contactPhoneNumber NumericString (SIZE (7..12)),
...
}

CustomerInfo ::= SEQUENCE {
companyName        VisibleString (SIZE (3..50)),
billingAddress     Address,
contactPhoneNumber NumericString (SIZE (7..12)),
...,
shippingAddress    Address
}

CustomerInfo ::= SEQUENCE {
companyName        VisibleString (SIZE (3..50)),
billingAddress     Address,
contactPhoneNumber NumericString (SIZE (7..12)),
...,
shippingAddress    Address,
additionalInfo     VisibleString (SIZE (1..128))
}

 

* Parameterization

Invoke-message {INTEGER:normal-priority, Parameter} ::= SEQUENCE {
      component1 INTEGER DEFAULT normal-priority,
      component2 Parameter }

Messages ::= CHOICE {
      first Invoke-message { low-priority, Type1 },
      second Invoke-message { high-priority, Type2 },
      ... }
Messages ::= CHOICE { -- This is what the above expands to
      first SEQUENCE {
        component1 INTEGER DEFAULT low-priority,
        component2 Type1 },
      second SEQUENCE {
        component1 INTEGER DEFAULT high-priority,
        component2 Type2 },
      ... }

 

반응형

'PKI > ASN.1' 카테고리의 다른 글

Basic Encoding Rules (1/3)  (0) 2022.11.07
ASN.1 참고 사이트  (0) 2022.11.03
ASN.1 Value Notation (2/2)  (0) 2022.11.03
ASN.1 Value Notation (1/2)  (0) 2022.11.03
ASN.1 Constraints  (0) 2022.11.03