SSL_SESSION_SET1_ID(3ossl)

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

πŸ’… SSL_SESSION_SET1_ID β€” the OpenSSL manual, but make it make sense

okay bestie, welcome to SSL_SESSION_SET1_ID(3ossl) β€” it's an OpenSSL page, it's about session IDs, and it's lowkey iconic. Let's get into it πŸ’–


✨ NAME ✨

SSL_SESSION_get_id, SSL_SESSION_set1_id β€” the duo that gets and sets the SSL session ID. one reads, one writes, they're literally the main characters 🫢


🌸 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);

no cap, that's the whole vibe. pull in the header, call the function, you're slaying ✨


πŸ¦‹ DESCRIPTION πŸ¦‹

get β€” the reader era πŸ‘‘

SSL_SESSION_get_id() returns a pointer to the internal session id value for the session s. like, the actual one living inside the struct, not a copy β€” she's not doing duplicates today πŸ’…

the length of the id in bytes gets stored in *len. and yes, that length may be 0 β€” zero-length IDs are a whole valid thing, don't come for her.

⚠️ do NOT free the returned pointer directly. it's not yours, bestie. it's the session's. touching it with free() is giving chaos, and not the cute kind πŸ’€

set β€” the writer era πŸŽ€

SSL_SESSION_set1_id() sets the session ID for the ssl SSL/TLS session to sid, of length sid_len. short, sweet, and honestly? she ate.


πŸ”₯ RETURN VALUES πŸ”₯

  • SSL_SESSION_get_id() β€” returns a pointer to the session id value. that's it, that's the whole return value, no cap 🌈
  • SSL_SESSION_set1_id() β€” returns 1 for success and 0 for failure. and when does failure happen, you ask? for example, if the supplied session ID length exceeds SSL_MAX_SSL_SESSION_ID_LENGTH. so like… know your limits, girlie 😭

πŸ’œ SEE ALSO πŸ’œ

  • ssl(7) β€” go read it, iykyk ⭐

🧚 HISTORY 🧚

SSL_SESSION_set1_id() was added in OpenSSL 1.1.0. so it's been here a minute β€” a certified classic, not a new girl πŸŽ€


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

like, respect the license, it's literally the law πŸ™ˆ


🌸 okay that's the whole page, you're officially educated, go forth and handle your session IDs responsibly. this has been 3.5.0, dated 2026-09-25, from the SSL_SESSION_SET1_ID(3ossl) girlies β€” mwah, love u, bye πŸ’–πŸ¦‹βœ¨

πŸ“¦ where this page comes from