Crates.io | rustls-native-certs |
lib.rs | rustls-native-certs |
version | 0.8.1 |
source | src |
created_at | 2019-11-04 21:10:51.429223 |
updated_at | 2024-11-21 15:42:54.624993 |
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 | 97,296 |
rustls-native-certs allows rustls to use the platform's native certificate store when operating as a TLS client.
[!IMPORTANT] Instead of this crate, we suggest using rustls-platform-verifier, which provides a more robust solution with a simpler API. This crate is still maintained, but mostly for use inside the platform verifier on platforms where no other solution is available. For more context, see deployment considerations.
rustls-native-certs is mature and widely used.
If you'd like to help out, please see CONTRIBUTING.md.
Release notes can be found on GitHub.
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.
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.See examples/google.rs
.
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.