Skip to main content

Module tls

Module tls 

Source
Available on crate feature tls-rustls only.
Expand description

TLS connector via rustls, and the HTTP client every HTTP call shares.

When the tls-rustls feature is enabled, this module provides HTTPS support using [hyper_rustls]. No OpenSSL system dependency is required.

§What is trusted

default_tls_config trusts Mozilla’s roots (webpki-roots) plus, when set, the PEM certificates in the file SSL_CERT_FILE names and in the directory SSL_CERT_DIR names (each a :-separated list on Unix), the variables curl, OpenSSL and Go read. That is how a container image’s CA bundle (SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt), a corporate TLS-inspecting proxy’s root, or a cluster’s private CA reaches every HTTP call the client makes without code. A file that cannot be read or parsed is reported once and skipped; it never removes Mozilla’s roots.

In code, tls_config_from_pem builds a config with extra roots and, for mutual TLS, a client certificate, and ClientBuilder::with_tls_config gives it to the client. Until 2026-10-29 the JSON-RPC and HTTP+JSON transports ignored every TLS setting and trusted Mozilla’s roots only, so an agent behind a private CA could not be reached over either (audit B-01).

§Proxies

HttpsClient goes through the proxy HTTPS_PROXY, HTTP_PROXY, ALL_PROXY and NO_PROXY name (see the crate’s proxy module docs).

Structs§

ClientConfig
Common configuration for (typically) all connections made by a program.
HttpsClient
The HTTPS-capable HTTP client the transports, card discovery, JWKS and the token provider use: rustls, and the environment’s proxy.

Functions§

build_https_client_with_config
Builds an HTTPS-capable hyper client using a custom TLS configuration and the default connection timeout.
build_https_client_with_connect_timeout
Builds an HTTPS-capable hyper client with a custom TLS configuration and connection timeout applied to the underlying TCP connector.
default_tls_config
Builds a default ClientConfig with Mozilla root certificates.
tls_config_from_pem
Builds a ClientConfig from PEM: extra roots and a client identity.
tls_config_with_extra_roots
Builds a ClientConfig with extra CA certificates added to the roots default_tls_config trusts.