pub struct OcspClient { /* private fields */ }Expand description
OCSP client for checking certificate revocation status.
Thread-safe: all methods take &self and the cache uses DashMap
for lock-free concurrent access.
Implementations§
Source§impl OcspClient
impl OcspClient
Sourcepub fn new(config: OcspConfig) -> Self
pub fn new(config: OcspConfig) -> Self
Creates a new OCSP client with the given configuration.
Sourcepub async fn check_certificate_status(
&self,
cert_der: &[u8],
issuer_der: &[u8],
) -> OcspResult<OcspStatus>
pub async fn check_certificate_status( &self, cert_der: &[u8], issuer_der: &[u8], ) -> OcspResult<OcspStatus>
Check the revocation status of a certificate.
Per RFC 6960 §4.1, builds an OCSPRequest with a CertID computed
from the certificate and its issuer, sends it to the responder
via HTTP POST with Content-Type application/ocsp-request, and
parses the response.
§Arguments
cert_der- DER-encoded certificate to checkissuer_der- DER-encoded issuer certificate (needed for CertID)
§Errors
Returns OcspError if the request fails, the response is invalid,
or the nonce does not match (when required).
Sourcepub async fn get_stapled_response(
&self,
server_cert_der: &[u8],
issuer_der: &[u8],
) -> OcspResult<Vec<u8>>
pub async fn get_stapled_response( &self, server_cert_der: &[u8], issuer_der: &[u8], ) -> OcspResult<Vec<u8>>
Returns a stapled OCSP response for the EST server’s own certificate.
OCSP stapling (RFC 6066 §8) allows the server to include a pre-fetched OCSP response in the TLS handshake, avoiding the client needing to contact the OCSP responder separately.
§Arguments
server_cert_der- DER-encoded server certificateissuer_der- DER-encoded issuer certificate
§Returns
The DER-encoded OCSP response suitable for TLS stapling, or an error if the response cannot be obtained.
Sourcepub fn evict_expired(&self)
pub fn evict_expired(&self)
Evict expired entries from the response cache.
Sourcepub fn cache_size(&self) -> usize
pub fn cache_size(&self) -> usize
Returns the number of cached responses.
Auto Trait Implementations§
impl Freeze for OcspClient
impl !RefUnwindSafe for OcspClient
impl Send for OcspClient
impl Sync for OcspClient
impl Unpin for OcspClient
impl UnsafeUnpin for OcspClient
impl !UnwindSafe for OcspClient
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more