pub struct OcspChecker<V> { /* private fields */ }Available on crate feature
ocsp only.Expand description
Offline OCSP-based revocation checker.
Parses a pre-fetched DER-encoded OCSP response, verifies its signature
against the issuer’s SPKI, checks the validity window of the matching
SingleResponse, and reports the certificate’s
revocation status.
§Feature
Only available when the ocsp feature is enabled.
§Limitations (v0.1)
- The OCSP response is re-parsed from DER on every
check_revocationcall. For chains with multiple certificates validated against the same response, this is O(N) redundant parsing. Tracked for v0.2 (cache the parsedBasicOcspResponseinnew). - Only issuer-signed (direct) OCSP responses are supported.
Delegated OCSP responders (responses signed by a separate responder
certificate, not by the issuer directly) will fail with
Error::OcspSignatureInvalidbecause the signature is verified against the issuer’s key. This is a v0.1 limitation tracked for v0.2.
SingleResponsematching uses both serial number and theCertIDissuerNameHash/issuerKeyHashfields (RFC 6960 §4.1.1). An OCSP response from a different CA with the same serial number will be rejected by the hash checks.- The
ResponderIdfield is not verified against the issuer identity. - If no
SingleResponsematches the certificate’s serial number,OcspStatusUnknownis returned (hard-fail). RevocationChecker::check_revocation_against_anchoris 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> OcspChecker<V>
impl<V: SignatureVerifier> OcspChecker<V>
Sourcepub fn new(response_der: impl Into<Vec<u8>>, now_unix: u64, verifier: V) -> Self
pub fn new(response_der: impl Into<Vec<u8>>, now_unix: u64, verifier: V) -> Self
Create a new OcspChecker.
response_der— DER-encodedOCSPResponse(anyInto<Vec<u8>>, e.g.Vec<u8>or&[u8])now_unix— current time as seconds since the Unix epochverifier— signature verifier used to authenticate the OCSP response
Trait Implementations§
Source§impl<V: Clone> Clone for OcspChecker<V>
impl<V: Clone> Clone for OcspChecker<V>
Source§fn clone(&self) -> OcspChecker<V>
fn clone(&self) -> OcspChecker<V>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<V: Debug> Debug for OcspChecker<V>
impl<V: Debug> Debug for OcspChecker<V>
Source§impl<V: SignatureVerifier> RevocationChecker for OcspChecker<V>
impl<V: SignatureVerifier> RevocationChecker for OcspChecker<V>
Source§fn check_revocation(
&self,
cert: &Certificate,
issuer: &Certificate,
) -> Result<()>
fn check_revocation( &self, cert: &Certificate, issuer: &Certificate, ) -> Result<()>
Check whether
cert has been revoked. Read moreSource§fn check_revocation_against_anchor(
&self,
_cert: &Certificate,
_anchor: &TrustAnchor,
) -> Result<()>
fn check_revocation_against_anchor( &self, _cert: &Certificate, _anchor: &TrustAnchor, ) -> Result<()>
Check whether
cert (issued directly by a trust anchor) has been revoked. Read moreAuto Trait Implementations§
impl<V> Freeze for OcspChecker<V>where
V: Freeze,
impl<V> RefUnwindSafe for OcspChecker<V>where
V: RefUnwindSafe,
impl<V> Send for OcspChecker<V>where
V: Send,
impl<V> Sync for OcspChecker<V>where
V: Sync,
impl<V> Unpin for OcspChecker<V>where
V: Unpin,
impl<V> UnsafeUnpin for OcspChecker<V>where
V: UnsafeUnpin,
impl<V> UnwindSafe for OcspChecker<V>where
V: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more