gnutls_session_get_id(3)
π gnutls_session_get_id β the vibe check on your session's ID π
okay bestie, we're in the gnutls manual, and today's main character is gnutls_session_get_id. it's an API function, it's giving "tell me who this session thinks it is", and we're gonna go through it together. no gatekeeping here π«Ά
β¨ SYNOPSIS β¨
#include <gnutls/gnutls.h>
int gnutls_session_get_id(gnutls_session_t session, void * session_id,
size_t * session_id_size);
that's the whole signature, copy it exactly, don't freestyle it π
π ARGUMENTS π
gnutls_session_t sessionβ literally just agnutls_session_ttype. that's it. that's the vibe. it's the session you're interrogating πvoid * session_idβ a pointer to the space that's gonna hold the session id. bring your own buffer, bestie, this function does not provide one for you πsize_t * session_id_sizeβ okay so on the way in, this needs to already contain the maxsession_idsize you've got room for. on the way out, it gets updated. so it's a little in-and-out queen π
πΈ DESCRIPTION πΈ
so it returns the TLS session identifier. plot twist though: the session ID is picked by the server, not you. and in older versions of TLS it was a unique identifier shared between client and server that was persistent across resumption. cute, right? iconic era. π°οΈ
but in the latest version of TLS (1.3), or TLS with session tickets, the whole notion of session identifiers is undefined and you genuinely cannot rely on it to uniquely identify sessions across client and server. it's giving "we don't do that anymore". so don't build your whole personality on it π
on the client side, this function returns the identifier that the server gave you, and you cannot assume it has any relation to session resumption. like, none. zero. don't assume. π
on the server side, this function is guaranteed to return a persistent identifier of the session since GnuTLS 3.6.4 β and heads up, that value may not necessarily map into the actual TLS session ID value. before that version, the value could only be considered a persistent identifier under TLS1.2 or earlier and when no session tickets were in use. very specific, very conditional, very "read the fine print" β¨
and the session identifier value that comes back is always less than GNUTLS_MAX_SESSION_ID_SIZE. always. no exceptions. π
π RETURNS π
on success you get GNUTLS_E_SUCCESS (0) back. slay. anything else and it's an error code β handle it, don't ignore it, that's not the move bestie π€
π REPORTING BUGS π
found a bug? report it to <bugs@gnutls.org>. they wanna hear about it, fr fr.
home page: https://www.gnutls.org
π COPYRIGHT π
Copyright Β© 2001-2023 Free Software Foundation, Inc., and others.
copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. so yes you can share it, just keep the receipts π§Ύπ
π¦ SEE ALSO π¦
the full documentation for gnutls is maintained as a Texinfo manual. if the /usr/share/doc/gnutls/ directory does not contain the HTML form, visit:
https://www.gnutls.org/manual/
and that's the whole page, bestie!! this one's from gnutls 3.8.13, manual page gnutls_session_get_id(3), and you absolutely ate reading all of it π
β¨ go forth and check your session ids responsibly πΈπ«Ά
π¦ where this page comes from
- alpine 3.22: gnutls-doc 3.8.13-r0 Β· LGPL-2.1-or-later
- alpine 3.23: gnutls-doc 3.8.13-r0 Β· LGPL-2.1-or-later
- alpine 3.24: gnutls-doc 3.8.13-r0 Β· LGPL-2.1-or-later
- arch rolling: gnutls 3.8.13-3 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 43: gnutls-devel 3.8.13-1.fc43 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 43: gnutls-devel 3.8.13-1.fc43 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 44: gnutls-devel 3.8.13-1.fc44 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 44: gnutls-devel 3.8.13-1.fc44 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- ubuntu stonking: gnutls-doc 3.8.13-1ubuntu1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms