MCPcopy Index your code
hub / github.com/RustPython/RustPython / create_custom_crypto_provider

Function create_custom_crypto_provider

crates/stdlib/src/ssl/compat.rs:662–676  ·  view source on GitHub ↗

Create custom CryptoProvider with specified cipher suites and key exchange groups This helper function consolidates the duplicated CryptoProvider creation logic for both server and client configurations.

(
    cipher_suites: Option<Vec<rustls::SupportedCipherSuite>>,
    kx_groups: Option<Vec<&'static dyn rustls::crypto::SupportedKxGroup>>,
)

Source from the content-addressed store, hash-verified

660/// This helper function consolidates the duplicated CryptoProvider creation logic
661/// for both server and client configurations.
662fn create_custom_crypto_provider(
663 cipher_suites: Option<Vec<rustls::SupportedCipherSuite>>,
664 kx_groups: Option<Vec<&'static dyn rustls::crypto::SupportedKxGroup>>,
665) -> Arc<rustls::crypto::CryptoProvider> {
666 use rustls::crypto::aws_lc_rs::{ALL_CIPHER_SUITES, ALL_KX_GROUPS};
667 let default_provider = rustls::crypto::aws_lc_rs::default_provider();
668
669 Arc::new(rustls::crypto::CryptoProvider {
670 cipher_suites: cipher_suites.unwrap_or_else(|| ALL_CIPHER_SUITES.to_vec()),
671 kx_groups: kx_groups.unwrap_or_else(|| ALL_KX_GROUPS.to_vec()),
672 signature_verification_algorithms: default_provider.signature_verification_algorithms,
673 secure_random: default_provider.secure_random,
674 key_provider: default_provider.key_provider,
675 })
676}
677
678/// Create a server TLS configuration
679///

Callers 2

create_server_configFunction · 0.85
create_client_configFunction · 0.85

Calls 2

newFunction · 0.85
to_vecMethod · 0.80

Tested by

no test coverage detected