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?;
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:
- Parses the DER-encoded
CertificateList(RFC 5280 §5). - Verifies the CRL signature against the issuer's SPKI.
- Checks the CRL's
issuerfield matches the certificate'sissuer. - Checks
thisUpdate ≤ now ≤ nextUpdate(absentnextUpdate→ fail). - 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:
- Parses the DER-encoded
OCSPResponse(RFC 6960 §4.2). - Requires
responseStatus == successful. - Verifies the signature on
BasicOCSPResponseagainst the issuer's SPKI. - Finds the
SingleResponsematching the certificate's serial number. - Checks
producedAt ≤ now,thisUpdate ≤ now,now ≤ nextUpdate. - Returns based on
certStatus:good → Ok(()),revoked → Err(Revoked),unknown → Err(OcspStatusUnknown).
v0.1 limitations
- CRL checking does not follow CRL Distribution Points — caller supplies the CRL.
- Delta CRLs are not supported.
- OCSP checking only supports issuer-signed (direct) responses; delegated responder certificates are not supported.
SingleResponsematching is by serial number only;issuerNameHashandissuerKeyHashare not verified.
Standards
- [RFC 5280] §5 — CRL Profile
- [RFC 5280] §4.2.1.13 — CRL Distribution Points
- [RFC 6960] — Online Certificate Status Protocol (OCSP)
License
Apache-2.0 OR MIT