ASN.1 AUTOMATIC TAGS and EXTENSIBILITY IMPLIED Att

2019-04-15 01:28发布

I have been presented with an ASN.1 document that includes two encoding/decoding attributes;

  • AUTOMATIC TAGS
    • My understanding; the tags are defined automatically using the encoding rules unless a tag notation is present in the definition
  • EXTENSIBILITY IMPLIED
    • My understanding; types may have elements that are not defined within the ASN.1 document. If found, the encoder should silently ignore. Additionally, my decoder should also be ready to handle values with unspecified tags.

Q1: Are my understandings above correct?

Q2: w.r.t AUTOMATIC TAGS; defining automatically seems infeasible (obviously not...) but my understanding is that someEncoder would therefore assign SomeType.class with tag (for example) 0xBB; how does someDecoder know how to decode 0xBB back to SomeType?

Q2: w.r.t unspecified tags; once again, I am unsure how to pass an unspecified Tag back to something else.

标签: asn.1
1条回答
等我变得足够好
2楼-- · 2019-04-15 02:08

Q1. If the AUTOMATIC TAGS clause is present, all the components of the SEQUENCE and SET types and all the alternatives of the CHOICE types defined in the module are automatically tagged sequentially starting from 0. If a constructed type contains at least a manual tag (i.e. if it contains square brackets), the automatic tagging mode is switched off for this type.

Q2. The same algorithm for automatic tagging is used when writing the encoder and decoder code.

Q3. Your decoder may encounter unrecognized tags when it is communicating with a peer which has a newer version of your ASN.1 schema (which includes additional components). In this case (if you do not intend to retransmit the received data) you should ignore the unrecognized tags.

查看更多
登录 后发表回答