Function rustls::crypto::default_fips_provider

source ยท
pub fn default_fips_provider() -> CryptoProvider
Available on crate feature fips only.
Expand description

This function returns a CryptoProvider that uses FIPS140-3-approved cryptography.

Using this function expresses in your code that you require FIPS-approved cryptography, and will not compile if you make a mistake with cargo features.

See our FIPS documentation for more detail.

Install this as the process-default provider, like:

rustls::crypto::default_fips_provider().install_default()
    .expect("default provider already set elsewhere");

You can also use this explicitly, like:

let config = rustls::ClientConfig::builder_with_provider(
        rustls::crypto::default_fips_provider().into()
    )
    .with_safe_default_protocol_versions()
    .unwrap()
    .with_root_certificates(root_store)
    .with_no_client_auth();