Struct openssl::ssl::Ssl []

pub struct Ssl(_);

The state of an SSL/TLS session.

Ssl objects are created from an SslContext, which provides configuration defaults. These defaults can be overridden on a per-Ssl basis, however.

Methods

impl Ssl
[src]

[src]

Returns a new extra data index.

Each invocation of this function is guaranteed to return a distinct index. These can be used to store data in the context that can be retrieved later by callbacks, for example.

This corresponds to SSL_get_ex_new_index.

impl Ssl
[src]

[src]

Creates a new Ssl.

This corresponds to SSL_new.

[src]

Initiates a client-side TLS handshake.

This corresponds to SSL_connect.

Warning

OpenSSL's default configuration is insecure. It is highly recommended to use SslConnector rather than Ssl directly, as it manages that configuration.

[src]

Initiates a server-side TLS handshake.

This corresponds to SSL_accept.

Warning

OpenSSL's default configuration is insecure. It is highly recommended to use SslAcceptor rather than Ssl directly, as it manages that configuration.

Methods from Deref<Target = SslRef>

[src]

Like SslContextBuilder::set_verify.

This corresponds to SSL_set_verify.

[src]

[src]

Like SslContextBuilder::set_tmp_dh.

This corresponds to SSL_set_tmp_dh.

[src]

[src]

Like SslContextBuilder::set_tmp_ecdh.

This corresponds to SSL_set_tmp_ecdh.

[src]

Returns the current cipher if the session is active.

This corresponds to SSL_get_current_cipher.

[src]

Returns a short string describing the state of the session.

This corresponds to SSL_state_string.

[src]

Returns a longer string describing the state of the session.

This corresponds to SSL_state_string_long.

[src]

Sets the host name to be sent to the server for Server Name Indication (SNI).

It has no effect for a server-side connection.

This corresponds to SSL_set_tlsext_host_name.

[src]

Returns the peer's certificate, if present.

This corresponds to SSL_get_peer_certificate.

[src]

Returns the certificate chain of the peer, if present.

On the client side, the chain includes the leaf certificate, but on the server side it does not. Fun!

This corresponds to SSL_get_peer_cert_chain.

[src]

Like SslContext::certificate.

This corresponds to SSL_get_certificate.

[src]

Like SslContext::private_key.

This corresponds to SSL_get_privatekey.

[src]

Deprecated since 0.10.5

: renamed to version_str

[src]

Returns the protocol version of the session.

This corresponds to SSL_version.

[src]

Returns a string describing the protocol version of the session.

This corresponds to SSL_get_version.

[src]

Returns the protocol selected via Application Layer Protocol Negotiation (ALPN).

The protocol's name is returned is an opaque sequence of bytes. It is up to the client to interpret it.

Requires OpenSSL 1.0.2 or newer.

This corresponds to SSL_get0_alpn_selected.

[src]

Returns the number of bytes remaining in the currently processed TLS record.

If this is greater than 0, the next call to read will not call down to the underlying stream.

This corresponds to SSL_pending.

[src]

Returns the servername sent by the client via Server Name Indication (SNI).

It is only useful on the server side.

This corresponds to SSL_get_servername.

[src]

Changes the context corresponding to the current connection.

It is most commonly used in the Server Name Indication (SNI) callback.

This corresponds to SSL_set_SSL_CTX.

[src]

Returns the context corresponding to the current connection.

This corresponds to SSL_get_SSL_CTX.

[src]

Returns a mutable reference to the X509 verification configuration.

Requires OpenSSL 1.0.2 or newer.

This corresponds to SSL_get0_param.

[src]

Returns the certificate verification result.

This corresponds to SSL_get_verify_result.

[src]

Returns a shared reference to the SSL session.

This corresponds to SSL_get_session.

[src]

Copies the client_random value sent by the client in the TLS handshake into a buffer.

Returns the number of bytes copied, or if the buffer is empty, the size of the client_random value.

Requires OpenSSL 1.1.0 or newer.

This corresponds to SSL_get_client_random.

[src]

Copies the server_random value sent by the server in the TLS handshake into a buffer.

Returns the number of bytes copied, or if the buffer is empty, the size of the server_random value.

Requires OpenSSL 1.1.0 or newer.

This corresponds to SSL_get_server_random.

[src]

Derives keying material for application use in accordance to RFC 5705.

This corresponds to SSL_export_keying_material.

[src]

Sets the session to be used.

This should be called before the handshake to attempt to reuse a previously established session. If the server is not willing to reuse the session, a new one will be transparently negotiated.

This corresponds to SSL_set_session.

Safety

The caller of this method is responsible for ensuring that the session is associated with the same SslContext as this Ssl.

[src]

Determines if the session provided to set_session was successfully reused.

This corresponds to SSL_session_reused.

[src]

Sets the status response a client wishes the server to reply with.

This corresponds to SSL_set_tlsext_status_type.

[src]

Returns the server's OCSP response, if present.

This corresponds to SSL_get_tlsext_status_ocsp_resp.

[src]

Sets the OCSP response to be returned to the client.

This corresponds to SSL_set_tlsext_status_ocsp_resp.

[src]

Determines if this Ssl is configured for server-side or client-side use.

This corresponds to SSL_is_server.

[src]

Sets the extra data at the specified index.

This can be used to provide data to callbacks registered with the context. Use the Ssl::new_ex_index method to create an Index.

This corresponds to SSL_set_ex_data.

[src]

Returns a reference to the extra data at the specified index.

This corresponds to SSL_get_ex_data.

Trait Implementations

impl ForeignType for Ssl

The raw C type.

The type representing a reference to this type.

Constructs an instance of this type from its raw type.

Returns a raw pointer to the wrapped value.

impl Drop for Ssl

Executes the destructor for this type. Read more

impl Deref for Ssl

The resulting type after dereferencing.

Dereferences the value.

impl DerefMut for Ssl

Mutably dereferences the value.

impl Borrow<SslRef> for Ssl

Immutably borrows from an owned value. Read more

impl AsRef<SslRef> for Ssl

Performs the conversion.

impl Sync for Ssl
[src]

impl Send for Ssl
[src]

impl Debug for Ssl
[src]

[src]

Formats the value using the given formatter. Read more