d2i_SSL_SESSION.pod 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. =pod
  2. =head1 NAME
  3. d2i_SSL_SESSION, i2d_SSL_SESSION - convert SSL_SESSION object from/to ASN1 representation
  4. =head1 SYNOPSIS
  5. #include <openssl/ssl.h>
  6. SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp, long length);
  7. int i2d_SSL_SESSION(SSL_SESSION *in, unsigned char **pp);
  8. =head1 DESCRIPTION
  9. d2i_SSL_SESSION() transforms the external ASN1 representation of an SSL/TLS
  10. session, stored as binary data at location B<pp> with length B<length>, into
  11. an SSL_SESSION object.
  12. i2d_SSL_SESSION() transforms the SSL_SESSION object B<in> into the ASN1
  13. representation and stores it into the memory location pointed to by B<pp>.
  14. The length of the resulting ASN1 representation is returned. If B<pp> is
  15. the NULL pointer, only the length is calculated and returned.
  16. =head1 NOTES
  17. The SSL_SESSION object is built from several malloc()ed parts, it can
  18. therefore not be moved, copied or stored directly. In order to store
  19. session data on disk or into a database, it must be transformed into
  20. a binary ASN1 representation.
  21. When using d2i_SSL_SESSION(), the SSL_SESSION object is automatically
  22. allocated. The reference count is 1, so that the session must be
  23. explicitly removed using L<SSL_SESSION_free(3)|SSL_SESSION_free(3)>,
  24. unless the SSL_SESSION object is completely taken over, when being called
  25. inside the get_session_cb() (see
  26. L<SSL_CTX_sess_set_get_cb(3)|SSL_CTX_sess_set_get_cb(3)>).
  27. SSL_SESSION objects keep internal link information about the session cache
  28. list, when being inserted into one SSL_CTX object's session cache.
  29. One SSL_SESSION object, regardless of its reference count, must therefore
  30. only be used with one SSL_CTX object (and the SSL objects created
  31. from this SSL_CTX object).
  32. When using i2d_SSL_SESSION(), the memory location pointed to by B<pp> must be
  33. large enough to hold the binary representation of the session. There is no
  34. known limit on the size of the created ASN1 representation, so the necessary
  35. amount of space should be obtained by first calling i2d_SSL_SESSION() with
  36. B<pp=NULL>, and obtain the size needed, then allocate the memory and
  37. call i2d_SSL_SESSION() again.
  38. =head1 RETURN VALUES
  39. d2i_SSL_SESSION() returns a pointer to the newly allocated SSL_SESSION
  40. object. In case of failure the NULL-pointer is returned and the error message
  41. can be retrieved from the error stack.
  42. i2d_SSL_SESSION() returns the size of the ASN1 representation in bytes.
  43. When the session is not valid, B<0> is returned and no operation is performed.
  44. =head1 SEE ALSO
  45. L<ssl(3)|ssl(3)>, L<SSL_SESSION_free(3)|SSL_SESSION_free(3)>,
  46. L<SSL_CTX_sess_set_get_cb(3)|SSL_CTX_sess_set_get_cb(3)>
  47. =cut