[openssl-users] [openssl-dev] Storing session in file and reusing at client side

Viktor Dukhovni openssl-users at dukhovni.org
Mon May 2 14:04:08 UTC 2016

On Mon, May 02, 2016 at 12:23:25PM +0530, Shubham Chauhan wrote:

> I wanted to store the freshly negotiated ssl/tls session in a file and
> reuse it (via SSL_set_session()), in the next handshake. I was not able to
> do that since the handshake got terminated giving a fatal error - illegal
> parameters (47).

Client-side sessions can be serialized via i2d_SSL_SESSION and the
resulting binary data can be stored in a file for reuse by a client
via d2i_SSL_SESSION() followed by SSL_set_session() (which copies
the session, so you can free the session obtained via d2i at that

Of course the client needs to want to reconnect to the same SSL
peer with the same security policy, otherwise session reuse is


More information about the openssl-users mailing list