Skip to content

rfc/lint_subject_given_name_max_length / rfc/lint_subject_surname_max_length use the incorrect upper bound #585

Description

@sleevi

Originally noted by @dzacharo in sleevi/cabforum-docs#36 (comment)

Current Behavior

rfc/lint_subject_given_name_max_length errors if more than 16 characters present
rfc/lint_subject_surname_max_length errors if more than 40 characters present

Expected Behavior

rfc/lint_subject_given_name_max_length and rfc/lint_subject_surname_max_length should only error if more than 32768 characters are present.

Supporting References

From RFC 5280, Appendix A.1

-- attribute data types

Attribute               ::= SEQUENCE {
      type             AttributeType,
      values    SET OF AttributeValue }
            -- at least one value is required

AttributeType           ::= OBJECT IDENTIFIER

AttributeValue          ::= ANY -- DEFINED BY AttributeType

AttributeTypeAndValue   ::= SEQUENCE {
        type    AttributeType,
        value   AttributeValue }

-- suggested naming attributes: Definition of the following
--   information object set may be augmented to meet local
--   requirements.  Note that deleting members of the set may
--   prevent interoperability with conforming implementations.
-- presented in pairs: the AttributeType followed by the
--   type definition for the corresponding AttributeValue

-- Arc for standard naming attributes

id-at OBJECT IDENTIFIER ::= { joint-iso-ccitt(2) ds(5) 4 }

-- Naming attributes of type X520name

id-at-name                AttributeType ::= { id-at 41 }
id-at-surname             AttributeType ::= { id-at  4 }
id-at-givenName           AttributeType ::= { id-at 42 }
id-at-initials            AttributeType ::= { id-at 43 }
id-at-generationQualifier AttributeType ::= { id-at 44 }

-- Naming attributes of type X520Name:
--   X520name ::= DirectoryString (SIZE (1..ub-name))
--
-- Expanded to avoid parameterized type:
X520name ::= CHOICE {
      teletexString     TeletexString   (SIZE (1..ub-name)),
      printableString   PrintableString (SIZE (1..ub-name)),
      universalString   UniversalString (SIZE (1..ub-name)),
      utf8String        UTF8String      (SIZE (1..ub-name)),
      bmpString         BMPString       (SIZE (1..ub-name)) }

What this section is saying is that the AttributeType of id-at-surname and id-at-givenName are of type X520name, which is a DirectoryString of maximum length ub-name, which is defined later as:

--  specifications of Upper Bounds MUST be regarded as mandatory
--  from Annex B of ITU-T X.411 Reference Definition of MTS Parameter
--  Upper Bounds

-- Upper Bounds
ub-name INTEGER ::= 32768

The current lints are bsed on ub-given-name-length and ub-surname-length, but these lengths are not used by the AttributeTypeAndValue field of the DN, but by the PersonalName /TeletexPersonalName of BuiltInStandardAttributes of an ORAddress

The revised module, in RFC 5912, Section 14 makes this clearer, with the following ASN.1 module:

  id-at-surname           AttributeType ::= { id-at 4 }
  at-surname ATTRIBUTE ::= { TYPE X520name IDENTIFIED BY id-at-surname }

  id-at-givenName         AttributeType ::= { id-at 42 }
  at-givenName ATTRIBUTE ::=
      { TYPE X520name IDENTIFIED BY id-at-givenName }

  -- Directory string type --

  DirectoryString{INTEGER:maxSize} ::= CHOICE {
      teletexString    TeletexString(SIZE (1..maxSize)),
      printableString  PrintableString(SIZE (1..maxSize)),
      bmpString        BMPString(SIZE (1..maxSize)),
      universalString  UniversalString(SIZE (1..maxSize)),
      uTF8String       UTF8String(SIZE (1..maxSize))
  }

  X520name ::= DirectoryString {ub-name}

Metadata

Metadata

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions