Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps: update rustls-native-certs to 0.8 #348

Merged
merged 1 commit into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ version = "1.0"

[dependencies.rustls-native-certs]
optional = true
version = "0.7.0"
version = "0.8.0"

[dependencies.tokio-native-tls]
optional = true
Expand Down
22 changes: 19 additions & 3 deletions src/tls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,26 @@ mod encryption {
let mut root_store = RootCertStore::empty();
#[cfg(feature = "rustls-tls-native-roots")]
{
let native_certs = rustls_native_certs::load_native_certs()?;
let total_number = native_certs.len();
let rustls_native_certs::CertificateResult {
certs, errors, ..
} = rustls_native_certs::load_native_certs();

if !errors.is_empty() {
log::warn!(
"native root CA certificate loading errors: {errors:?}"
);
}

// Not finding any native root CA certificates is not fatal if the
// "rustls-tls-webpki-roots" feature is enabled.
#[cfg(not(feature = "rustls-tls-webpki-roots"))]
if certs.is_empty() {
return Err(std::io::Error::new(std::io::ErrorKind::NotFound, format!("no native root CA certificates found (errors: {errors:?})")).into());
}

let total_number = certs.len();
let (number_added, number_ignored) =
root_store.add_parsable_certificates(native_certs);
root_store.add_parsable_certificates(certs);
log::debug!("Added {number_added}/{total_number} native root certificates (ignored {number_ignored})");
}
#[cfg(feature = "rustls-tls-webpki-roots")]
Expand Down
Loading