D2I_SSL_SESSION(3SSL)
π d2i_SSL_SESSION β the OpenSSL manual, bestie edition π
okay so this page lives in section 3SSL of the OpenSSL manual and it's literally all about turning SSL_SESSION objects into ASN1 bytes and back again. bestie, it's giving serialization but make it β¨TLSβ¨.
β¨ NAME β¨
d2i_SSL_SESSION, d2i_SSL_SESSION_ex, i2d_SSL_SESSION β convert an SSL_SESSION object from/to ASN1 representation π¦
no cap, that's the whole vibe. one direction encodes, the other direction decodes, and they're both obsessed with ASN1.
πΈ SYNOPSIS πΈ
like always, you gotta pull in the header first:
#include <openssl/ssl.h>
and then here are the three little icons themselves, exactly as they appear:
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);
π DESCRIPTION π
these functions decode and encode an SSL_SESSION object. that's it, that's the main character energy. π
for the deets on how the encoding actually works, go peek at d2i_X509(3) β it's the ASN1 lore keeper.
π¨ okay serious moment, bestie, listen up:SSL_SESSIONobjects keep internal link information about the session cache list, when being inserted into oneSSL_CTXobject's session cache. so oneSSL_SESSIONobject, regardless of its reference count, must therefore only be used with oneSSL_CTXobject (and theSSLobjects created from thisSSL_CTXobject). like, one session, oneSSL_CTX, no sharing, no polyamory. that's the rule. periodt.
π RETURN VALUES π
d2i_SSL_SESSION()andd2i_SSL_SESSION_ex()return a pointer to the newly allocatedSSL_SESSIONobject. π and if it goes wrong? in case of failure theNULL-pointer is returned and the error message can be retrieved from the error stack. so go check the stack, she's holding the receipts.i2d_SSL_SESSION()returns the size of the ASN1 representation in bytes. when the session is not valid,0is returned and no operation is performed. zero bytes, zero drama, nothing happened. π
π SEE ALSO π
go read these next, iykyk:
π HISTORY π
the function d2i_SSL_SESSION_ex() was added in OpenSSL 3.2. so she's the new girl in town, and honestly 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!! this edition came from OpenSSL 4.0.3, dated 2026-09-29, and it's filed under D2I_SSL_SESSION(3SSL) in the manual. mwah, go encode something iconic πππ¦
π¦ where this page comes from
- ubuntu stonking: libssl-doc 4.0.3-1ubuntu1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms