ç§ã¯ãASN.1ãç°¡åãªèšèã§ããšããèšäºãå
¬éãç¶ããŠããŸãã Habréã«æçš¿ãããèšäºã®åã®éšåã¯ãããã§èŠã€ããããšãã§ããŸãïŒ
åçŽãªåèªïŒã¿ã€ãREALã®ãšã³ã³ãŒãïŒã® ASN.1ããã³
åçŽãªåèªïŒããŒã2ïŒã®ASN.1 ã
第7ç« ãããã®ãšã³ã³ãŒãã·ãŒã±ã³ã¹ïŒãããæååïŒ
ãããæååããšã³ã³ãŒãããåã®ã«ããŽãªã§ã¯ãBIT STRINGãšOCTET STRINGã®2ã€ã®åãå±æ§ä»ãããŸãã
BIT STRINGã¿ã€ãã¯ãæ
å ±ã®æå°ãããã¯ïŒãããïŒã®ã·ãŒã±ã³ã¹ãæ ŒçŽããããã®ãã®ã§ãã å®éããšã³ã³ãŒãã¯è¡ãããŸããããšã³ã³ãŒããããå€ã®ãããã¯ãããšã³ã³ãŒããããå€ã®å€ãããã¯ã«é
眮ãããŸãã 1ã€ã®äŸå€ãé€ããæªäœ¿çšãããã®æ°ã¯ããšã³ã³ãŒããããå€ã®æåã®ãªã¯ãããã«æ ŒçŽãããŸãã æªäœ¿çšãããæ°ã®å€ã¯ã0ã7ã®ç¯å²ã§å€æŽã§ããŸããæªäœ¿çšãããã¯ããããåã®å³ç«¯ã«ãããŸãã ã€ãŸããããã0000 1111 = 0Fã®ã·ãŒã±ã³ã¹ããšã³ã³ãŒããããæªäœ¿çšãããã®æ°ã4ã§ããå Žåããã®ãããæååããã³ãŒããããšãã¯0000ãšããŠåŠçããå¿
èŠããããŸãã
BIT STRINGåããšã³ã³ãŒãããå Žåãåºæ¬çãªãšã³ã³ãŒãæ¹åŒãšå»ºèšçãªæ¹åŒã®äž¡æ¹ã䜿çšã§ããŸãã ãããæååãæ§ç¯ãã建èšçãªæ¹æ³ã䜿çšãããšã1ã€ã®ãããæååãè«ççã«è€æ°ã®å°ããªæååã«ç°¡åã«åå²ã§ããŸãã 建èšçãªæ¹æ³ã§ãšã³ã³ãŒãããããã®ãããªãããæååããã³ãŒãããå Žåããã¹ãŠã®ãã¹ãããããããæååã®å€ã¯ã1ã€ã®å€§ããªãããæååã«çµåãããŸãã å€ãããã¯ã§ãããæååãæå®ãã建èšçãªæ¹æ³ã䜿çšããå Žåããããæååã®ã¿ããšã³ã³ãŒãããå¿
èŠããããæåŸãé€ããã¹ãŠã®ãããéšåæååã§ã¯ãæªäœ¿çšãããã®å€ãæã€ãªã¯ãããã¯ãŒãã§ãªããã°ãªããŸããã
ãããæååã®å»ºèšçãªã³ãŒãã£ã³ã°ã®äŸã次ã«ç€ºããŸãã åæãããæååã«å€0B 0B 0Fãå«ãŸããæªäœ¿çšãããæ°ã4ã§ãããšããŸãã次ã«ããã®æååã3ã€ã®ãã¹ãããããããéšåæååã«åå²ãã建èšçãªåœ¢åŒã§åæãããæååããšã³ã³ãŒããã次ã®ãªã¯ãããã·ãŒã±ã³ã¹ãååŸããŸãã
23 0C
03 02 00 0B
03 02 00 0B
03 02 04 0F
ããã§ãæåã®2ã€ã®ãªã¯ãããã¯ããããæååããšã³ã³ãŒããã建èšçãªåœ¢åŒã®èå¥ãªã¯ããããšã建èšçãªåœ¢åŒã®å€ã®å
šé·ã瀺ããŠããŸãïŒ12ïŒã 次ã«ãå€0Bã®ãããæååã®ãšã³ã³ãŒããæå®ãããŸãïŒæªäœ¿çšãããã®æ°ã¯ãŒãã§ãïŒïŒã 次ã«ãå€0Bã®ãããæååãåã³ãšã³ã³ãŒããããŸãïŒããã§ããæªäœ¿çšãããã®æ°ã¯ãŒãã«çãããªããã°ãªããŸããïŒã æåŸã«ãšã³ã³ãŒãããããããæååã¯0Fã§ãæªäœ¿çšãããã®æ°ã¯4ã«èšå®ãããŸãããããã£ãŠãé£ç¶ããŠãšã³ã³ãŒãããããããéšåæååãæ¥ç¶ãããšãæåã«ãšã³ã³ãŒãããããããæåå01 01 0ãååŸãããŸãïŒæåŸã®4ãããã¯äœ¿çšãããªããããF = 1111ã¯æçµå€ããåãæšãŠãããŸãïŒ ã
OCTET STRINGåã¯ãåçŽãªãã€ãã·ãŒã±ã³ã¹ïŒãªã¯ãããïŒãæ ŒçŽããããã®ãã®ã§ãã ã€ãŸãããã®ã¿ã€ãã®ä»»æã®ãã®ããšã³ã³ãŒãã§ããŸãïŒ ã€ãŸãããªãã¬ãŒãã£ã³ã°ã·ã¹ãã ãã¡ã€ã«ã®ã³ã³ãã³ãã§ããããã®ã¿ã€ãã§ãšã³ã³ãŒãã§ããŸãã OCTET STRINGåã«ãé·ããæ瀺çã«æå®ããªããïŒASN.1ã®ã³ãŒãã£ã³ã°ã®åºæ¬ã«é¢ããç« ãåç
§ïŒã䜿çšããå Žåã¯ããšã³ã³ãŒãã¹ããªãŒã ã®2ã€ã®ãŒããªã¯ãããïŒ00 00ïŒã®åºçŸãåå¥ã«ç£èŠããè¿œå ã®ãã¹ãããããµãã¹ããªã³ã°ãäœæããå¿
èŠããããŸããªã¯ãããå
¥åã¹ããªãŒã ã§ãŒããªã¯ããããåé¢ããŸãã
第8ç« ãã¬ãã£ãã¯ã¹ã¿ã€ãã®ãšã³ã³ãŒã
å€ãã®å Žåã次ãã次ãžãšãšã³ã³ãŒããããåãã¿ã€ãã®èŠçŽ ãåºå¥ããå¿
èŠããããŸãïŒããšãã°ããã¹ããããèŠçŽ ã®é åºãä»»æã§ããSETããšã³ã³ãŒãããå ŽåïŒã ãã®ãããæ°ããç¹å®ã®ã¿ã°ã䜿çšãããããã¯å
ã®èŠçŽ ã®è¿œå ã³ãŒãã£ã³ã°ã䜿çšãããŸãã ããšãã°ãREALã¿ã€ãã«ã¯UNIVERSALã¿ã°ã¯ã©ã¹ïŒ00
2 ïŒãšã¿ã°çªå·9ããããŸãã2ã€ã®é£ç¶ããREALå€ãè«ççã«åºå¥ããããã«ãè¿œå ã®ãã©ããã³ã°ãå€ãšã³ã³ãŒãã䜿çšãããŸãã ãããè¡ãã«ã¯ãUNIVERSALïŒ00
2 ïŒã¯ã©ã¹ä»¥å€ã®ã¿ã°ã¯ã©ã¹ã䜿çšããŸãã ã€ãŸããUNIVERSALïŒ00
2 ïŒãšã¯ç°ãªãç¬ç¹ã®ã¿ã°çªå·ãšã¿ã°ã¯ã©ã¹ãæã€æ°ããã¿ã€ããå°å
¥ãããã®æ°ããã¿ã€ãã®å€ãšããŠããšã³ã³ãŒããããREALã¿ã€ãã®æšæºãããã¯å
šäœããšã³ã³ãŒããããŸãïŒæ°ããã¿ã€ãã¯å¥ã®ã¿ã€ãã®ãšã³ã³ãŒããããå€ããã¹ãŠãã«ãã»ã«åãããèå¥ãªã¯ããããããã¯ããã³é·ããããã¯ãšãšãã«ïŒã
ããšãã°ãå€0.15625ã®REALã¿ã€ãã®ãšã³ã³ãŒãå€ããã©ãããããŸãïŒãã€ããªåœ¢åŒã§ãšã³ã³ãŒããããããŒã¹ã¯2ã§ããREALãšã³ã³ãŒãã®ç« ãåç
§ïŒã ãã®å€ã¯ã5ã€ã®ãªã¯ããã09 03 80 FB 05ã§å®å
šã«ãšã³ã³ãŒããããŸããå€éšã®ãã©ãããŒãã«ã¯ãPRIVATEã¿ã°ã¯ã©ã¹ïŒ11
2 ïŒã䜿çšããã¿ã°çªå·ã¯2ã«èšå®ãããŸããå±å
ãŠãããã®å€ã¯ããªããã£ãã¿ã€ãã§ã¯ãªããã³ãŒãåãããæšæºå€ã§ãREALã¿ã€ãã®å Žåãå€éšã®ãã©ãããŒãã¯å»ºèšçãªã³ãŒãã£ã³ã°åœ¢åŒã«ãªããŸãã ãããã£ãŠãREALã¿ã€ããšãã©ãããŒãã¯ããªã¯ãããE2 05 09 03 80 FB 05ã䜿çšããŠå®å
šã«ãšã³ã³ãŒããããŸãã
ãšã³ã³ãŒãæžã¿æ
å ±ã®åä¿¡è
ãšéä¿¡è
ã®éã«äºåã«åæãããæ¢ç¥ã®ASN.1ã¡ãã»ãŒãžã¹ããŒã ãååšããå Žåããã©ããã³ã°ãšã³ã³ãŒãã£ã³ã°ãã䜿çšãããšããå
éšãã©ãããå€ã®æ
å ±ãªã¯ãããã®å€ãçç¥ã§ããŸãã ãã®å Žåãããªããã£ãã¿ã€ãã¯æ¢ã«ãã©ãããŒãã®å€ãšããŠäœ¿çšããããšã³ã³ãŒããããå€ã¯C2 03 80 FB 05ãšããŠèšè¿°ã§ããŸãïŒããã§ãC2ã¯PRIVATEã¿ã°ã¯ã©ã¹ã®äœ¿çšã®è¡šç€º+ããªããã£ããšã³ã³ãŒã圢åŒã®é©çš+ã¿ã°çªå·ã¯2ã03ã¯é·ãã§ãå€ãããã¯;æ®ãã®ãªã¯ãããã¯ãæšæºREALãšã³ã³ãŒãã£ã³ã°ã®å€ãããã¯ããçŽæ¥ååŸãããå€ãããã¯ã§ãïŒã ãããã£ãŠãäºåã«åæãããASN.1ã¹ããŒã ã䜿çšãããšãã¿ã°ã¯ã©ã¹ãšã¿ã°ã¯ã©ã¹çªå·ã®äž¡æ¹ã®éžæãããå€ã䜿çšããŠãå
±éã®ASN.1ã¡ãã»ãŒãžã®éžæãããå Žæã§éžæãããã¿ã€ãããšã³ã³ãŒãã§ããŸãïŒã¢ã¯ã·ã§ã³ã®å®å
šãªèªç±ïŒïŒã
çµè«ãšããŠããæ¥é èŸã¿ã€ããã瀺ãè¡šèšæ³ã«ã€ããŠããã€ãèªããŸãã ããã€ãã®äŸãèŠãŠã¿ãŸãããã
ã¿ã€ã1 :: = [0]ããŒã«
ããã¯ãã¿ã°ã¯ã©ã¹ããã³ã³ããã¹ãåºæãïŒ10ïŒ
2ã§ãããã¿ã°çªå·ã0ã§ããã建èšçãªãšã³ã³ãŒã圢åŒãæã€Type1ã«ã€ããŠèª¬æããŠããŸãã Type1ã®å€ãããã¯ã§ã¯ãæšæºã®BOOLEANåã®å®å
šã«ãšã³ã³ãŒããããå€ãéä¿¡ãããŸãã
Type2 :: = [PRIVATE 2]æé»ã®ããŒã«å€
ããã§ã¯ãType2ã¿ã€ãã«ã€ããŠèª¬æããŸããããã«ã¯ãã¿ã°ã¯ã©ã¹ãPrivateãïŒ11ïŒ
2 ãã¿ã°çªå·2ãããã³ããªããã£ããšã³ã³ãŒãã£ã³ã°åœ¢åŒãå«ãŸããŸãã ã€ãŸããType2ã®å€ãããã¯ã§ã¯ãæšæºçã«ãšã³ã³ãŒããããBOOLEANåã®å¯Ÿå¿ããå€ãããã¯ã®ã¿ãéä¿¡ãããŸãïŒèå¥ãããã¯ãšé·ããããã¯ã¯Type2ããååŸãããŸãïŒã
ã€ãŸããASN.1ã®ããã©ã«ãã§ã¯ããã³ã³ããã¹ãåºæãïŒ10ïŒ
2ãã¿ã°ã¯ã©ã¹ãšããŠäœ¿çšããã建èšçãªã³ãŒãã£ã³ã°åœ¢åŒã䜿çšãããŸãã ã€ãŸããæåã®äŸã¯åçã®åœ¢åŒã§èšè¿°ã§ããŸãïŒãã ããASN.1ã¿ã€ããèšè¿°ãããã¡ã€ã«ã«ãã®ãããªã¬ã³ãŒããçŽæ¥å«ããããšã¯ã§ããŸããïŒã
ã¿ã€ã1 :: = [ã³ã³ããã¹ã0]æ瀺çãªããŒã«å€
ã¡ãªã¿ã«ãæ£åŒã«ã¯æšæºåã«å®å
šã«çžåœãããã®ãããšãã°BOOLEANã¯ã次ã®ããã«èšè¿°ã§ããŸãã
BOOLEAN_Eq :: = [ãŠãããŒãµã«1]æé»ã®ããŒã«
IMPLICITè¡šèšæ³ããSEQUENCEåãªã©ã®æåã®æ§æåã«é©çšããããšãå¥ã®èå³æ·±ãç¶æ³ãçºçããŸãã ãã®å Žåãæ°ããã¿ã€ãã«ã建èšçãªåœ¢åŒããããæ°ããã¿ã€ãã®å€ãããã¯ã¯ããšã³ã³ãŒããããã¿ã€ãSEQUENCEã®å€ãããã¯ããååŸãããŸãã ãããã£ãŠãIMPLICITè¡šèšã®å Žåã次ã®ã«ãŒã«ãå®çŸ©ã§ããŸãã
- æ°ããã¿ã€ãã®å€ãããã¯ã¯ãåžžã«ãšã³ã³ãŒããããã¿ã€ãã®å€ãããã¯ããååŸãããŸãã
- 建èšçãŸãã¯ããªããã£ããšã³ã³ãŒãã£ã³ã°ã®äœ¿çšã¯ããšã³ã³ãŒããããã¿ã€ãã«ãã£ãŠç°ãªããŸããæ°ããã¿ã€ãã®ãšã³ã³ãŒãã£ã³ã°ã®ã¿ã€ãã¯ããšã³ã³ãŒããããã¿ã€ãã§äœ¿çšããããšã³ã³ãŒãã£ã³ã°ã®ã¿ã€ããšåçã§ãã
ããšãã°ã次ã®è¡šèšã§ã¯ãIMPLICITã䜿çšããŠããã«ãããããããPrimTypeã¿ã€ãã¯å»ºèšçãªã¿ã€ãã«ãªããŸãã
ConstType :: = [0] REAL
PrimType :: = [PRIVATE 2]æé»çãªConstType
çµè«ãšããŠãCHONã¿ã€ãã§ã¯ãASN.1ã³ãŒãã£ã³ã°èŠåã«åŸã£ãŠãEXPLICITïŒæ§é çã³ãŒãã£ã³ã°ïŒè¡šèšæ³ãåžžã«é©çšããå¿
èŠããããšèšããŸãã
第9ç« SEQUENCEã¿ã€ãã®ãšã³ã³ãŒã
SEQUENCEã¿ã€ãã¯ãããŸããŸãªã¿ã€ãã®ãšã³ã³ãŒããããå€ã®è«ççãªã°ã«ãŒãåïŒçµåïŒã«äœ¿çšãããŸãã å®éãSEQUENCEãšããååïŒç¿»èš³ã§ã¯ãã·ãŒã±ã³ã¹ãïŒã¯ããã®ã¿ã€ãã®ã¹ã³ãŒãã瀺ããŠããŸãã ã·ãŒã±ã³ã¹å
ã®ã¿ã€ãã®ã·ãŒã±ã³ã¹ã¯äºåå®çŸ©ãããŠãããå€æŽã§ããŸããã
ãã®ã¿ã€ãã®ã³ãŒãã£ã³ã°ã¯ãæ§æçãã§ããã€ãŸãããšã³ã³ãŒããããå€ãæã€ãããã¯ã«ã¯ãåã
ã®å€ããšã³ã³ãŒãããè¿œå ã®ãµããããã¯ãå«ãŸããŸãã ãã詳现ãªèª¬æã«ã€ããŠã¯ããã®èšäºã®ç¬¬1ç« ã®è©³çŽ°ãªèª¬æãåç
§ããŠãã ããã
ã¿ã€ãSEQUENCEã®ãšã³ã³ãŒãã®äŸã 2ã€ã®æ°å€ãã·ãŒã±ã³ã¹ã§ãšã³ã³ãŒãããå¿
èŠããããšä»®å®ããŸãã1ã€ã®æŽæ°ïŒINTEGERïŒã-128ãããã³1ã€ã®æµ®åå°æ°ç¹æ°ïŒREALïŒã0.15625ïŒããŒã¹2å解ã§è¡šç€ºïŒã§ãã é¢é£ããåã®ç« ãããæŽæ°ã¯ãªã¯ãããã®ã·ãŒã±ã³ã¹ïŒ02 01 80ïŒãšããŠãšã³ã³ãŒããããæµ®åå°æ°ç¹æ°ã¯ãªã¯ãããã®ã·ãŒã±ã³ã¹ïŒ09 03 80 FB 05ïŒãšããŠãšã³ã³ãŒããããŠããããšãããããŸãã 次ã«ãããã2ã€ã®ãšã³ã³ãŒããããæ°å€ãå«ãSEQUENCEã¿ã€ãã¯ã次ã®ããã«ãšã³ã³ãŒããããŸãã
30 08 02 01 80 09 03 80 FB 05
ããã§ãæåã®ãªã¯ãããã¯èå¥ãªã¯ãããã§ãããã¿ã€ãSEQUENCEã®å€ããšã³ã³ãŒãããã建èšçãªãšã³ã³ãŒãæ¹åŒã䜿çšãããããšãéç¥ããŸãã 2çªç®ã®ãªã¯ãããã«ã¯ãã¿ã€ãSEQUENCEã®å€ããšã³ã³ãŒãããããªã¯ãããã®æ°ãæ ŒçŽãããŸãã 次ã®3ãªã¯ãããã¯ãšã³ã³ãŒããããæŽæ°å€ïŒ-128ïŒãè¡šããæåŸã®5ãªã¯ãããã¯ãšã³ã³ãŒããããæµ®åå°æ°ç¹å€ïŒ0.15625ïŒãè¡šããŸãã
第10ç« ã¿ã€ãSETã®ãšã³ã³ãŒã
SETã¿ã€ãã®ãšã³ã³ãŒãã¯ãå®éã«ã¯SEQUENCEã¿ã€ãã®ãšã³ã³ãŒããšå®å
šã«äžèŽããŠããŸãããSETã§ãšã³ã³ãŒããããã¿ã€ãã®ã·ãŒã±ã³ã¹ãå€æŽã§ããç¹ãç°ãªããŸãã ã€ãŸããããšãã°ãSEQUENCEåã«é¢ããç« ããæ°å€ãååŸããå Žåãå®éã«ã¯ãSETåã«å¯ŸããŠãããããšã³ã³ãŒãããããã®2ã€ã®å¯èœãªïŒå®å
šã«åçã®ïŒãªãã·ã§ã³ãåŸãããŸãã
ãªãã·ã§ã³1ïŒ31 08 02 01 80 09 03 80 FB 05
ãªãã·ã§ã³2ïŒ30 08 09 03 80 FB 05 02 01 80
2çªç®ã®ãªãã·ã§ã³ã¯ããšã³ã³ãŒããããæŽæ°ããšã³ã³ãŒããããæµ®åå°æ°ç¹æ°ã®åŸã«çœ®ãã ãã§ãã
SETã¿ã€ãã§ã¯ãåãã¿ã€ããæã€2ã€ïŒãŸãã¯ãã以äžïŒã®å€ããšã³ã³ãŒãã§ããŸãã ãã³ãŒããããšããå€ã¯ããã¬ãã£ãã¯ã¹ã¿ã€ããã䜿çšããŠåºå¥ãããŸãã ãããã«ã€ããŠã¯ã第8ç« ã§ãã§ã«èª¬æããŠããŸãã
第11ç« ããŒã«åã®ãšã³ã³ãŒã
BOOLEANåã¯ãTRUEïŒtrueïŒãŸãã¯FALSEïŒfalseïŒã®2ã€ã®å€ã®ã¿ããšã³ã³ãŒãã§ããŸãã å€ãFALSEã®å Žåãå€ãããã¯ã«ã¯00ã«çãããªã¯ãããã1ã€ã ãããã¯ãã§ããå€ãTRUEã®å Žåãå€ãããã¯ã«ã¯å€ããŒã以å€ã®ãªã¯ãããã1ã€ã ãããã¯ãã§ãã ã€ãŸããBOOLEANåã®æ¬¡ã®2ã€ã®TRUEãšã³ã³ãŒããªãã·ã§ã³ã¯åçã§ãã
ãªãã·ã§ã³1ïŒ01 01 01
ãªãã·ã§ã³2ïŒ01 01 FF
第12ç« NULLãšã³ã³ãŒãã£ã³ã°
NULLå€ã¯åžžã«äžå®ã§ãããåžžã«2ã€ã®00 00ãªã¯ãããã§ãšã³ã³ãŒããããŸããæåã®ãªã¯ãããã¯æ
å ±ãªã¯ãããã§ããã2çªç®ã®ãªã¯ãããã¯åžžã«é·ãããŒãã®é·ããªã¯ãããã§ãã
Habrã®çµè«
PDF圢åŒã®ãã«ããã¹ãïŒããã³PDFã«æ·»ä»ãããŠããè¿œå ã®äŸïŒã¯ã
çŽæ¥ãªã³ã¯ããããŠã³ããŒãã§ããŸãã ææ°ããŒãžã§ã³ã®Acrobat Readerã䜿çšããŠè¡šç€ºããããšããå§ãããŸãã