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.

DESCRIPTION

A client application may request that a server send back an OCSP status
response (also known as OCSP stapling). To do so the client should call
the SSL_set_tlsext_status_type() function prior to the start of the
handshake. Currently the only supported type is
TLSEXT_STATUSTYPE_ocsp. This value should be passed in the type
argument. The client should additionally provide a callback function to
decide what to do with the returned OCSP response by calling
SSL_CTX_set_tlsext_status_cb(). The callback function should determine
whether the returned OCSP response is acceptable or not. The callback
will be passed as an argument the value previously set via a call to
SSL_CTX_set_tlsext_status_arg(). Note that the callback will not be
called in the event of a handshake where session resumption occurs
(because there are no Certificates exchanged in such a handshake).
The response returned by the server can be obtained via a call to
SSL_get_tlsext_status_ocsp_resp(). The value *resp will be updated to
point to the OCSP response data and the return value will be the length
of that data. Typically a callback would obtain an OCSP_RESPONSE
object from this data via a call to the d2i_OCSP_RESPONSE() function.
If the server has not provided any response data then *resp will be
NULL and the return value from SSL_get_tlsext_status_ocsp_resp() will
be -1.
A server application must also call the SSL_CTX_set_tlsext_status_cb()
function if it wants to be able to provide clients with OCSP
Certificate Status responses. Typically the server callback would
obtain the server certificate that is being sent back to the client via
a call to SSL_get_certificate(); obtain the OCSP response to be sent
back; and then set that response data by calling
SSL_set_tlsext_status_ocsp_resp(). A pointer to the response data
should be provided in the resp argument, and the length of that data
should be in the len argument.

RETURN VALUES

The callback when used on the client side should return a negative
value on error; 0 if the response is not acceptable (in which case the
handshake will fail) or a positive value if it is acceptable.
The callback when used on the server side should return with either
SSL_TLSEXT_ERR_OK (meaning that the OCSP response that has been set
should be returned), SSL_TLSEXT_ERR_NOACK (meaning that an OCSP
response should not be returned) or SSL_TLSEXT_ERR_ALERT_FATAL (meaning
that a fatal error has occurred).
SSL_CTX_set_tlsext_status_cb(), SSL_CTX_set_tlsext_status_arg(),
SSL_set_tlsext_status_type() and SSL_set_tlsext_status_ocsp_resp()
return 0 on error or 1 on success.
SSL_get_tlsext_status_ocsp_resp() returns the length of the OCSP
response data or -1 if there is no OCSP response data.
1.0.2h 2016-05-03 SSL_CTX_set_tlsext_status_cb(3)