[][src]Struct libtls::config::TlsConfigBuilder

pub struct TlsConfigBuilder { /* fields omitted */ }

TlsConfigBuilder for TlsConfig.

Example

let mut config = TlsConfigBuilder::new()
    .keypair_mem(cert, key, None)
    .ticket_key(1, &ticket_key1)
    .ticket_key(2, &ticket_key2)
    .protocols(TLS_PROTOCOLS_ALL)
    .ecdhecurves("X25519")
    .alpn("h2")
    .build()?;

Methods

impl TlsConfigBuilder[src]

pub fn new() -> Self[src]

Return new TlsConfigBuilder.

See also

TlsConfig

pub fn build(&self) -> Result<TlsConfig>[src]

Build new TlsConfig object.

See also

TlsConfig

pub fn client(&self) -> Result<Tls>[src]

Build new TlsConfig object and return a configured Tls client.

See also

Tls, TlsConfig

pub fn server(&self) -> Result<Tls>[src]

Build new TlsConfig object and return a configured Tls server.

See also

Tls, TlsConfig

pub fn alpn(&mut self, alpn: &str) -> &mut Self[src]

Set the ALPN protocols that are supported.

See also

TlsConfig::set_alpn

pub fn ca_file<P: AsRef<Path>>(&mut self, path: P) -> &mut Self[src]

pub fn ca_path<P: AsRef<Path>>(&mut self, path: P) -> &mut Self[src]

pub fn ca_mem(&mut self, mem: &[u8]) -> &mut Self[src]

Set the CA from memory.

See also

TlsConfig::set_ca_mem

pub fn ciphers(&mut self, ciphers: &str) -> &mut Self[src]

Set the list of cipher that may be used.

See also

TlsConfig::set_ciphers

pub fn crl_file<P: AsRef<Path>>(&mut self, path: P) -> &mut Self[src]

pub fn crl_mem(&mut self, mem: &[u8]) -> &mut Self[src]

Set the CRL from memory.

See also

TlsConfig::set_crl_mem

pub fn dheparams(&mut self, dheparams: &str) -> &mut Self[src]

Set the parameters of an Diffie-Hellman Ephemeral (DHE) key exchange.

See also

TlsConfig::set_dheparams

pub fn ecdhecurves(&mut self, ecdhecurves: &str) -> &mut Self[src]

Set the curves of an Elliptic Curve Diffie-Hellman Ephemeral (ECDHE) key exchange.

See also

TlsConfig::set_ecdhecurves

pub fn keypair_file<P: AsRef<Path>>(
    &mut self,
    cert: P,
    key: P,
    ocsp_staple: Option<P>
) -> &mut Self
[src]

Add additional files of a public and private key pair and OCSP staple.

See also

TlsConfig::add_keypair_file, TlsConfig::set_keypair_file

pub fn keypair_mem(
    &mut self,
    cert: &[u8],
    key: &[u8],
    ocsp_staple: Option<&[u8]>
) -> &mut Self
[src]

Add an additional public and private key pair and OCSP staple from memory.

See also

TlsConfig::set_keypair_mem, TlsConfig::set_keypair_mem

pub fn noverifycert(&mut self) -> &mut Self[src]

Disable certificate verification.

See also

TlsConfig::insecure_noverifycert

pub fn noverifyname(&mut self) -> &mut Self[src]

Disable server name verification.

See also

TlsConfig::insecure_noverifyname

pub fn noverifytime(&mut self) -> &mut Self[src]

Disable certificate validity checking.

See also

TlsConfig::insecure_noverifytime

pub fn protocols(&mut self, protocols: u32) -> &mut Self[src]

Set which versions of the TLS protocol may be used.

See also

TlsConfig::set_protocols

pub fn session_fd(&mut self, fd: RawFd) -> &mut Self[src]

Set a file descriptor to manage data for TLS sessions.

See also

TlsConfig::set_session_fd

pub fn session_id(&mut self, id: &[u8]) -> &mut Self[src]

Set the session identifier for TLS sessions.

See also

TlsConfig::set_session_id

pub fn session_lifetime(&mut self, lifetime: usize) -> &mut Self[src]

Set the lifetime for TLS sessions.

See also

TlsConfig::set_session_lifetime

pub fn ticket_key(&mut self, keyrev: u32, key: &[u8]) -> &mut Self[src]

pub fn verify(&mut self) -> &mut Self[src]

Enable all certificate verification.

See also

TlsConfig::verify

pub fn verify_client(&mut self) -> &mut Self[src]

Enable client certificate verification.

See also

TlsConfig::verify_client

pub fn verify_client_optional(&mut self) -> &mut Self[src]

Enable optional client certificate verification.

See also

TlsConfig::verify_client_optional

pub fn verify_depth(&mut self, depth: usize) -> &mut Self[src]

Set the certificate verification depth.

See also

TlsConfig::verify_depth

Trait Implementations

impl Default for TlsConfigBuilder[src]

impl Clone for TlsConfigBuilder[src]

impl Debug for TlsConfigBuilder[src]

Auto Trait Implementations

impl Send for TlsConfigBuilder

impl Unpin for TlsConfigBuilder

impl Sync for TlsConfigBuilder

impl UnwindSafe for TlsConfigBuilder

impl RefUnwindSafe for TlsConfigBuilder

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]