pub struct TlsParametersBuilder { /* private fields */ }
smtp-transport
only.Expand description
Builder for TlsParameters
Implementations§
source§impl TlsParametersBuilder
impl TlsParametersBuilder
sourcepub fn certificate_store(self, cert_store: CertificateStore) -> Self
pub fn certificate_store(self, cert_store: CertificateStore) -> Self
Set the source for the base set of root certificates to trust.
sourcepub fn add_root_certificate(self, cert: Certificate) -> Self
pub fn add_root_certificate(self, cert: Certificate) -> Self
Add a custom root certificate
Can be used to safely connect to a server using a self signed certificate, for example.
sourcepub fn dangerous_accept_invalid_hostnames(
self,
accept_invalid_hostnames: bool
) -> Self
Available on crate features native-tls
or boring-tls
only.
pub fn dangerous_accept_invalid_hostnames( self, accept_invalid_hostnames: bool ) -> Self
native-tls
or boring-tls
only.Controls whether certificates with an invalid hostname are accepted
Defaults to false
.
§Warning
You should think very carefully before using this method. If hostname verification is disabled any valid certificate, including those from other sites, are trusted.
This method introduces significant vulnerabilities to man-in-the-middle attacks.
Hostname verification can only be disabled with the native-tls
TLS backend.
sourcepub fn set_min_tls_version(self, min_tls_version: TlsVersion) -> Self
pub fn set_min_tls_version(self, min_tls_version: TlsVersion) -> Self
Controls which minimum TLS version is allowed
Defaults to Tlsv12
.
sourcepub fn dangerous_accept_invalid_certs(self, accept_invalid_certs: bool) -> Self
pub fn dangerous_accept_invalid_certs(self, accept_invalid_certs: bool) -> Self
Controls whether invalid certificates are accepted
Defaults to false
.
§Warning
You should think very carefully before using this method. If certificate verification is disabled, any certificate is trusted for use, including:
- Self signed certificates
- Certificates from different hostnames
- Expired certificates
This method should only be used as a last resort, as it introduces significant vulnerabilities to man-in-the-middle attacks.
sourcepub fn build(self) -> Result<TlsParameters, Error>
Available on crate features native-tls
or rustls-tls
or boring-tls
only.
pub fn build(self) -> Result<TlsParameters, Error>
native-tls
or rustls-tls
or boring-tls
only.Creates a new TlsParameters
using native-tls, boring-tls or rustls
depending on which one is available
sourcepub fn build_native(self) -> Result<TlsParameters, Error>
Available on crate feature native-tls
only.
pub fn build_native(self) -> Result<TlsParameters, Error>
native-tls
only.Creates a new TlsParameters
using native-tls with the provided configuration
sourcepub fn build_boring(self) -> Result<TlsParameters, Error>
Available on crate feature boring-tls
only.
pub fn build_boring(self) -> Result<TlsParameters, Error>
boring-tls
only.Creates a new TlsParameters
using boring-tls with the provided configuration
sourcepub fn build_rustls(self) -> Result<TlsParameters, Error>
Available on crate feature rustls-tls
only.
pub fn build_rustls(self) -> Result<TlsParameters, Error>
rustls-tls
only.Creates a new TlsParameters
using rustls with the provided configuration
Trait Implementations§
source§impl Clone for TlsParametersBuilder
impl Clone for TlsParametersBuilder
source§fn clone(&self) -> TlsParametersBuilder
fn clone(&self) -> TlsParametersBuilder
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more