SSL_CTX_set_session_id_context(3) OpenSSL SSL_CTX_set_session_id_context(3) NNAAMMEE SSL_CTX_set_session_id_context, SSL_set_session_id_context - set con- text within which session can be reused (server side only) SSYYNNOOPPSSIISS #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); DDEESSCCRRIIPPTTIIOONN _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. NNOOTTEESS Sessions are generated within a certain context. When exporting/import- ing 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 applica- tion must set its own session id context ssiidd__ccttxx which is used to dis- tinguish 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 con- text 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__SSEESS-- SSIIOONN__IIDD__LLEENNGGTTHH. WWAARRNNIINNGGSS 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 con- text, as an OpenSSL server checks the session id context itself before reusing a session as described above. RREETTUURRNN VVAALLUUEESS _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. SSEEEE AALLSSOO _s_s_l(3) 1.0.2u 2019-12-20 SSL_CTX_set_session_id_context(3)