pub struct TlsConnection<'a, Socket, CipherSuite> where
    Socket: AsyncRead + AsyncWrite + 'a,
    CipherSuite: TlsCipherSuite + 'static, 
{ /* private fields */ }
Expand description

Type representing an async TLS connection. An instance of this type can be used to establish a TLS connection, write and read encrypted data over this connection, and closing to free up the underlying resources.

Implementations

Create a new TLS connection with the provided context and a async I/O implementation

NOTE: The record buffer should be sized to fit an encrypted TLS record and the TLS handshake record. The maximum value of a TLS record is 16 kB, which should be a safe value to use.

Open a TLS connection, performing the handshake with the configuration provided when creating the connection instance.

The handshake may support certificates up to CERT_SIZE.

Returns an error if the handshake does not proceed. If an error occurs, the connection instance must be recreated.

Encrypt and send the provided slice over the connection. The connection must be opened before writing.

Returns the number of bytes written.

Read and decrypt data filling the provided slice. The slice must be able to keep the expected amount of data that can be received in one record to avoid loosing data.

Close a connection instance, returning the ownership of the config, random generator and the async I/O provider.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.