NAME
SSLCTXsetsessionidcontext, SSLsetsessionidcontext - set
context within which session can be reused (server side only)SYNOPSIS
#include
int SSLCTXsetsessionidcontext(SSLCTX *ctx, const unsigned char *sidctx, unsigned int sidctxlen); int SSLsetsessionidcontext(SSL *ssl, const unsigned char *sidctx, unsigned int sidctxlen);DESCRIPTION
SSLCTXsetsessionidcontext() sets the context ssiiddccttxx of length ssiiddccttxxlleenn within which a session can be reused for the ccttxx object. SSLsetsessionidcontext() sets the context ssiiddccttxx of length ssiiddccttxxlleenn within which a session can be reused for the ssssll object. NNOOTTEESS Sessions are generated within a certain context. When exporting/importing sessions with ii22ddSSSSLLSSEESSSSIIOONN/dd22iiSSSSLLSSEESSSSIIOONN itwould 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 ssiiddccttxx which is used to distinguish the contexts and is stored in exported sessions. The ssiiddccttxx 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 SSLCTXsetsessionidcontext() and SSLsetsessionidcontext() 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 ssiiddccttxx is limited to SSSSLLMMAAXXSSSSLLSSEESSSSIIOONNIIDDLLEENNGGTTHH. 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 context, as an OpenSSL server checks the session id context itself before reusing a session as described above.RETURN VALUES
SSLCTXsetsessionidcontext() and SSLsetsessionidcontext() return the following values: 0 The length ssiiddccttxxlleenn of the session id context ssiiddccttxx exceeded the maximum allowed length of SSSSLLMMAAXXSSSSLLSSEESSSSIIOONNIIDDLLEENNGGTTHH. The error is logged to the error stack. 1 The operation succeeded.SEE ALSO
ssl(3)0.9.7l 2004-06-14 SSLCTXsetsessionidcontext(3)