Warning
Be advised that LetsEncrypt, sadly, decided to drop support for OCSP stapling in 2025. So if you were planning to use this crate with LetsEncrypt - soon it won't be possible.
ocsp-stapler
OCSP stapler for Rustls.
- OCSP
Clientthat can be used separately StaplerwrapsArc<dyn ResolvesServerCert>trait object and automatically staples all certificates provided by it
Please see the docs for more details.
Example
// Read the chain & private key and combine them into CertifiedKey
let certs = read.unwrap;
let certs = certs..unwrap;
let key = read.unwrap;
let key = private_key.unwrap;
let key = any_supported_type.unwrap;
let ckey = new;
// Inner service that provides certificates to Rustls, can be anything
let mut inner = new;
inner.add.unwrap;
// Create a Stapler wrapping inner resolver
let stapler = new;
// Then you can build & use ServerConfig wherever applicable
let server_config = builder
.with_no_client_auth
.with_cert_resolver;
// Stop the background worker to clean up resources
stapler.stop.await;