Crate rustls_native_certs
source ·Expand description
rustls-native-certs allows rustls to use the platform’s native certificate store when operating as a TLS client.
It provides a single function load_native_certs()
, which returns a
collection of certificates found by reading the platform-native
certificate store.
If the SSL_CERT_FILE environment variable is set, certificates (in PEM format) are read from that file instead.
If you want to load these certificates into a rustls::RootCertStore
,
you’ll likely want to do something like this:
let mut roots = rustls::RootCertStore::empty();
for cert in rustls_native_certs::load_native_certs().expect("could not load platform certs") {
roots.add(cert).unwrap();
}
Functions§
- Load root certificates found in the platform’s native certificate store.