DOKK / manpages / debian 10 / openssl / ssl.7ssl.en
SSL(7SSL) OpenSSL SSL(7SSL)

ssl - OpenSSL SSL/TLS library

See the individual manual pages for details.

The OpenSSL ssl library implements the Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) protocols. It provides a rich API which is documented here.

An SSL_CTX object is created as a framework to establish TLS/SSL enabled connections (see SSL_CTX_new(3)). Various options regarding certificates, algorithms etc. can be set in this object.

When a network connection has been created, it can be assigned to an SSL object. After the SSL object has been created using SSL_new(3), SSL_set_fd(3) or SSL_set_bio(3) can be used to associate the network connection with the object.

When the TLS/SSL handshake is performed using SSL_accept(3) or SSL_connect(3) respectively. SSL_read_ex(3), SSL_read(3), SSL_write_ex(3) and SSL_write(3) are used to read and write data on the TLS/SSL connection. SSL_shutdown(3) can be used to shut down the TLS/SSL connection.

Currently the OpenSSL ssl library functions deals with the following data structures:

This is a dispatch structure describing the internal ssl library methods/functions which implement the various protocol versions (SSLv3 TLSv1, ...). It's needed to create an SSL_CTX.
This structure holds the algorithm information for a particular cipher which are a core part of the SSL/TLS protocol. The available ciphers are configured on a SSL_CTX basis and the actual ones used are then part of the SSL_SESSION.
This is the global context structure which is created by a server or client once per program life-time and which holds mainly default values for the SSL structures which are later created for the connections.
This is a structure containing the current TLS/SSL session details for a connection: SSL_CIPHERs, client and server certificates, keys, etc.
This is the main SSL/TLS structure which is created by a server or client per established connection. This actually is the core structure in the SSL API. At run-time the application usually deals with this structure which has links to mostly all other structures.

Currently the OpenSSL ssl library provides the following C header files containing the prototypes for the data structures and functions:

This is the common header file for the SSL/TLS API. Include it into your program to make the API of the ssl library available. It internally includes both more private SSL headers and headers from the crypto library. Whenever you need hard-core details on the internals of the SSL API, look inside this header file.
Unused. Present for backwards compatibility only.
This is the sub header file dealing with the SSLv3 protocol only. Usually you don't have to include it explicitly because it's already included by ssl.h.
This is the sub header file dealing with the TLSv1 protocol only. Usually you don't have to include it explicitly because it's already included by ssl.h.

Currently the OpenSSL ssl library exports 214 API functions. They are documented in the following:

Here we document the various API functions which deal with the SSL/TLS protocol methods defined in SSL_METHOD structures.

Constructor for the version-flexible SSL_METHOD structure for clients, servers or both. See SSL_CTX_new(3) for details.
Constructor for the version-flexible SSL_METHOD structure for clients. Must be used to support the TLSv1.3 protocol.
Constructor for the version-flexible SSL_METHOD structure for servers. Must be used to support the TLSv1.3 protocol.
Constructor for the TLSv1.2 SSL_METHOD structure for clients, servers or both.
Constructor for the TLSv1.2 SSL_METHOD structure for clients.
Constructor for the TLSv1.2 SSL_METHOD structure for servers.
Constructor for the TLSv1.1 SSL_METHOD structure for clients, servers or both.
Constructor for the TLSv1.1 SSL_METHOD structure for clients.
Constructor for the TLSv1.1 SSL_METHOD structure for servers.
Constructor for the TLSv1 SSL_METHOD structure for clients, servers or both.
Constructor for the TLSv1 SSL_METHOD structure for clients.
Constructor for the TLSv1 SSL_METHOD structure for servers.
Constructor for the SSLv3 SSL_METHOD structure for clients, servers or both.
Constructor for the SSLv3 SSL_METHOD structure for clients.
Constructor for the SSLv3 SSL_METHOD structure for servers.

Here we document the various API functions which deal with the SSL/TLS ciphers defined in SSL_CIPHER structures.

Write a string to buf (with a maximum size of len) containing a human readable description of cipher. Returns buf.
Determine the number of bits in cipher. Because of export crippled ciphers there are two bits: The bits the algorithm supports in general (stored to alg_bits) and the bits which are actually used (the return value).
Return the internal name of cipher as a string. These are the various strings defined by the SSL3_TXT_xxx and TLS1_TXT_xxx definitions in the header files.
Returns a string like ""SSLv3"" or ""TLSv1.2"" which indicates the SSL/TLS protocol version to which cipher belongs (i.e. where it was defined in the specification the first time).

