pkix-revocation
Certificate revocation checking for pkix-path and pkix-chain.
Provides the [RevocationChecker] trait and three implementations:
| Type | Feature | Description |
|---|---|---|
NoRevocation |
always | Zero-cost; always reports not-revoked |
CrlChecker |
crl |
Offline CRL validation (you supply DER bytes) |
OcspChecker |
ocsp |
Offline OCSP response validation (you supply DER bytes) |
Design: offline by default
All checkers are offline — the caller supplies pre-fetched DER bytes.
There is no network I/O in this crate. This keeps the core no_std-compatible
and lets you control fetching (cache, rate-limit, pre-fetch at startup).
For online fetching from CRL Distribution Points and OCSP URLs found in
certificates, see [pkix-revocation-http].
Usage
No revocation (offline/embedded)
use NoRevocation;
// Pass to pkix_chain::verify_chain as the revocation argument.
// Always returns Ok(()); suitable for closed networks, short-lived certs,
// hardware attestation where issuance is the control.
CRL checking
use ;
use DefaultVerifier;
let crl_der = read?;
let checker = new;
// Called once per certificate by pkix_chain::verify_chain,
// or directly:
checker.check_revocation?;
CRL with delta CRL
Delta CRLs (RFC 5280 §5.2.4) contain only the incremental changes since a base CRL was issued, reducing download size. Supply both:
use CrlChecker;
use DefaultVerifier;
let checker = with_delta?;
checker.check_revocation?;
OCSP checking
use ;
use DefaultVerifier;
let ocsp_response_der = fetch_ocsp_response;
let checker = new;
checker.check_revocation?;
Custom revocation
use RevocationChecker;
use Certificate;
;
How CRL checking works
CrlChecker::check_revocation:
- Verifies that
issueris the actual issuer ofcert(subject/issuer DN match). - Parses the DER-encoded
CertificateList(RFC 5280 §5). - Checks the CRL's
issuerfield matches the certificate'sissuer. - Verifies the CRL signature against the issuer's SPKI.
- Checks
thisUpdate ≤ now ≤ nextUpdate(absentnextUpdate→ fail). - When a delta CRL is present (
with_delta), verifies and merges the delta's revoked entries with the base CRL's entries (RFC 5280 §5.2.4). - Checks the
IssuingDistributionPointscope flags if present (onlyContainsUserCerts, onlyContainsCACerts, onlyContainsAttributeCerts). - Searches
revokedCertificatesfor the certificate's serial number. - Returns
Err(Revoked { serial, reason_code })if found,Ok(())if not.
How OCSP checking works
OcspChecker::check_revocation:
- Verifies that
issueris the actual issuer ofcert(subject/issuer DN match). - Parses the DER-encoded
OCSPResponse(RFC 6960 §4.2). - Requires
responseStatus == successful. - Verifies the signature on
BasicOCSPResponseagainst the issuer's SPKI. - Verifies the
ResponderIdmatches the issuer by DN (byName) or SHA-1 of the issuer's SPKI public key bytes (byKey). - Finds the
SingleResponsematching the certificate's serial number. - Verifies
issuerNameHashandissuerKeyHashin theCertIDagainst the issuer's subject DN and SPKI key bytes. - Checks
producedAt ≤ now,thisUpdate ≤ now ≤ nextUpdate. - Returns based on
certStatus:good → Ok(()),revoked → Err(Revoked),unknown → Err(OcspStatusUnknown).
v0.2 limitations
- CRL checking does not follow CRL Distribution Points — caller supplies the CRL.
- OCSP checking only supports issuer-signed (direct) responses; delegated responder certificates (RFC 6960 §2.6) are not supported.
Standards
- [RFC 5280] §5 — CRL Profile
- [RFC 5280] §5.2.4 — Delta CRLs
- [RFC 5280] §5.2.5 — IssuingDistributionPoint
- [RFC 5280] §4.2.1.13 — CRL Distribution Points
- [RFC 6960] — Online Certificate Status Protocol (OCSP)
License
Apache-2.0 OR MIT