SSL_SESSION_SET1_ID(3ossl)

πŸ“¦
version 15.1 Β· 3 versions
, in freebsd 15.1

πŸ’… SSL_SESSION_SET1_ID πŸ’…

okay bestie, so this one's from the OpenSSL fam β€” it's the 3ossl manual page and it's literally all about getting and setting the SSL session ID. tiny page, big main character energy. let's get into it πŸŽ€


✨ NAME ✨

SSL_SESSION_get_id, SSL_SESSION_set1_id β€” like, the getter and the setter for the SSL session ID. grab it, or yeet a new one in. that's the whole vibe πŸ¦‹


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

yup, that's the whole thing. two functions, no cap πŸ’…


πŸ’– DESCRIPTION πŸ’–

SSL_SESSION_get_id() 🫢

this one hands you back a pointer to the internal session id value for the session s. the length of that id, in bytes, gets stashed in *len. and like β€” the length may be 0, so don't freak out if you get a zero, it's valid, it's allowed, it's fine 🧚

⚠️ bestie, listen to me: the caller should not free the returned pointer directly. it's the library's pointer, not yours. hands off πŸ™ˆ

SSL_SESSION_set1_id() πŸ’«

this one sets the session ID for the ssl SSL/TLS session to sid, of length sid_len. that's it, that's the whole job. iconic, honestly πŸ‘‘


πŸ”₯ RETURN VALUES πŸ”₯

  • SSL_SESSION_get_id() β€” returns a pointer to the session id value. simple as 🌈
  • SSL_SESSION_set1_id() β€” returns 1 for success and 0 for failure. and when does it fail? for example, if the supplied session ID length exceeds SSL_MAX_SSL_SESSION_ID_LENGTH. so like, don't overstuff it, it's not a suitcase πŸ’€

πŸ¦‹ SEE ALSO πŸ¦‹

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

πŸ‘‘ HISTORY πŸ‘‘

the SSL_SESSION_set1_id() function was added in OpenSSL 1.1.0. so it's been around a minute, lowkey vintage πŸŽ€


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 tea, bestie πŸ“ this was SSL_SESSION_SET1_ID(3ossl) from OpenSSL 3.5.6, dated 2026-04-07 β€” slay, go forth and manage those session IDs responsibly πŸ’…πŸ’–

πŸ“¦ where this page comes from