SSL_SESSION_GET0_ID_CONTEXT(3ossl)

πŸ“¦ version 3.5.0, in opensuse-leap 16.0

✨ NAME ✨

okay so this is the SSL_SESSION_GET0_ID_CONTEXT(3ossl) page, and it's literally giving β€œget and set the SSL ID context associated with a session” πŸ’…. The main characters are SSL_SESSION_get0_id_context and SSL_SESSION_set1_id_context β€” they grab and set the SSL ID context tied to a session, no cap. πŸŽ€


πŸŽ€ SYNOPSIS πŸŽ€

        #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 πŸ’…

First thing, bestie: for the full lore on session ID contexts, go read SSL_CTX_set_session_id_context(3) β€” that's where the details live. πŸ¦‹

SSL_SESSION_get0_id_context() returns the ID context associated with the SSL/TLS session s. The length of the ID context gets written to *len if len is not NULL. ✨

The value returned is a pointer to an object maintained within s and should not be released. So do not free it, okay? It's not yours to free, it's living inside s rent-free. 🫢

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. Respect the limit, bestie β€” it's giving boundary issues for a reason. πŸ’€


🌸 RETURN VALUES 🌸

SSL_SESSION_set1_id_context() returns 1 on success or 0 on error. That's it, that's the whole vibe check. βœ…


πŸ¦‹ SEE ALSO πŸ¦‹


πŸ“ HISTORY πŸ“

The SSL_SESSION_get0_id_context() function was added in OpenSSL 1.1.0. Iconic behavior, honestly. πŸ‘‘


Copyright 2015-2020 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>.


xoxo, your Unix bestie πŸ’… β€” this one's from OpenSSL 3.5.0, dated 2026-09-25. slay and read the license. 🌈

πŸ“¦ where this page comes from