pub struct TlsConfig { /* private fields */ }Expand description
Strict server-certificate validation with optional client authentication.
Implementations§
Source§impl TlsConfig
impl TlsConfig
Sourcepub fn with_crypto_provider(self, provider: Arc<CryptoProvider>) -> Self
pub fn with_crypto_provider(self, provider: Arc<CryptoProvider>) -> Self
Selects this client’s rustls cryptography without changing global state.
Takes precedence over the application’s process default. The provider also loads and validates this client’s private key when the network configuration is validated or compiled.
Sourcepub fn crypto_provider(&self) -> Option<&Arc<CryptoProvider>>
pub fn crypto_provider(&self) -> Option<&Arc<CryptoProvider>>
Returns the explicitly selected provider, if any, without resolving defaults.
Sourcepub fn with_root_certificates(
self,
pem: impl AsRef<[u8]>,
mode: RootCertificateMode,
) -> Result<Self, NetError>
pub fn with_root_certificates( self, pem: impl AsRef<[u8]>, mode: RootCertificateMode, ) -> Result<Self, NetError>
Replaces the custom CA bundle and selects its trust mode. Accepts one to 128 PEM certificates with a total size of at most 1 MiB; malformed, mismatched, or trailing non-whitespace blocks are rejected.
Sourcepub fn with_client_identity(self, identity: ClientIdentity) -> Self
pub fn with_client_identity(self, identity: ClientIdentity) -> Self
Configures a client certificate identity.
Sourcepub fn root_mode(&self) -> RootCertificateMode
pub fn root_mode(&self) -> RootCertificateMode
Returns how custom roots are combined with built-in roots.
Sourcepub fn custom_root_count(&self) -> usize
pub fn custom_root_count(&self) -> usize
Returns the number of custom roots, excluding built-in WebPKI roots.
Sourcepub fn client_identity(&self) -> Option<&ClientIdentity>
pub fn client_identity(&self) -> Option<&ClientIdentity>
Returns the configured client identity, if any.