1d2i_SSL_SESSION(3)                  OpenSSL                 d2i_SSL_SESSION(3)
2
3
4

NAME

6       d2i_SSL_SESSION, i2d_SSL_SESSION - convert SSL_SESSION object from/to
7       ASN1 representation
8

SYNOPSIS

10        #include <openssl/ssl.h>
11
12        SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp, long length);
13        int i2d_SSL_SESSION(SSL_SESSION *in, unsigned char **pp);
14

DESCRIPTION

16       d2i_SSL_SESSION() transforms the external ASN1 representation of an
17       SSL/TLS session, stored as binary data at location pp with length
18       length, into an SSL_SESSION object.
19
20       i2d_SSL_SESSION() transforms the SSL_SESSION object in into the ASN1
21       representation and stores it into the memory location pointed to by pp.
22       The length of the resulting ASN1 representation is returned. If pp is
23       the NULL pointer, only the length is calculated and returned.
24

NOTES

26       The SSL_SESSION object is built from several malloc()ed parts, it can
27       therefore not be moved, copied or stored directly. In order to store
28       session data on disk or into a database, it must be transformed into a
29       binary ASN1 representation.
30
31       When using d2i_SSL_SESSION(), the SSL_SESSION object is automatically
32       allocated. The reference count is 1, so that the session must be
33       explicitly removed using SSL_SESSION_free(3), unless the SSL_SESSION
34       object is completely taken over, when being called inside the get_ses‐
35       sion_cb() (see SSL_CTX_sess_set_get_cb(3)).
36
37       SSL_SESSION objects keep internal link information about the session
38       cache list, when being inserted into one SSL_CTX object's session
39       cache.  One SSL_SESSION object, regardless of its reference count, must
40       therefore only be used with one SSL_CTX object (and the SSL objects
41       created from this SSL_CTX object).
42
43       When using i2d_SSL_SESSION(), the memory location pointed to by pp must
44       be large enough to hold the binary representation of the session. There
45       is no known limit on the size of the created ASN1 representation, so
46       the necessary amount of space should be obtained by first calling
47       i2d_SSL_SESSION() with pp=NULL, and obtain the size needed, then allo‐
48       cate the memory and call i2d_SSL_SESSION() again.
49

RETURN VALUES

51       d2i_SSL_SESSION() returns a pointer to the newly allocated SSL_SESSION
52       object. In case of failure the NULL-pointer is returned and the error
53       message can be retrieved from the error stack.
54
55       i2d_SSL_SESSION() returns the size of the ASN1 representation in bytes.
56       When the session is not valid, 0 is returned and no operation is per‐
57       formed.
58

SEE ALSO

60       ssl(3), SSL_SESSION_free(3), SSL_CTX_sess_set_get_cb(3)
61
62
63
640.9.8b                            2005-03-30                d2i_SSL_SESSION(3)
Impressum