pub fn custom_provider(
cipher_suites: Vec<SupportedCipherSuite>,
kx_groups: Vec<&'static dyn SupportedKxGroup>,
) -> CryptoProvider
Expand description
Create a CryptoProvider with specific cipher suites and key exchange groups
The specified cipher suites and key exchange groups should be defined in descending order of preference. i.e the first elements have the highest priority during negotiation.
If the fips
feature is enabled then fips mode will be enabled for OpenSSL, and this function will panic if this fails.
Sample usage:
use rustls::{ClientConfig, RootCertStore};
use rustls_openssl::custom_provider;
use rustls_openssl::cipher_suite::TLS13_AES_128_GCM_SHA256;
use rustls_openssl::kx_group::SECP256R1;
use std::sync::Arc;
use webpki_roots;
let mut root_store = RootCertStore {
roots: webpki_roots::TLS_SERVER_ROOTS.iter().cloned().collect(),
};
// Set custom config of cipher suites that have been imported from rustls_openssl.
let cipher_suites = vec![TLS13_AES_128_GCM_SHA256];
let kx_group = vec![SECP256R1];
let mut config =
ClientConfig::builder_with_provider(Arc::new(custom_provider(
cipher_suites, kx_group)))
.with_safe_default_protocol_versions()
.unwrap()
.with_root_certificates(root_store)
.with_no_client_auth();