D2I_SSL_SESSION(3ossl)
π D2I_SSL_SESSION
okay so bestie, welcome to the 3ossl manual page for D2I_SSL_SESSION β yes that's the actual manual name, it's giving very "my full legal name is on the birth certificate" energy π this is the little trio of functions that turn an SSL_SESSION object into its ASN1 representation and back again, and honestly? iconic. let's get into it β¨
β¨ NAME β¨
d2i_SSL_SESSION, d2i_SSL_SESSION_ex, i2d_SSL_SESSION β these three convert an SSL_SESSION object from and to its ASN1 representation π¦
πΈ SYNOPSIS πΈ
#include <openssl/ssl.h>
SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp,
long length);
SSL_SESSION *d2i_SSL_SESSION_ex(SSL_SESSION **a, const unsigned char **pp,
long length, OSSL_LIB_CTX *libctx,
const char *propq);
int i2d_SSL_SESSION(SSL_SESSION *in, unsigned char **pp);
like, just look at them. three little functions. all business π
π DESCRIPTION π
so these functions decode and encode an SSL_SESSION object, periodt. for the encoding details you're gonna wanna go peek at d2i_X509(3) β that's where the real ASN1 lore lives π₯
now here's the part where we get a little serious, because this one actually matters:
SSL_SESSIONobjects keep internal link information about the session cache list, when being inserted into oneSSL_CTXobject's session cache. oneSSL_SESSIONobject, regardless of its reference count, must therefore only be used with oneSSL_CTXobject (and theSSLobjects created from thisSSL_CTXobject). no sharing, no mixing, no "but it's just one little session" π
so yeah β one session object, one SSL_CTX, and the SSL objects that came from that SSL_CTX. that's the vibe check and it does not negotiate π
β RETURN VALUES β
d2i_SSL_SESSION()andd2i_SSL_SESSION_ex()β they return a pointer to the newly allocatedSSL_SESSIONobject π if it fails, you get theNULL-pointer back, and you can grab the error message from the error stack. classic. check your stack bestie πi2d_SSL_SESSION()β returns the size of the ASN1 representation in bytes β¨ but when the session is not valid,0is returned and no operation is performed. like she simply will not do it. and honestly, respect π
π¦ SEE ALSO π¦
go read them, iykyk ππ
π HISTORY π
the function d2i_SSL_SESSION_ex() was added in OpenSSL 3.2 β so she's the new girl and she ate π«Άβ¨
π COPYRIGHT π
Copyright 2001-2024 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
and that's the whole page, bestie π mwah π β this was version 3.5.0, dated 2026-09-25, coming at you from the 3ossl manual, and she slayed the entire time πβ¨π§
π¦ where this page comes from
- opensuse-leap 16.0: openssl-3-doc 3.5.0-160000.11.1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms