Why do I get error A0374E from the ASN.1 Compiler when an OPTIONAL or DEFAULT component is followed by an open type?

Suppose you have:

CardholderVerificationField ::= SEQUENCE {
    id CARDVER.&Id({CardVerificationTypes}) DEFAULT 0,
    data CARDVER.&Type({CardVerificationTypes}{@id})
}

CardVerificationTypes CARDVER ::= {
    cvvCvc2,
    ...
}

cvvCvc2 CARDVER ::= {ID 0 SYNTAX NumericString (SIZE(3..4))}

The above syntax is in direct violation of Rec. ITU-T X.680 (2008) clause 25.6.1, which states:

25.6.1 Where there are one or more consecutive occurrences of "ComponentType" that are all marked OPTIONAL or DEFAULT, the tags of those "ComponentType"s and of any immediately following component type in the series shall be distinct (see clause 31.2). If automatic tagging was selected, the requirement that tags be distinct applies only after automatic tagging has been performed, and will always be satisfied.

In CardholderVerificationField "data" is an "immediately following component type" which does not have a tag that is distinct from that of "id" (it is required to be distinct because "id" is defined with a DEFAULT value). Since "data" is an open type, it has an indeterminate tag, as stated in Rec. ITU-T X.681 (2008) clause 14.2:

14.2 For a type field, the notation defines an open type .... The following constraints on the use of this notation apply ...:

a) ....
b) This notation has an indeterminate tag and thus cannot be used where a tag distinct from that of some other type is required.

NOTE 1 - This restriction can normally be avoided by (explicitly) tagging the type.
c) ....
d) ....

In short, you can correct the problem by adding a tag to data:

CardholderVerificationField ::= SEQUENCE {
    id CARDVER.&Id({CardVerificationTypes}) DEFAULT 0,
    data [0] CARDVER.&Type({CardVerificationTypes}{@id})
}

NOTE! Unless you are the official editor for the ASN.1 spec that defines CardholderVerificationField, you SHOULD NOT make such a modification. To do so will lead to interoperability problems. You should report the defect to the organization which is responsible for this type definition, making a recommendation as to how to correct the problem, and have them tell you what the solution is (typically they accept the solution proposed by the person reporting the defect if it is a good solution, which the above is). If you are the official editor then simply add a distinct tag such as [0]. It is assumed of course that id does not have a tag of [0].


The samples included with some of the Knowledge Center answers are meant for your general understanding of the OSS products. Different versions of the products might produce slightly different outputs. Consult the products documentation and samples for the most up-to-date products information and code examples.



Contact Support
contact Our office hours
24 hours/day, 7 days/week

  • Phone: 1-888-OSS-2761 (USA and Canada)
  • Phone: 1-732-302-9669 (International)
  • Fax: 1-732-302-0023
  • Email: support@oss.com
Free Trial
download

Test drive the OSS Nokalva ASN.1, 4G and XML Tools now! Your trial includes complete software, documentation, sample programs, free 24x7 technical support and more.




Learn ASN.1
Learn ASN.1

Our expert personnel can help you learn ASN.1!

We offer 4-day ASN.1 courses at our headquarters or your premises.