---
name: "libressl-SSL_SESSION_set1_id_context"
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-SSL_SESSION_set1_id_context"
---

# libressl-SSL\_SESSION\_set1\_id\_context(3)

get and set the SSL ID context associated with a session

## NAME

**SSL\_SESSION\_get0\_id\_context**, **SSL\_SESSION\_set1\_id\_context** – get and set the SSL ID context associated with a session

## SYNOPSIS

SSL Library (libssl, -lssl) libcrypto

**#include \<openssl/ssl.h\>**

*const* *unsigned* *char* *\**\

**SSL\_SESSION\_get0\_id\_context**(*const SSL\_SESSION \*s*, *unsigned int \*len*);

*int*\

**SSL\_SESSION\_set1\_id\_context**(*SSL\_SESSION \*s*, *const unsigned char \*sid\_ctx*, *unsigned int sid\_ctx\_len*);

## DESCRIPTION

**SSL\_SESSION\_get0\_id\_context**() returns the ID context associated with *s*. The length of the ID context in bytes is written to \**len* if *len* is not NULL.

**SSL\_SESSION\_set1\_id\_context**() takes a copy of the provided ID context given in *sid\_ctx* and associates it with the session *s*. The length of the ID context is given by *sid\_ctx\_len* which must not exceed SSL\_MAX\_SID\_CTX\_LENGTH bytes.

## RETURN VALUES

**SSL\_SESSION\_get0\_id\_context**() returns an internal pointer to an object maintained within *s* that should not be freed by the caller.

**SSL\_SESSION\_set1\_id\_context**() returns 1 on success or 0 on error.

## SEE ALSO

[ssl(3)](/ssl/3.md), SSL\_CTX\_set\_session\_id\_context(3), SSL\_get\_session(3), SSL\_SESSION\_new(3)

## HISTORY

**SSL\_SESSION\_set1\_id\_context**() first appeared in OpenSSL 1.0.1 and has been available since OpenBSD 5.3.

**SSL\_SESSION\_get0\_id\_context**() first appeared in OpenSSL 1.1.0 and has been available since OpenBSD 6.3.
