---
name: "libressl-PEM_read_SSL_SESSION"
section: "3"
platform: "linux"
package: "libressl"
version: "4.4.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/libressl-PEM_read_SSL_SESSION"
---

# libressl-PEM\_read\_SSL\_SESSION(3)

encode and decode SSL session objects in PEM format

## NAME

**PEM\_read\_SSL\_SESSION**, **PEM\_read\_bio\_SSL\_SESSION**, **PEM\_write\_SSL\_SESSION**, **PEM\_write\_bio\_SSL\_SESSION** – encode and decode SSL session objects in PEM format

## SYNOPSIS

SSL Library (libssl, -lssl) libcrypto

**#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

These routines convert between local instances of ASN.1 *SSL\_SESSION* objects and the PEM encoding.

**PEM\_read\_SSL\_SESSION**() reads a PEM-encoded *SSL\_SESSION* object from the file *fp* and returns it. The *cb* and *u* parameters are as described in PEM\_read\_bio\_PrivateKey(3).

**PEM\_read\_bio\_SSL\_SESSION**() is similar to **PEM\_read\_SSL\_SESSION**() but reads from the BIO *bp*.

**PEM\_write\_SSL\_SESSION**() writes the PEM encoding of the object *a* to the file *fp*.

**PEM\_write\_bio\_SSL\_SESSION**() similarly writes to the BIO *bp*.

## RETURN VALUES

**PEM\_read\_SSL\_SESSION**() and **PEM\_read\_bio\_SSL\_SESSION**() return a pointer to an allocated object, which should be released by calling SSL\_SESSION\_free(3), or NULL on error.

**PEM\_write\_SSL\_SESSION**() and **PEM\_write\_bio\_SSL\_SESSION**() return the number of bytes written or 0 on error.

## SEE ALSO

PEM\_read(3), [ssl(3)](/ssl/3.md)

## HISTORY

**PEM\_read\_SSL\_SESSION**() and **PEM\_write\_SSL\_SESSION**() first appeared in SSLeay 0.5.2. **PEM\_read\_bio\_SSL\_SESSION**() and **PEM\_write\_bio\_SSL\_SESSION**() first appeared in SSLeay 0.6.0. These functions have been available since OpenBSD 2.4.
