[][src]Struct libtls::config::Builder

pub struct Builder { /* fields omitted */ }

Builder for Config.

Example

let mut config = Builder::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 Builder[src]

pub fn new() -> Self[src]

Return new Builder.

See also

Config

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

Build new Config object.

See also

Config

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

Build new Config object and return a configured Tls client.

See also

Tls, Config

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

Build new Config object and return a configured Tls server.

See also

Tls, Config

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

Set the ALPN protocols that are supported.

See also

Config::set_alpn

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

Set the CA file.

See also

Config::set_ca_file

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

Set the CA path.

See also

Config::set_ca_path

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

Set the CA from memory.

See also

Config::set_ca_mem

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

Set the list of cipher that may be used.

See also

Config::set_ciphers

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

Set the CRL file.

See also

Config::set_crl_file

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

Set the CRL from memory.

See also

Config::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

Config::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

Config::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

Config::add_keypair_file, Config::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

Config::set_keypair_mem, Config::set_keypair_mem

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

Disable certificate verification.

See also

Config::insecure_noverifycert

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

Disable server name verification.

See also

Config::insecure_noverifyname

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

Disable certificate validity checking.

See also

Config::insecure_noverifytime

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

Set which versions of the TLS protocol may be used.

See also

Config::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

Config::set_session_fd

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

Set the session identifier for TLS sessions.

See also

Config::set_session_id

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

Set the lifetime for TLS sessions.

See also

Config::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

Config::verify

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

Enable client certificate verification.

See also

Config::verify_client

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

Enable optional client certificate verification.

See also

Config::verify_client_optional

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

Set the certificate verification depth.

See also

Config::verify_depth

Trait Implementations

impl Clone for Builder[src]

impl Debug for Builder[src]

impl Default for Builder[src]

Auto Trait Implementations

impl RefUnwindSafe for Builder

impl Send for Builder

impl Sync for Builder

impl Unpin for Builder

impl UnwindSafe for Builder

Blanket Implementations

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

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

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

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

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

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

type Owned = T

The resulting type after obtaining ownership.

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.