]> git.ipfire.org Git - thirdparty/openssl.git/blame - doc/man3/SSL_CTX_set_session_id_context.pod
Implement EVP_MAC_do_all_ex()
[thirdparty/openssl.git] / doc / man3 / SSL_CTX_set_session_id_context.pod
CommitLineData
cd6aa710
LJ
1=pod
2
3=head1 NAME
4
5SSL_CTX_set_session_id_context, SSL_set_session_id_context - set context within which session can be reused (server side only)
6
7=head1 SYNOPSIS
8
9 #include <openssl/ssl.h>
10
11 int SSL_CTX_set_session_id_context(SSL_CTX *ctx, const unsigned char *sid_ctx,
12 unsigned int sid_ctx_len);
13 int SSL_set_session_id_context(SSL *ssl, const unsigned char *sid_ctx,
14 unsigned int sid_ctx_len);
15
16=head1 DESCRIPTION
17
18SSL_CTX_set_session_id_context() sets the context B<sid_ctx> of length
19B<sid_ctx_len> within which a session can be reused for the B<ctx> object.
20
21SSL_set_session_id_context() sets the context B<sid_ctx> of length
22B<sid_ctx_len> within which a session can be reused for the B<ssl> object.
23
24=head1 NOTES
25
26Sessions are generated within a certain context. When exporting/importing
27sessions with B<i2d_SSL_SESSION>/B<d2i_SSL_SESSION> it would be possible,
28to re-import a session generated from another context (e.g. another
29application), which might lead to malfunctions. Therefore each application
30must set its own session id context B<sid_ctx> which is used to distinguish
31the contexts and is stored in exported sessions. The B<sid_ctx> can be
32any kind of binary data with a given length, it is therefore possible
33to use e.g. the name of the application and/or the hostname and/or service
34name ...
35
36The session id context becomes part of the session. The session id context
37is set by the SSL/TLS server. The SSL_CTX_set_session_id_context() and
38SSL_set_session_id_context() functions are therefore only useful on the
39server side.
40
41OpenSSL clients will check the session id context returned by the server
42when reusing a session.
43
44The maximum length of the B<sid_ctx> is limited to
fe9edc9d 45B<SSL_MAX_SID_CTX_LENGTH>.
cd6aa710
LJ
46
47=head1 WARNINGS
48
9f6ea716
LJ
49If the session id context is not set on an SSL/TLS server and client
50certificates are used, stored sessions
cd6aa710
LJ
51will not be reused but a fatal error will be flagged and the handshake
52will fail.
53
54If a server returns a different session id context to an OpenSSL client
55when reusing a session, an error will be flagged and the handshake will
56fail. OpenSSL servers will always return the correct session id context,
57as an OpenSSL server checks the session id context itself before reusing
58a session as described above.
59
60=head1 RETURN VALUES
61
62SSL_CTX_set_session_id_context() and SSL_set_session_id_context()
63return the following values:
64
65=over 4
66
c8919dde 67=item Z<>0
cd6aa710
LJ
68
69The length B<sid_ctx_len> of the session id context B<sid_ctx> exceeded
fe9edc9d 70the maximum allowed length of B<SSL_MAX_SID_CTX_LENGTH>. The error
cd6aa710
LJ
71is logged to the error stack.
72
c8919dde 73=item Z<>1
cd6aa710
LJ
74
75The operation succeeded.
76
77=back
78
79=head1 SEE ALSO
80
b97fdb57 81L<ssl(7)>
cd6aa710 82
e2f92610
RS
83=head1 COPYRIGHT
84
85Copyright 2001-2016 The OpenSSL Project Authors. All Rights Reserved.
86
4746f25a 87Licensed under the Apache License 2.0 (the "License"). You may not use
e2f92610
RS
88this file except in compliance with the License. You can obtain a copy
89in the file LICENSE in the source distribution or at
90L<https://www.openssl.org/source/license.html>.
91
92=cut