简体   繁体   中英

Is this double constraint syntax from PKCS#9 legal?

In the PKCS#9 standard they have the following assignment. The first line defines a type PrintableString , that can only two characters long, and must be one of the two letter country acronyms defined in ISO/IEC3166. The syntax used for defining this constraint is two separate constraints that follow one another, however looking at the ASN.1 standard, there can only be one "root" constraint. Is the syntax used in the PKCS#9 standard incorrect?

countryOfResidence ATTRIBUTE ::= {
    WITH SYNTAX PrintableString (SIZE(2))(CONSTRAINED BY {
    -- Must be a two-letter country acronym in accordance with
    -- ISO/IEC 3166 --})
    EQUALITY MATCHING RULE caseIgnoreMatch
    ID pkcs-9-at-countryOfResidence
}

ATTRIBUTE ::= CLASS {
  &derivation            ATTRIBUTE OPTIONAL,
  &Type                  OPTIONAL, -- either &Type or &derivation required
  &equality-match        MATCHING-RULE OPTIONAL,
  &ordering-match        MATCHING-RULE OPTIONAL,
  &substrings-match      MATCHING-RULE OPTIONAL,
  &single-valued         BOOLEAN DEFAULT FALSE,
  &collective            BOOLEAN DEFAULT FALSE,
  &dummy                 BOOLEAN DEFAULT FALSE,
  -- operational extensions
  &no-user-modification  BOOLEAN DEFAULT FALSE,
  &usage                 AttributeUsage DEFAULT userApplications,
  &id                    OBJECT IDENTIFIER UNIQUE
}
WITH SYNTAX {
  [SUBTYPE OF &derivation]
  [WITH SYNTAX &Type]
  [EQUALITY MATCHING RULE &equality-match]
  [ORDERING MATCHING RULE &ordering-match]
  [SUBSTRINGS MATCHING RULE &substrings-match]
  [SINGLE VALUE &single-valued]
  [COLLECTIVE &collective]
  [DUMMY &dummy]
  [NO USER MODIFICATION &no-user-modification]
  [USAGE &usage]
  ID &id
}

ASN.1 Production (Found in ISO/IEC 8824-1:2015 / Rec. ITU-T X.680 (08/2015) page. 87)

ConstrainedType ::=
    Type Constraint
    | TypeWithConstraint

Constraint ::= "(" ConstraintSpec ExceptionSpec ")"
ConstraintSpec ::=
    SubtypeConstraint
    | GeneralConstraint

Constraints can be serially applied. It is legitimate. The "Type" that you are adding a constraint to can itself be a "ConstrainedType".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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