Expand description
Build OCSP requests, parse OCSP responses, and extract the OCSP
responder URL from a certificate’s Authority Information Access
(AIA) extension. With the fetch feature, also performs an async
HTTP/1.1 POST against the responder via hyper.
§Transport policy: HTTP-only
Production CAs (Let’s Encrypt, DigiCert, Sectigo, Entrust,
GlobalSign) all ship HTTP-only OCSP responders, and OCSP responses
are independently signed (the transport adds nothing the response
signature doesn’t already provide). This crate enforces HTTP-only:
HTTPS responder URLs surface as OcspError::HttpsNotSupported
at extract / fetch time; the caller can deliver such responses
through other channels (e.g. a pre-fetched DER blob on disk).
§API shape
Three layers:
- Pure functions on cert DER (always compiled):
extract_ocsp_url,build_ocsp_request,parse_ocsp_response. No IO; unit- testable in isolation. - One async transport function (
fetchfeature): [fetch_ocsp]. Wraps a hyper HTTP/1.1 conn behind a single timeout. - Convenience (
fetchfeature): [fetch_ocsp_for_cert] runs the whole pipeline (extract → build → fetch → parse) given the leaf- issuer DER.
Structs§
- Ocsp
Staple - Parsed OCSP response result.
stapleis the full DEROCSPResponsesuitable for handing to rustls viaCertifiedKey.ocsp.next_updateis the responder’snextUpdate(orproducedAt + 7dwhen omitted — RFC 6960 §4.2.2.1 allowsnextUpdateto be absent for “indefinite” responses; we still need a wall-clock deadline so a renewal scheduler can plan a refresh).
Enums§
- Ocsp
Error - Error surface for the OCSP pipeline. Categorised so callers can branch on transport / parse / responder failures without string-matching.
Functions§
- build_
ocsp_ request - Build an
OCSPRequestDER forcert_dersigned byissuer_derper RFC 6960 §4.1.1. Cert ID hash is SHA-1 — RFC-mandated, not security-critical (the hash is a routing identifier). - extract_
ocsp_ url - Extract the OCSP responder URL from a cert’s AIA extension.
- parse_
ocsp_ response - Parse an
OCSPResponseDER into aOcspStaple. The original bytes are returned verbatim as thestaple(rustls ships them on the wire without re-encoding).