SSL_CTX_set_session_id_context.pod 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. =pod
  2. =head1 NAME
  3. SSL_CTX_set_session_id_context, SSL_set_session_id_context - set context within which session can be reused (server side only)
  4. =head1 SYNOPSIS
  5. #include <openssl/ssl.h>
  6. int SSL_CTX_set_session_id_context(SSL_CTX *ctx, const unsigned char *sid_ctx,
  7. unsigned int sid_ctx_len);
  8. int SSL_set_session_id_context(SSL *ssl, const unsigned char *sid_ctx,
  9. unsigned int sid_ctx_len);
  10. =head1 DESCRIPTION
  11. SSL_CTX_set_session_id_context() sets the context B<sid_ctx> of length
  12. B<sid_ctx_len> within which a session can be reused for the B<ctx> object.
  13. SSL_set_session_id_context() sets the context B<sid_ctx> of length
  14. B<sid_ctx_len> within which a session can be reused for the B<ssl> object.
  15. =head1 NOTES
  16. Sessions are generated within a certain context. When exporting/importing
  17. sessions with B<i2d_SSL_SESSION>/B<d2i_SSL_SESSION> it would be possible,
  18. to re-import a session generated from another context (e.g. another
  19. application), which might lead to malfunctions. Therefore each application
  20. must set its own session id context B<sid_ctx> which is used to distinguish
  21. the contexts and is stored in exported sessions. The B<sid_ctx> can be
  22. any kind of binary data with a given length, it is therefore possible
  23. to use e.g. the name of the application and/or the hostname and/or service
  24. name ...
  25. The session id context becomes part of the session. The session id context
  26. is set by the SSL/TLS server. The SSL_CTX_set_session_id_context() and
  27. SSL_set_session_id_context() functions are therefore only useful on the
  28. server side.
  29. OpenSSL clients will check the session id context returned by the server
  30. when reusing a session.
  31. The maximum length of the B<sid_ctx> is limited to
  32. B<SSL_MAX_SSL_SESSION_ID_LENGTH>.
  33. =head1 WARNINGS
  34. If the session id context is not set on an SSL/TLS server and client
  35. certificates are used, stored sessions
  36. will not be reused but a fatal error will be flagged and the handshake
  37. will fail.
  38. If a server returns a different session id context to an OpenSSL client
  39. when reusing a session, an error will be flagged and the handshake will
  40. fail. OpenSSL servers will always return the correct session id context,
  41. as an OpenSSL server checks the session id context itself before reusing
  42. a session as described above.
  43. =head1 RETURN VALUES
  44. SSL_CTX_set_session_id_context() and SSL_set_session_id_context()
  45. return the following values:
  46. =over 4
  47. =item Z<>0
  48. The length B<sid_ctx_len> of the session id context B<sid_ctx> exceeded
  49. the maximum allowed length of B<SSL_MAX_SSL_SESSION_ID_LENGTH>. The error
  50. is logged to the error stack.
  51. =item Z<>1
  52. The operation succeeded.
  53. =back
  54. =head1 SEE ALSO
  55. L<ssl(3)|ssl(3)>
  56. =cut