Crates.io | rustls-native-certs |
lib.rs | rustls-native-certs |
version | 0.8.0 |
source | src |
created_at | 2019-11-04 21:10:51.429223 |
updated_at | 2024-08-29 13:43:33.162681 |
description | rustls-native-certs allows rustls to use the platform native certificate store |
homepage | https://github.com/rustls/rustls-native-certs |
repository | https://github.com/rustls/rustls-native-certs |
max_upload_size | |
id | 178110 |
size | 98,879 |
rustls-native-certs allows rustls to use the platform's native certificate store when operating as a TLS client.
This is supported on Windows, macOS and Linux:
SSL_CERT_FILE
environment variable is checked first.
If that's set, certificates are loaded from the path specified by that variable,
or an error is returned if certificates cannot be loaded from the given path.
If it's not set, then the platform-specific certificate source is used.schannel
crate is used to access
the Windows certificate store APIs.security-framework
crate is used to access the keystore APIs.openssl-probe
crate is used to discover
the filename of the system CA bundle.rustls-native-certs is currently in development.
If you'd like to help out, please see CONTRIBUTING.md.
load_native_certs
now returns Vec<pki_types::CertificateDer<'static>>
instead of Vec<Certificate>
Certificate
newtype has been removed.AsRef<[u8]>
for Certificate
.SSL_CERT_FILE
on all platforms.This library exposes a single function with this signature:
pub fn load_native_certs() -> Result<Vec<pki_types::CertificateDer<'static>>, std::io::Error>
On success, this returns a Vec<pki_types::CertificateDer<'static>>
loaded with a
snapshot of the root certificates found on this platform. This
function fails in a platform-specific way, expressed in a std::io::Error
.
This function can be expensive: on some platforms it involves loading and parsing a ~300KB disk file. It's therefore prudent to call this sparingly.
See examples/google.rs
.
webpki-roots
?(Background: webpki-roots is a crate that compiles-in Mozilla's set of root certificates.)
This crate is preferable in many ways to webpki-roots. To sum up the pros and cons:
Pros:
Cons:
ca-certificates
package on debian-based Linux distributions is poor.
At the time of writing, this ships many certificates not included in the Mozilla
set, either because they failed an audit and were withdrawn or
were removed for mississuance.rustls-native-certs is distributed under the following three licenses:
These are included as LICENSE-APACHE, LICENSE-MIT and LICENSE-ISC respectively. You may use this software under the terms of any of these licenses, at your option.