pub struct ClientBuilder { /* private fields */ }
Expand description

A builder type to simplify the creation of client side SslStreams.

Implementations§

source§

impl ClientBuilder

source

pub fn new() -> Self

Creates a new builder with default options.

source

pub fn anchor_certificates(&mut self, certs: &[SecCertificate]) -> &mut Self

Specifies the set of root certificates to trust when verifying the server’s certificate.

source

pub fn add_anchor_certificate(&mut self, certs: &SecCertificate) -> &mut Self

Add the certificate the set of root certificates to trust when verifying the server’s certificate.

source

pub fn trust_anchor_certificates_only(&mut self, only: bool) -> &mut Self

Specifies whether to trust the built-in certificates in addition to specified anchor certificates.

source

pub fn danger_accept_invalid_certs(&mut self, noverify: bool) -> &mut Self

Specifies whether to trust invalid certificates.

Warning

You should think very carefully before using this method. If invalid certificates are trusted, any certificate for any site will be trusted for use. This includes expired certificates. This introduces significant vulnerabilities, and should only be used as a last resort.

source

pub fn use_sni(&mut self, use_sni: bool) -> &mut Self

Specifies whether to use Server Name Indication (SNI).

source

pub fn danger_accept_invalid_hostnames( &mut self, danger_accept_invalid_hostnames: bool ) -> &mut Self

Specifies whether to verify that the server’s hostname matches its certificate.

Warning

You should think very carefully before using this method. If hostnames are not verified, any valid certificate for any site will be trusted for use. This introduces significant vulnerabilities, and should only be used as a last resort.

source

pub fn whitelist_ciphers( &mut self, whitelisted_ciphers: &[CipherSuite] ) -> &mut Self

Set a whitelist of enabled ciphers. Any ciphers not whitelisted will be disabled.

source

pub fn blacklist_ciphers( &mut self, blacklisted_ciphers: &[CipherSuite] ) -> &mut Self

Set a blacklist of disabled ciphers. Blacklisted ciphers will be disabled.

source

pub fn identity( &mut self, identity: &SecIdentity, chain: &[SecCertificate] ) -> &mut Self

Use the specified identity as a SSL/TLS client certificate.

source

pub fn protocol_min(&mut self, min: SslProtocol) -> &mut Self

Configure the minimum protocol that this client will support.

source

pub fn protocol_max(&mut self, max: SslProtocol) -> &mut Self

Configure the minimum protocol that this client will support.

source

pub fn handshake<S>( &self, domain: &str, stream: S ) -> Result<SslStream<S>, ClientHandshakeError<S>>where S: Read + Write,

Initiates a new SSL/TLS session over a stream connected to the specified domain.

If both SNI and hostname verification are disabled, the value of domain will be ignored.

Trait Implementations§

source§

impl Debug for ClientBuilder

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for ClientBuilder

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.