This commit is contained in:
Eugene Pankov 2022-07-24 10:29:30 +02:00
parent 6e4835739c
commit 9d314988c0
No known key found for this signature in database
GPG key ID: 5896FCBBDD1CF4F4
2 changed files with 7 additions and 7 deletions

View file

@ -5,10 +5,7 @@ use std::time::SystemTime;
use rustls::client::{ServerCertVerified, ServerCertVerifier, WebPkiVerifier};
use rustls::server::{ClientHello, NoClientAuth, ResolvesServerCert};
use rustls::sign::CertifiedKey;
use rustls::{
Certificate, ClientConfig, Error as TlsError, PrivateKey,
ServerConfig, ServerName,
};
use rustls::{Certificate, ClientConfig, Error as TlsError, PrivateKey, ServerConfig, ServerName};
use super::ROOT_CERT_STORE;

View file

@ -1,10 +1,13 @@
use once_cell::sync::Lazy;
use rustls::RootCertStore;
#[allow(clippy::expect_used)]
pub static ROOT_CERT_STORE: Lazy<RootCertStore> = Lazy::new(|| {
let mut roots = RootCertStore::empty();
for cert in rustls_native_certs::load_native_certs().expect("could not load root TLS certificates") {
roots.add(&rustls::Certificate(cert.0)).unwrap();
for cert in
rustls_native_certs::load_native_certs().expect("could not load root TLS certificates")
{
roots.add(&rustls::Certificate(cert.0)).expect("could not add root TLS certificate");
}
return roots;
roots
});