SSL_CTX_set_session_id_context 3 2005-03-25 0.9.9-dev OpenSSL
NAME
SSL_CTX_set_session_id_context, SSL_set_session_id_context - set context within which session can be reused (server side only)
LIBRARY
libcrypto, -lcrypto
SYNOPSIS
#include
int SSL_CTX_set_session_id_context(SSL_CTX *ctx, const unsigned char *sid_ctx,
unsigned int sid_ctx_len);
int SSL_set_session_id_context(SSL *ssl, const unsigned char *sid_ctx,
unsigned int sid_ctx_len);
DESCRIPTION
_S_S_L___C_T_X___s_e_t___s_e_s_s_i_o_n___i_d___c_o_n_t_e_x_t_(_) sets the context ssiidd__ccttxx of length
ssiidd__ccttxx__lleenn within which a session can be reused for the ccttxx object.
_S_S_L___s_e_t___s_e_s_s_i_o_n___i_d___c_o_n_t_e_x_t_(_) sets the context ssiidd__ccttxx of length
ssiidd__ccttxx__lleenn within which a session can be reused for the ssssll object.
NOTES
Sessions are generated within a certain context. When exporting/importing
sessions with ii22dd__SSSSLL__SSEESSSSIIOONN/dd22ii__SSSSLL__SSEESSSSIIOONN it would be possible,
to re-import a session generated from another context (e.g. another
application), which might lead to malfunctions. Therefore each application
must set its own session id context ssiidd__ccttxx which is used to distinguish
the contexts and is stored in exported sessions. The ssiidd__ccttxx can be
any kind of binary data with a given length, it is therefore possible
to use e.g. the name of the application and/or the hostname and/or service
name ...
The session id context becomes part of the session. The session id context
is set by the SSL/TLS server. The _S_S_L___C_T_X___s_e_t___s_e_s_s_i_o_n___i_d___c_o_n_t_e_x_t_(_) and
_S_S_L___s_e_t___s_e_s_s_i_o_n___i_d___c_o_n_t_e_x_t_(_) functions are therefore only useful on the
server side.
OpenSSL clients will check the session id context returned by the server
when reusing a session.
The maximum length of the ssiidd__ccttxx is limited to
SSSSLL__MMAAXX__SSSSLL__SSEESSSSIIOONN__IIDD__LLEENNGGTTHH.
WARNINGS
If the session id context is not set on an SSL/TLS server and client
certificates are used, stored sessions
will not be reused but a fatal error will be flagged and the handshake
will fail.
If a server returns a different session id context to an OpenSSL client
when reusing a session, an error will be flagged and the handshake will
fail. OpenSSL servers will always return the correct session id context,
as an OpenSSL server checks the session id context itself before reusing
a session as described above.
RETURN VALUES
_S_S_L___C_T_X___s_e_t___s_e_s_s_i_o_n___i_d___c_o_n_t_e_x_t_(_) and _S_S_L___s_e_t___s_e_s_s_i_o_n___i_d___c_o_n_t_e_x_t_(_)
return the following values:
-
0
The length ssiidd__ccttxx__lleenn of the session id context ssiidd__ccttxx exceeded
-
the maximum allowed length of SSSSLL__MMAAXX__SSSSLL__SSEESSSSIIOONN__IIDD__LLEENNGGTTHH. The error
is logged to the error stack.
-
1
The operation succeeded.
-
SEE ALSO
_s_s_l(3)