SSL_SESSION_SET1_ID(3ossl)

πŸ’– SSL_SESSION_SET1_ID β€” bestie's guide to session IDs πŸ’–

okay so this is an OpenSSL man page, section 3 (the 3ossl girlies know ✨). Two functions, one mission: grabbing and setting the SSL session ID. Let's get into it 🫢


✨ NAME ✨

SSL_SESSION_get_id, SSL_SESSION_set1_id β€” get and set the SSL session ID, no cap πŸ’…


🌸 SYNOPSIS 🌸

#include <openssl/ssl.h>

const unsigned char *SSL_SESSION_get_id(const SSL_SESSION *s,
                                        unsigned int *len);
int SSL_SESSION_set1_id(SSL_SESSION *s, const unsigned char *sid,
                        unsigned int sid_len);

πŸ¦‹ DESCRIPTION πŸ¦‹

SSL_SESSION_get_id() hands you back a pointer to the internal session id value for the session s. Like, the actual one, living inside s β€” not a copy, bestie, an inside job πŸ•΅οΈβ™€οΈ

The length of that id, in bytes, gets stashed into *len. And heads up: that length may be 0. Zero. Nada. It's allowed, don't panic 🫠

πŸ’€ IMPORTANT: the caller should not free the returned pointer directly. It's not yours to free! It belongs to the session. Do not touch. Do not free. Just vibe.

SSL_SESSION_set1_id() sets the session ID for the ssl SSL/TLS session s to sid, and that sid has length sid_len. Iconic behaviour honestly πŸ‘‘


πŸŽ€ RETURN VALUES πŸŽ€

  • SSL_SESSION_get_id() β€” returns a pointer to the session id value. That's it, that's the whole vibe.
  • SSL_SESSION_set1_id() β€” returns 1 for success and 0 for failure. Like, for example, if the supplied session ID length exceeds SSL_MAX_SSL_SESSION_ID_LENGTH. Yeah. Too long. Rejected. 🚫

🌈 SEE ALSO 🌈

  • ssl(7) β€” go read her too, she's the main character πŸ’œ

⭐ HISTORY ⭐

The SSL_SESSION_set1_id() function was added in OpenSSL 1.1.0. She's been here since 1.1.0 and she's never left, periodt 🧚


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>.


and that's the whole page, bestie πŸ“ tysm for reading β€” this one came straight out of 3.5.9, dated 2026-09-29, and it's still the SSL_SESSION_SET1_ID(3ossl) we know and love. mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from