pub struct TlsParametersBuilder { /* private fields */ }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 identify_with(self, identity: Identity) -> Self
 
pub fn identify_with(self, identity: Identity) -> Self
Add a client certificate
Can be used to configure a client certificate to present to the server.
Sourcepub fn dangerous_accept_invalid_hostnames(
    self,
    accept_invalid_hostnames: bool,
) -> Self
 
pub fn dangerous_accept_invalid_hostnames( self, accept_invalid_hostnames: bool, ) -> Self
Controls whether certificates with an invalid hostname are accepted
This option is silently disabled when using rustls-platform-verifier.
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.
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>
 
pub fn build(self) -> Result<TlsParameters, Error>
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>
 
pub fn build_native(self) -> Result<TlsParameters, Error>
Creates a new TlsParameters using native-tls 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 moreAuto Trait Implementations§
impl Freeze for TlsParametersBuilder
impl RefUnwindSafe for TlsParametersBuilder
impl Send for TlsParametersBuilder
impl Sync for TlsParametersBuilder
impl Unpin for TlsParametersBuilder
impl UnwindSafe for TlsParametersBuilder
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> CloneToUninit for Twhere
    T: Clone,
 
impl<T> CloneToUninit for Twhere
    T: Clone,
Source§impl<T> IntoEither for T
 
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
 
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
 
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more