Skip to main content

CrlChecker

Struct CrlChecker 

Source
pub struct CrlChecker<V> { /* private fields */ }
Available on crate feature crl only.
Expand description

Offline CRL-based revocation checker.

Parses a DER-encoded CertificateList, verifies its signature against the issuer’s SPKI, checks the thisUpdate/nextUpdate validity window, and reports whether the certificate’s serial number appears in the revoked list.

To also apply a delta CRL (RFC 5280 §5.2.4), use CrlChecker::with_delta.

§Feature

Only available when the crl feature is enabled.

§Return value semantics

RevocationChecker::check_revocation returns Ok(()) in two distinct cases:

  1. Not revoked: the CRL covers this certificate type and the serial number was not found in the revoked list.
  2. Not covered: the CRL’s IssuingDistributionPoint scope flags (onlyContainsUserCerts, onlyContainsCACerts, onlyContainsAttributeCerts) indicate the CRL does not apply to this certificate type.

These two outcomes are indistinguishable from the caller’s perspective. Callers enforcing a hard-fail revocation policy must separately verify that at least one CRL or OCSP response actually covers the certificate in question; receiving Ok(()) alone is not sufficient.

§Limitations (v0.1)

  • The CRL must be signed directly by the certificate issuer (indirect CRLs are not supported; deferred to v0.2).
  • CRL Distribution Point name matching (CDP vs IDP name) is not implemented. The checker does enforce onlyContainsUserCerts, onlyContainsCACerts, and onlyContainsAttributeCerts scope flags; full CDP/IDP name matching is v0.2.
  • Both the base CRL and the delta CRL (if present) are re-parsed from DER on every check_revocation call. For long chains validated against the same CRL pair, this is O(N) redundant parsing. Tracked for v0.2 (cache the parsed CertificateList in new / with_delta).
  • RevocationChecker::check_revocation_against_anchor is not overridden. The certificate immediately issued by the trust anchor is not revocation-checked by this type; revocation against the anchor is the responsibility of the path validator (a v0.1 limitation).

Implementations§

Source§

impl<V: SignatureVerifier> CrlChecker<V>

Source

pub fn new(crl_der: impl Into<Vec<u8>>, now_unix: u64, verifier: V) -> Self

Create a new CrlChecker.

  • crl_der — DER-encoded CertificateList (any Into<Vec<u8>>, e.g. Vec<u8> or &[u8])
  • now_unix — current time as seconds since the Unix epoch
  • verifier — signature verifier used to authenticate the CRL
Source

pub fn with_delta( base_der: impl Into<Vec<u8>>, delta_der: impl Into<Vec<u8>>, now_unix: u64, verifier: V, ) -> Result<Self>

Create a CrlChecker with a base CRL and a delta CRL.

The delta CRL is merged into the base CRL per RFC 5280 §5.2.4:

  • Entries in the delta that are not in the base are added.
  • Entries in the delta with reason removeFromCRL are removed from the base.
  • The merged result is used for all subsequent check_revocation calls.

Returns Err(Error::DeltaCrlBaseMismatch) if:

  • The delta CRL’s BaseCRLNumber is absent (not a delta CRL), or
  • The delta’s BaseCRLNumber is greater than the base CRL’s CRLNumber (the delta was produced against a newer base than the one supplied).

Trait Implementations§

Source§

impl<V: Clone> Clone for CrlChecker<V>

Source§

fn clone(&self) -> CrlChecker<V>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<V: Debug> Debug for CrlChecker<V>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<V: SignatureVerifier> RevocationChecker for CrlChecker<V>

Source§

fn check_revocation( &self, cert: &Certificate, issuer: &Certificate, ) -> Result<()>

Check whether cert has been revoked. Read more
Source§

fn check_revocation_against_anchor( &self, _cert: &Certificate, _anchor: &TrustAnchor, ) -> Result<()>

Check whether cert (issued directly by a trust anchor) has been revoked. Read more

Auto Trait Implementations§

§

impl<V> Freeze for CrlChecker<V>
where V: Freeze,

§

impl<V> RefUnwindSafe for CrlChecker<V>
where V: RefUnwindSafe,

§

impl<V> Send for CrlChecker<V>
where V: Send,

§

impl<V> Sync for CrlChecker<V>
where V: Sync,

§

impl<V> Unpin for CrlChecker<V>
where V: Unpin,

§

impl<V> UnsafeUnpin for CrlChecker<V>
where V: UnsafeUnpin,

§

impl<V> UnwindSafe for CrlChecker<V>
where V: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V