MirBSD manpage: SSL_CTX_set_session_id_context(3), SSL_set_session_id_context(3)



     SSL_CTX_set_session_id_context, SSL_set_session_id_context -
     set context within which session can be reused (server side


      #include <openssl/ssl.h>

      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);


     SSL_CTX_set_session_id_context() sets the context sid_ctx of
     length sid_ctx_len within which a session can be reused for
     the ctx object.

     SSL_set_session_id_context() sets the context sid_ctx of
     length sid_ctx_len within which a session can be reused for
     the ssl object.


     Sessions are generated within a certain context. When
     exporting/importing sessions with
     i2d_SSL_SESSION/d2i_SSL_SESSION 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 con-
     text sid_ctx which is used to distinguish the contexts and
     is stored in exported sessions. The sid_ctx 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 ses-
     sion id context is set by the SSL/TLS server. The
     SSL_CTX_set_session_id_context() and
     SSL_set_session_id_context() 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 sid_ctx is limited to


     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.

MirBSD #10-current         2014-11-26                           1


     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.


     SSL_CTX_set_session_id_context() and
     SSL_set_session_id_context() return the following values:

     0   The length sid_ctx_len of the session id context sid_ctx
         exceeded the maximum allowed length of
         SSL_MAX_SSL_SESSION_ID_LENGTH. The error is logged to
         the error stack.

     1   The operation succeeded.



MirBSD #10-current         2014-11-26                           2

Generated on 2022-12-24 01:00:14 by $MirOS: src/scripts/roff2htm,v 1.113 2022/12/21 23:14:31 tg Exp $ — This product includes material provided by mirabilos.

These manual pages and other documentation are copyrighted by their respective writers; their sources are available at the project’s CVSweb, AnonCVS and other mirrors. The rest is Copyright © 2002–2022 MirBSD.

This manual page’s HTML representation is supposed to be valid XHTML/1.1; if not, please send a bug report — diffs preferred.

Kontakt / Impressum & Datenschutzerklärung