Struct telos::raw::TlsContext [] [src]

pub struct TlsContext {
    // some fields omitted
}

A structure that represents all TLS context

This can be a client connection, a server, or a connection accepted by the server

Methods

impl TlsContext

fn new_client() -> TlsResult<TlsContext>

Create a new client context

fn connect_servername(&mut self, hostname: &str, port: &str, servername: &str) -> TlsResult<()>

If port is empty, the port value is assumed to be part of the hostname string as host:port. If servername is not empty it is used instead of the hostname for verification.

fn connect_socket(&mut self, fd: RawFd, servername: &str) -> TlsResult<()>

Establish a TLS connection over the given socket

fn conn_version(&self) -> String

fn conn_cipher(&self) -> String

fn configure(&mut self, cfg: TlsConfig) -> TlsResult<()>

Apply configuration settings to the context, consuming the config struct

This should be called BEFORE trying to establish/accept a connection

fn peer_cert_notbefore(&self) -> TlsResult<DateTime<UTC>>

fn peer_cert_notafter(&self) -> TlsResult<DateTime<UTC>>

fn peer_cert_hash(&self) -> String

fn peer_cert_issuer(&self) -> String

fn peer_cert_subject(&self) -> String

fn peer_cert_contains_name(&self, name: &str) -> bool

fn peer_cert_provided(&self) -> bool

fn handshake(&mut self) -> TlsResult<()>

Complete the TLS handshake

This function will be called when needed by read() or write(), but can be called to complete the handshake.

fn close(&mut self) -> TlsResult<()>

fn read(&mut self, buf: &mut [u8]) -> TlsResult<usize>

fn write(&mut self, buf: &[u8]) -> TlsResult<usize>

fn new_server() -> TlsResult<TlsContext>

Create new server context

fn accept_socket(&mut self, fd: RawFd) -> TlsResult<TlsContext>

Accept a new TLS connection over an existing socket

Trait Implementations

impl Drop for TlsContext

fn drop(&mut self)