#[non_exhaustive]pub enum AnchorDefect {
BasicConstraintsMissing,
BasicConstraintsNotCritical,
NotCa,
EmptySubject,
KeyCertSignMissing,
UnhandledCriticalExtension,
MalformedExtension,
NonDerBoolean,
DuplicateExtension,
Expired,
NotYetValid,
}Expand description
Why a trust anchor certificate was refused.
See Error::TrustAnchorRejected for why the anchor is examined at
all, given that RFC 5280 §6.1 does not.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
BasicConstraintsMissing
No BasicConstraints extension. RFC 5280 §4.2.1.9 requires one
in every CA certificate whose key signs certificates.
BasicConstraintsNotCritical
BasicConstraints present but not marked critical, which
§4.2.1.9 requires for a CA certificate.
NotCa
BasicConstraints present with cA=FALSE: the certificate says
it is not a CA, so it cannot be one.
EmptySubject
The certificate is a CA and its subject names nothing. RFC 5280 §4.1.2.6: “If the subject is a CA […], then the subject field MUST be populated with a non-empty distinguished name”.
§4.1.2.6 also lets an end entity carry its name only in a
critical subjectAltName, with an empty subject. That exception
does not extend to a CA, and the reason is structural rather than
stylistic: §6.1.3(a)(4) chains a certificate to its issuer by
comparing the issuer field against the working issuer name, and an
empty DN matches an empty DN. A CA named by nothing therefore
issues certificates whose issuer field is also empty, and any such
CA chains to any other – name chaining stops distinguishing
issuers at all. The SAN cannot stand in, because §6.1.3 never
reads a SAN as the working issuer name.
Reported for a CA whatever its subjectAltName says, including a
critical one.
KeyCertSignMissing
KeyUsage is present and does not assert keyCertSign, so the
key is not permitted to sign certificates. Absent KeyUsage is
not a defect – §4.2.1.3 leaves every usage permitted then.
UnhandledCriticalExtension
A critical extension this implementation does not process. §6.1.4 would reject such a certificate inside the path; the same rule is applied to the anchor.
MalformedExtension
An extension’s DER could not be parsed, so what it requires cannot be known.
NonDerBoolean
An extension holds a BOOLEAN that is valid BER and not valid
DER, so a strict parser cannot read it even though what it says is
not in doubt.
X.690 §11.1 requires a DER BOOLEAN with the value TRUE to have
every bit of its content octet set, that is 0xFF. BER permits any
non-zero octet, and RFC 5280 §4.1 requires certificates to be
DER-encoded, so 0x01 is a non-conforming encoding of TRUE.
Reported instead of MalformedExtension because the two call for
different responses. A malformed extension is unreadable and might
say anything; this one is readable by every lenient parser in the
world and says TRUE. A caller seeing this knows the certificate
is salvageable by its issuer re-encoding it, and knows that peers
using OpenSSL or NSS accept it today – neither of which
MalformedExtension conveys.
The certificate is still refused. Reading a non-DER encoding
generously would mean deciding that cA is TRUE on the strength of
an encoding the profile forbids. Three real certificates in
third_party/trust-stores/ encode basicConstraints cA this
way, out of 1,923 that encode the boolean at all: two eIDAS roots
and Ukraine’s ePassport CSCA.
Detected for basicConstraints, the only extension in this
profile carrying a BOOLEAN in its own value.
DuplicateExtension
The same extension OID appears more than once. RFC 5280 §4.2: “A certificate MUST NOT include more than one instance of a particular extension.”
Reported in preference to every other defect here, because the
extension list is what the rest of the profile check reads and a
duplicate makes those reads arbitrary: this crate takes the first
instance of an OID, another validator may take the last, and a
certificate with two basicConstraints or two KeyUsage values
then means different things to different implementations. A real
Lenovo UEFI Platform Key carries two critical KeyUsage
extensions whose values disagree, one permitting keyCertSign
and one permitting only digitalSignature.
validate_path has always rejected such a certificate inside a
path, as Error::MalformedCertificate; this is the same rule
applied to the anchor.
Expired
The anchor’s notAfter is before the validation time.
NotYetValid
The anchor’s notBefore is after the validation time.
Trait Implementations§
Source§impl Clone for AnchorDefect
impl Clone for AnchorDefect
impl Copy for AnchorDefect
Source§impl Debug for AnchorDefect
impl Debug for AnchorDefect
Source§impl<'de> Deserialize<'de> for AnchorDefect
Available on crate feature serde only.
impl<'de> Deserialize<'de> for AnchorDefect
serde only.Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for AnchorDefect
Source§impl Hash for AnchorDefect
impl Hash for AnchorDefect
Source§impl PartialEq for AnchorDefect
impl PartialEq for AnchorDefect
Source§impl Serialize for AnchorDefect
Available on crate feature serde only.
impl Serialize for AnchorDefect
serde only.