Here we document the various API functions which deal with the SSL/TLS protocol context defined in the SSL_CTX structure.

Use the default paths to locate trusted CA certificates. There is one default directory path and one default file path. Both are set via this call.
Use the default directory path to locate trusted CA certificates.
Use the file path to locate trusted CA certificates.

Here we document the various API functions which deal with the SSL/TLS sessions defined in the SSL_SESSION structures.

Here we document the various API functions which deal with the SSL/TLS connection defined in the SSL structure.

Sets the session details for t to be the same as in f. Returns 1 on success or 0 on failure.
SSL_dup() allows applications to configure an SSL handle for use in multiple SSL connections, and then duplicate it prior to initiating each connection with the duplicated handle. Use of SSL_dup() avoids the need to repeat the configuration of the handles for each connection.

For SSL_dup() to work, the connection MUST be in its initial state and MUST NOT have not yet have started the SSL handshake. For connections that are not in their initial state SSL_dup() just increments an internal reference count and returns the same handle. It may be possible to use SSL_clear(3) to recycle an SSL handle that is not in its initial state for re-use, but this is best avoided. Instead, save and restore the session, if desired, and construct a fresh handle for each connection.

Returns the current handshake state.

See the individual manual pages for details.

openssl(1), crypto(7), CRYPTO_get_ex_new_index(3), SSL_accept(3), SSL_clear(3), SSL_connect(3), SSL_CIPHER_get_name(3), SSL_COMP_add_compression_method(3), SSL_CTX_add_extra_chain_cert(3), SSL_CTX_add_session(3), SSL_CTX_ctrl(3), SSL_CTX_flush_sessions(3), SSL_CTX_get_verify_mode(3), SSL_CTX_load_verify_locations(3) SSL_CTX_new(3), SSL_CTX_sess_number(3), SSL_CTX_sess_set_cache_size(3), SSL_CTX_sess_set_get_cb(3), SSL_CTX_sessions(3), SSL_CTX_set_cert_store(3), SSL_CTX_set_cert_verify_callback(3), SSL_CTX_set_cipher_list(3), SSL_CTX_set_client_CA_list(3), SSL_CTX_set_client_cert_cb(3), SSL_CTX_set_default_passwd_cb(3), SSL_CTX_set_generate_session_id(3), SSL_CTX_set_info_callback(3), SSL_CTX_set_max_cert_list(3), SSL_CTX_set_mode(3), SSL_CTX_set_msg_callback(3), SSL_CTX_set_options(3), SSL_CTX_set_quiet_shutdown(3), SSL_CTX_set_read_ahead(3), SSL_CTX_set_security_level(3), SSL_CTX_set_session_cache_mode(3), SSL_CTX_set_session_id_context(3), SSL_CTX_set_ssl_version(3), SSL_CTX_set_timeout(3), SSL_CTX_set_tmp_dh_callback(3), SSL_CTX_set_verify(3), SSL_CTX_use_certificate(3), SSL_alert_type_string(3), SSL_do_handshake(3), SSL_enable_ct(3), SSL_get_SSL_CTX(3), SSL_get_ciphers(3), SSL_get_client_CA_list(3), SSL_get_default_timeout(3), SSL_get_error(3), SSL_get_ex_data_X509_STORE_CTX_idx(3), SSL_get_fd(3), SSL_get_peer_cert_chain(3), SSL_get_rbio(3), SSL_get_session(3), SSL_get_verify_result(3), SSL_get_version(3), SSL_load_client_CA_file(3), SSL_new(3), SSL_pending(3), SSL_read_ex(3), SSL_read(3), SSL_rstate_string(3), SSL_session_reused(3), SSL_set_bio(3), SSL_set_connect_state(3), SSL_set_fd(3), SSL_set_session(3), SSL_set_shutdown(3), SSL_shutdown(3), SSL_state_string(3), SSL_want(3), SSL_write_ex(3), SSL_write(3), SSL_SESSION_free(3), SSL_SESSION_get_time(3), d2i_SSL_SESSION(3), SSL_CTX_set_psk_client_callback(3), SSL_CTX_use_psk_identity_hint(3), SSL_get_psk_identity(3), DTLSv1_listen(3)

SSLv2_client_method, SSLv2_server_method and SSLv2_method were removed in OpenSSL 1.1.0.

The return type of SSL_copy_session_id was changed from void to int in OpenSSL 1.1.0.

Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the OpenSSL license (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.

2022-06-24 1.1.1n