简体   繁体   English

asn.1 DER 编码隐式序列

[英]asn.1 DER Encode IMPLICIT SEQUENCE

I am trying to encode the below ASN.1 grammar in DER format.我正在尝试以 DER 格式对以下 ASN.1 语法进行编码。

BuiltInStandardAttributes ::= SEQUENCE {
    organizational-unit-names [6] IMPLICIT OrganizationalUnitNames OPTIONAL 
    } 
    
OrganizationalUnitNames ::= SEQUENCE SIZE (1..ub-organizational-units)
                             OF OrganizationalUnitName

OrganizationalUnitName ::= PrintableString (SIZE
                    (1..ub-organizational-unit-name-length))
                

In the sample data, I have 2 PrintableString s "be" and "pai"在示例数据中,我有 2 个PrintableString s "be" 和 "pai"

I tried the encoding as我尝试编码为

SEQUENCE (1 elem)
  [6] (2 elem)
    PrintableString be
    PrintableString pai

30 0B A6 09 13 02 62 65 13 03 70 61 69

Is this correct?这个对吗? Here, how do I specify the inner SEQUENCE is IMPLICIT ?在这里,我如何指定内部SEQUENCEIMPLICIT

You can test your encoding against your schema at https://asn1.io/PKI-Inspector .您可以在https://asn1.io/PKI-Inspector针对您的架构测试您的编码。

For example, if例如,如果

the inline IMPLICT is not specified未指定内联 IMPLICT

but your schema specifies the AUTOMATIC TAGS in the module definition, your encoding will match the schema .但是您的架构在模块定义中指定了 AUTOMATIC TAGS,您的编码将匹配架构 If your module specifies the EXPLICIT TAGS the encoding won't match .如果您的模块指定了 EXPLICIT TAGS,则编码将不匹配

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM