pub struct ServerTLSConfigBuilder { /* private fields */ }Expand description
A TLS server configuration builder.
Exposes options for configuring a server’s TLS configuration by loading certificates and keys from PEM files on disk, and provides sane defaults for many common options.
§Missing
- ability to configure TLS key logging
- ability to configure minimum/maximum TLS protocol versions
- ability to configure cipher suites and curve preferences
Implementations§
Source§impl ServerTLSConfigBuilder
impl ServerTLSConfigBuilder
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new server TLS configuration builder with no certificates or keys configured.
Sourcepub fn with_cert_file<P: Into<PathBuf>>(self, path: P) -> Self
pub fn with_cert_file<P: Into<PathBuf>>(self, path: P) -> Self
Sets the path to the PEM-encoded certificate chain file.
The file may contain a single certificate (leaf) or a full certificate chain (leaf followed by intermediates). All certificates in the file are presented to clients during the TLS handshake.
Sourcepub fn with_key_file<P: Into<PathBuf>>(self, path: P) -> Self
pub fn with_key_file<P: Into<PathBuf>>(self, path: P) -> Self
Sets the path to the PEM-encoded private key file.
The private key must correspond to the leaf certificate in the certificate chain.
Sourcepub fn with_ca_file<P: Into<PathBuf>>(self, path: P) -> Self
pub fn with_ca_file<P: Into<PathBuf>>(self, path: P) -> Self
Sets the path to the PEM-encoded CA certificate file used to verify client certificates.
When set, the server requests client certificates and verifies them against the CA certificates in this file, but does not require a client certificate. If the client presents a certificate, it must be valid; if the client presents no certificate, the connection is still accepted.
The file may contain multiple CA certificates in PEM format.
Sourcepub fn build(self) -> Result<ServerConfig, GenericError>
pub fn build(self) -> Result<ServerConfig, GenericError>
Builds the server TLS configuration.
§Errors
If the certificate or key files cannot be read or parsed, or if the resulting configuration isn’t FIPS compliant, an error will be returned.
Auto Trait Implementations§
impl Freeze for ServerTLSConfigBuilder
impl RefUnwindSafe for ServerTLSConfigBuilder
impl Send for ServerTLSConfigBuilder
impl Sync for ServerTLSConfigBuilder
impl Unpin for ServerTLSConfigBuilder
impl UnwindSafe for ServerTLSConfigBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Track for T
impl<T> Track for T
Source§fn track_resources(self, token: ResourceGroupToken) -> Tracked<Self>
fn track_resources(self, token: ResourceGroupToken) -> Tracked<Self>
Tracked wrapper. Read moreSource§fn in_current_resource_group(self) -> Tracked<Self>
fn in_current_resource_group(self) -> Tracked<Self>
Tracked wrapper. Read more