1SSL_CTX_set_session_id_context(3)   OpenSSL  SSL_CTX_set_session_id_context(3)
2
3
4

NAME

6       SSL_CTX_set_session_id_context, SSL_set_session_id_context - set
7       context within which session can be reused (server side only)
8

SYNOPSIS

10        #include <openssl/ssl.h>
11
12        int SSL_CTX_set_session_id_context(SSL_CTX *ctx, const unsigned char *sid_ctx,
13                                           unsigned int sid_ctx_len);
14        int SSL_set_session_id_context(SSL *ssl, const unsigned char *sid_ctx,
15                                       unsigned int sid_ctx_len);
16

DESCRIPTION

18       SSL_CTX_set_session_id_context() sets the context sid_ctx of length
19       sid_ctx_len within which a session can be reused for the ctx object.
20
21       SSL_set_session_id_context() sets the context sid_ctx of length
22       sid_ctx_len within which a session can be reused for the ssl object.
23

NOTES

25       Sessions are generated within a certain context. When
26       exporting/importing sessions with i2d_SSL_SESSION/d2i_SSL_SESSION it
27       would be possible, to re-import a session generated from another
28       context (e.g. another application), which might lead to malfunctions.
29       Therefore each application must set its own session id context sid_ctx
30       which is used to distinguish the contexts and is stored in exported
31       sessions. The sid_ctx can be any kind of binary data with a given
32       length, it is therefore possible to use e.g. the name of the
33       application and/or the hostname and/or service name ...
34
35       The session id context becomes part of the session. The session id
36       context is set by the SSL/TLS server. The
37       SSL_CTX_set_session_id_context() and SSL_set_session_id_context()
38       functions are therefore only useful on the server side.
39
40       OpenSSL clients will check the session id context returned by the
41       server when reusing a session.
42
43       The maximum length of the sid_ctx is limited to
44       SSL_MAX_SSL_SESSION_ID_LENGTH.
45

WARNINGS

47       If the session id context is not set on an SSL/TLS server and client
48       certificates are used, stored sessions will not be reused but a fatal
49       error will be flagged and the handshake will fail.
50
51       If a server returns a different session id context to an OpenSSL client
52       when reusing a session, an error will be flagged and the handshake will
53       fail. OpenSSL servers will always return the correct session id
54       context, as an OpenSSL server checks the session id context itself
55       before reusing a session as described above.
56

RETURN VALUES

58       SSL_CTX_set_session_id_context() and SSL_set_session_id_context()
59       return the following values:
60
61       0   The length sid_ctx_len of the session id context sid_ctx exceeded
62           the maximum allowed length of SSL_MAX_SSL_SESSION_ID_LENGTH. The
63           error is logged to the error stack.
64
65       1   The operation succeeded.
66

SEE ALSO

68       ssl(3)
69
70
71
721.0.2o                            2020-01-28 SSL_CTX_set_session_id_context(3)
Impressum