From d7e2f0a72a64cfca463b51547b9d8c9fe4bbdd00 Mon Sep 17 00:00:00 2001 From: Yusuf Bera Ertan Date: Wed, 19 May 2021 01:54:50 +0300 Subject: [PATCH 1/2] downgrade webpki, use rusttls-native-certs instead of webpki-roots --- Cargo.toml | 8 ++++---- src/client.rs | 5 ++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index dc123e1..2ef26fc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,7 +19,7 @@ all-features = true default = [] native-tls = ["native-tls-crate"] native-tls-vendored = ["native-tls", "native-tls-crate/vendored"] -rustls-tls = ["rustls", "webpki", "webpki-roots"] +rustls-tls = ["rustls", "webpki", "rustls-native-certs"] [dependencies] base64 = "0.13.0" @@ -46,11 +46,11 @@ version = "0.19.0" [dependencies.webpki] optional = true -version = "0.22.0" +version = "0.21" -[dependencies.webpki-roots] +[dependencies.rustls-native-certs] optional = true -version = "0.22.0" +version = "0.5.0" [dev-dependencies] env_logger = "0.8.1" diff --git a/src/client.rs b/src/client.rs index f351cf2..2a6a513 100644 --- a/src/client.rs +++ b/src/client.rs @@ -72,7 +72,10 @@ mod encryption { Mode::Tls => { let config = { let mut config = ClientConfig::new(); - config.root_store.add_server_trust_anchors(&webpki_roots::TLS_SERVER_ROOTS); + config.root_store = match rustls_native_certs::load_native_certs() { + Ok(store) => store, + Err((_, err)) => Err(err)?, + }; Arc::new(config) }; From a729b37b224744fcd5bcf71695fedb4849474b1f Mon Sep 17 00:00:00 2001 From: Yusuf Bera Ertan Date: Wed, 26 May 2021 16:07:54 +0300 Subject: [PATCH 2/2] Update src/client.rs Co-authored-by: Daniel Abramov --- src/client.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/client.rs b/src/client.rs index 2a6a513..55ba080 100644 --- a/src/client.rs +++ b/src/client.rs @@ -72,10 +72,7 @@ mod encryption { Mode::Tls => { let config = { let mut config = ClientConfig::new(); - config.root_store = match rustls_native_certs::load_native_certs() { - Ok(store) => store, - Err((_, err)) => Err(err)?, - }; + config.root_store = rustls_native_certs::load_native_certs().map_err(|(_, err)| err)?; Arc::new(config) };