pub struct Roots(/* private fields */);Expand description
The certificate authorities a client verifies a server against: the chain up to one of them, every certificate’s validity dates and the server name the client dialled.
This is the web PKI trust model, a different one from pinning: any server that one of
these authorities issued a certificate for the dialled name is trusted. Dial with a name
(dial_named, TlsHandshake::client_named,
or rustls with a ServerName); dial names SERVER_NAME,
which no authority issues, so it is refused with Refusal::NameMismatch. Names are
always checked and dates always are, whatever Policy::check_validity
says (that setting applies to pinned certificates).
Implementations§
Source§impl Roots
impl Roots
Sourcepub fn bundle_pem(text: impl Into<String>) -> Self
pub fn bundle_pem(text: impl Into<String>) -> Self
The CA certificates in this PEM text (a bundle): every CERTIFICATE block is a root,
other blocks and text between them are ignored.
Sourcepub fn bundle_file(path: impl Into<PathBuf>) -> Self
pub fn bundle_file(path: impl Into<PathBuf>) -> Self
The CA certificates in the PEM file at path, read when the verifier is built (by
PeerServerVerifier::new or a
client configuration), as by bundle_pem.
Sourcepub fn platform() -> Self
pub fn platform() -> Self
The operating system’s roots and certificate verifier (rustls-platform-verifier): the Windows, macOS, iOS or Android verifier, or the system’s CA bundle checked by webpki elsewhere. It may also check revocation where the platform does.
On Android the host initializes rustls-platform-verifier from its JVM first
(rustls_platform_verifier::android::init_*); otherwise a handshake panics.