DragonFly On-Line Manual Pages

Search:
Section:

ssl(3) OpenSSL ssl(3)

NAME

SSL - OpenSSL SSL/TLS library

SYNOPSIS

DESCRIPTION

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.
At first the library must be initialized; see SSL_library_init(3).
Then 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.
Then the TLS/SSL handshake is performed using SSL_accept(3) or
SSL_connect(3) respectively. SSL_read(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.

DATA STRUCTURES

Currently the OpenSSL ssl library functions deals with the following
data structures:
SSL_METHOD (SSL Method)
That's a dispatch structure describing the internal ssl library
methods/functions which implement the various protocol versions
(SSLv1, SSLv2 and TLSv1). It's needed to create an SSL_CTX.
SSL_CIPHER (SSL Cipher)
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 actually used
ones are then part of the SSL_SESSION.
SSL_CTX (SSL Context)
That's 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.
SSL_SESSION (SSL Session)
This is a structure containing the current TLS/SSL session details
for a connection: SSL_CIPHERs, client and server certificates,
keys, etc.
SSL (SSL Connection)
That's 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. Under run-time the application usually
deals with this structure which has links to mostly all other
structures.

HEADER FILES

Currently the OpenSSL ssl library provides the following C header files
containing the prototypes for the data structures and and functions:
ssl.h
That's 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.
ssl2.h
That's the sub header file dealing with the SSLv2 protocol only.
Usuallyyoudon'thavetoincludeitexplicitlybecauseit'salreadyincludedbyssl.h.
ssl3.h
That's the sub header file dealing with the SSLv3 protocol only.
Usuallyyoudon'thavetoincludeitexplicitlybecauseit'salreadyincludedbyssl.h.
ssl23.h
That's the sub header file dealing with the combined use of the
SSLv2 and SSLv3 protocols. Usuallyyoudon'thavetoincludeitexplicitlybecauseit'salreadyincludedbyssl.h.
tls1.h
That's the sub header file dealing with the TLSv1 protocol only.
Usuallyyoudon'thavetoincludeitexplicitlybecauseit'salreadyincludedbyssl.h.

NAME

SYNOPSIS

#include <openssl/ssl.h>
long SSL_CTX_set_timeout(SSL_CTX *ctx, long t);
long SSL_CTX_get_timeout(SSL_CTX *ctx);

DESCRIPTION

SSL_CTX_set_timeout() sets the timeout for newly created sessions for
ctx to t. The timeout value t must be given in seconds.
SSL_CTX_get_timeout() returns the currently set timeout value for ctx.

NOTES

Whenever a new session is created, it is assigned a maximum lifetime.
This lifetime is specified by storing the creation time of the session
and the timeout value valid at this time. If the actual time is later
than creation time plus timeout, the session is not reused.
Due to this realization, all sessions behave according to the timeout
value valid at the time of the session negotiation. Changes of the
timeout value do not affect already established sessions.
The expiration time of a single session can be modified using the
SSL_SESSION_get_time(3) family of functions.
Expired sessions are removed from the internal session cache, whenever
SSL_CTX_flush_sessions(3) is called, either directly by the application
or automatically (see SSL_CTX_set_session_cache_mode(3))
The default value for session timeout is decided on a per protocol
basis, see SSL_get_default_timeout(3). All currently supported
protocols have the same default timeout value of 300 seconds.

RETURN VALUES

SSL_CTX_set_timeout() returns the previously set timeout value.
SSL_CTX_get_timeout() returns the currently set timeout value.