PEM_READ_SSL_SESSION(3)

πŸ“¦ version 4.4.0, in alpine 3.24, arch rolling

✨ PEM_READ_SSL_SESSION ✨

okay so bestie, this is a page out of the libssl / libcrypto library manual β€” the <openssl/ssl.h>-girlies know πŸ’…. It's all about the four functions that encode and decode SSL_SESSION objects into PEM format. Saving and loading your session, but make it PEM. πŸŽ€


🌸 SYNOPSIS 🌸

#include <openssl/ssl.h>

SSL_SESSION *
PEM_read_SSL_SESSION(FILE *fp, SSL_SESSION **a, pem_password_cb *cb,
    void *u);

SSL_SESSION *
PEM_read_bio_SSL_SESSION(BIO *bp, SSL_SESSION **a, pem_password_cb *cb,
    void *u);

int
PEM_write_SSL_SESSION(FILE *fp, const SSL_SESSION *a);

int
PEM_write_bio_SSL_SESSION(BIO *bp, const SSL_SESSION *a);

πŸ¦‹ DESCRIPTION πŸ¦‹

So these routines are literally the glow-up translators between your local, in-memory instances of ASN.1 SSL_SESSION objects and the PEM encoding. In β†’ out, out β†’ in, no cap. ✨

  • PEM_read_SSL_SESSION() β€” reads a PEM-encoded SSL_SESSION object from the file fp and returns it. The cb and u parameters are exactly as described in PEM_read_bio_PrivateKey(3) β€” same energy, no originality, and that's fine. πŸ’–
  • PEM_read_bio_SSL_SESSION() β€” basically PEM_read_SSL_SESSION()'s sibling, except it reads from the BIO bp. Same function, different source, we stan a flexible queen. 🌈
  • PEM_write_SSL_SESSION() β€” writes the PEM encoding of the object a to the file fp. Out it goes, slay. πŸ’…
  • PEM_write_bio_SSL_SESSION() β€” similarly, but it writes to the BIO bp. Iconic parallel structure, honestly. 🌸

πŸ’€ RETURN VALUES πŸ’€

  • PEM_read_SSL_SESSION() and PEM_read_bio_SSL_SESSION() give you back a pointer to an allocated object β€” which you must release by calling SSL_SESSION_free(3), bestie, don't ghost it β€” or NULL on error. 😭
  • PEM_write_SSL_SESSION() and PEM_write_bio_SSL_SESSION() return the number of bytes written, or 0 on error. That's the whole return value, periodt.
fr fr: don't forget the SSL_SESSION_free(3) call. Memory leaks are not main character energy. 🫢

πŸ‘‘ SEE ALSO πŸ‘‘


⭐ HISTORY ⭐

  • PEM_read_SSL_SESSION() and PEM_write_SSL_SESSION() first appeared in SSLeay 0.5.2. OG behavior. πŸ”₯
  • PEM_read_bio_SSL_SESSION() and PEM_write_bio_SSL_SESSION() first appeared in SSLeay 0.6.0 β€” the sequel, arguably better. πŸ’œ
  • All of these functions have been available since OpenBSD 2.4. Longevity icon. πŸ‘‘

and that's the whole page, bestie 🧚 β€” shipped from Debian on June 8, 2025, so you know it's fresh. bye, love you, free your sessions πŸ’–πŸ“

πŸ“¦ where this page comes from