Skip to content

question: should GeneralName::DNSName be treated according to RFC5280 7.1 & RFC1034 3.5 #216

@georglauterbach

Description

@georglauterbach

While comparing GeneralNames, I noticed that the implementation of GeneralName may not adhere to the these RFCs:

  1. RFC5280 7.2
  2. RFC1034 3.5

Looking at the implementation

pub enum GeneralName<'a> {
OtherName(Oid<'a>, Any<'a>),
/// More or less an e-mail, the format is not checked.
RFC822Name(&'a str),
/// A hostname, format is not checked.
DNSName(&'a str),

the DNSName field stores a &'a str which may be UTF-8 in Rust, but says RFC5280 7.2

one choice in GeneralName is the dNSName field, which is defined as type IA5String. [...] IA5String is limited to the set of ASCII characters. [...]


Moreover, the comparison of a &str is case-sensitive, while RFC1034 3.5 says

Note that while upper and lower case letters are allowed in domain names, no significance is attached to the case. That is, two names with the same spelling but different case are to be treated as if identical.

I am not 100% sure, but according to the RFC, we may need a case-insentive comparison here. Since PartialEq is derived, a new-type pattern could suffice for an ASCII-string that does case-insensitive comparisons.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions