PKI/ASN.1

ASN.1 ๊ธฐ๋ณธ ๊ตฌ์กฐ

JayKim๐Ÿ™‚ 2022. 11. 2. 10:33

ASN.1 ์€ ํ…์ŠคํŠธ๋กœ ๋œ Syntax ์ด๋‹ค. ์ฆ‰ ์–ธ์–ด ํ‘œํ˜„์ด๋‹ค.
์ด ASN.1 ๋ฐ์ดํƒ€๋ฅผ ์ž‘์„ฑ ํ•˜๊ธฐ ์œ„ํ•œ ๊ธฐ๋ณธ ๊ทœ์น™์„ ์„ค๋ช… ํ•œ๋‹ค.

ASN.1 ๋ฌธ์ž ์…‹

  • A-Z, a-z, 0-9
  • : = , { } < . @ ( ) [ ] – ‘ “ | & ^ * ; ! >

ํŠน์ง•

  • ๋Œ€์†Œ๋ฌธ์ž ๊ตฌ๋ณ„
  • ๋ ˆ์ด์•„์›ƒ์€ ์ž์œ  ํฌ๋งท์ด๋ฉฐ ๊ฐœํ–‰๋ฌธ์ž (End Of Line) ์€ ํ•˜๋‚˜์˜ ๊ณต๋ฐฑ ๋ฌธ์ž๋กœ ์ธ์‹ํ•จ
  • ์ฃผ์„์˜ ๊ฒฝ์šฐ "--"๋กœ ์‹œ์ž‘ ํ•ด์„œ "--"๋กœ ๋๋‚จ ๋˜๋Š” ๊ฐœํ–‰ ๋ฌธ์ž๋กœ ๋๋‚จ

์˜ˆ์•ฝ์–ด

  • BOOLEAN, CHARACTER, FALSE, IA5String, INTEGER, NULL, OCTET, etc
  • SET, SEQUENCE, CHOICE and etc
  • BEGINE, END, OPTIONAL, COMPONENTS, UNION, WITH etc
  • ๋Œ€๋žต ๋‹ค๋ฅธ ์˜ˆ์•ฝ์–ด๋ฅผ ํฌํ•จํ•ด 80๊ฐœ ์ •๋„ ์žˆ์Œ

ASN.1 ์—๋Š” ํฌ๊ฒŒ Modules ์„ ์ •์˜ ํ•˜๊ณ  ๊ทธ Modules ๋‚ด์—๋Š” Type ๊ณผ Value ์— ๋Œ€ํ•œ ๊ฐ’์„ ํ‘œํ˜„ํ•œ๋‹ค.

Modules

  • ASN.1 ์˜ ๊ธฐ๋ณธ ๋‹จ์œ„
  • ๋ฐ์ดํƒ€๋ฅผ ๊ตฌ์„ฑํ•˜๋Š” type & value ์ •์˜์˜ ์ง‘ํ•ฉ์„ ๊ตฌ์„ฑ ํ•˜๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉ
  • ‘BEGIN’๊ณผ ‘END’๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์ •์˜
    DEFINITIONS ::= BEGIN
    <module body .....>
    END
    - ๋ชจ๋“ˆ ๋‹ค์Œ์— OID ๊ฐ’์„ ์‚ฌ์šฉํ•˜๋Š”๋ฐ ์ด ๋ถ€๋ถ„์€ ์˜ต์…˜ ๊ฐ’์ด๋‹ค.
    - DEFINITIONS ๋‹ค์Œ์— Tag Default ์ •์˜๊ฐ€ ๋˜๋Š”๋ฐ ์˜ต์…˜์ด๋‹ค.
    - Tag Default ๊ฐ’์ด ์—†์œผ๋ฉด TAG EXPLICIT ๋กœ ์ž๋™ ์ •์˜ ๋œ๋‹ค.
    - ์—๋Š” Type Notation ๊ณผ Value Notation ์ •๋ณด๊ฐ€ ๋“ค์–ด๊ฐ„๋‹ค.
    - DEFAULT ๋Š” ๊ฐ’์ด ์ง€์ • ์—†์„ ์‹œ ์ž๋™ ์„ค์ • ๊ฐ’
    - OPTIONAL ์€ ๊ฐ’์ด ์„ค์ •์ด ์•ˆ๋˜์–ด๋„ ๋จ

์˜ˆ์ œ

SimpleModule {1 2 0 0 6 1} DEFINITIONS AUTOMATIC TAGS ::=
BEGIN
Rocket ::= SEQUENCE
{
name UTF8String (SIZE(1..16)),
message UTF8String DEFAULT "Hello World" ,
fuel ENUMERATED {solid, liquid, gas, hybrid},
speed CHOICE
{
mph INTEGER,
kmph INTEGER
} OPTIONAL,
payload SEQUENCE OF UTF8String
}
END

๋ฐ˜์‘ํ˜•

'PKI > ASN.1' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

ASN.1 Type Notation (1/3)  (0) 2022.11.02
RFC3280-PKIX1Implicit88 ASN.1  (0) 2022.11.02
RFC3280-PKIX1Explicit88 ASN.1  (0) 2022.11.02
ASN.1 ์ด์šฉํ•œ ๊ฐœ๋ฐœ ํ๋ฆ„  (0) 2022.11.02
ASN.1 ์ด๋ž€?  (0) 2022.11.02