7.5. X.509 Certificate Parsing and Validation Complexity
Parsing and validation of X.509 certificates and certificate chains is complex, and implementation mistakes have previously exposed security vulnerabilities. Complexities of validation include (but are not limited to) [CX5P] [DCW] [RFC5280]:
-
checking of basic constraints, basic and extended key usage constraints, validity periods, and critical extensions;
-
handling of embedded NUL bytes in ASN.1 counted-length strings and non-canonical or non-normalized string representations in subject names;
-
handling of wildcard patterns in subject names;
-
recursive verification of certificate chains and checking certificate revocation.
For these reasons, implementors SHOULD use an established and well-tested X.509 library (such as one used by an established TLS library) for validation of X.509 certificate chains and SHOULD NOT attempt to write their own X.509 certificate validation procedures.