Rustls Crypto Provider Setup (src/lib.rs)

openinterpreter · codex-rs/utils/rustls-provider/src/lib.rs · rust · Apache-2.0
infra, security, lang:rust, tag:rustls, tag:crypto

Ensures a process-wide rustls crypto provider is installed once, preferring aws-lc-rs for broader TLS signature scheme support.

// Source: https://github.com/openinterpreter/openinterpreter | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
use std::sync::Once;

const REQUIRED_SIGNATURE_SCHEME: rustls::SignatureScheme =
    rustls::SignatureScheme::ECDSA_NISTP521_SHA512;

/// Ensures a process-wide rustls crypto provider is installed.
///
/// rustls cannot auto-select a provider when both `ring` and `aws-lc-rs`
/// features are enabled in the dependency graph.
pub fn ensure_rustls_crypto_provider() {
    static RUSTLS_PROVIDER_INIT: Once = Once::new();
    RUSTLS_PROVIDER_INIT.call_once(|| {
        // aws-lc-rs supports a broader WebPKI signature set than ring, including
        // ECDSA P-521/SHA-512 certs 

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key