gnutls_psk_set...tials_function2(3)
π gnutls_psk_set_server_credentials_function2 β like, the PSK server callback setter, but make it non-string β¨
okay bestie, welcome to the gnutls manual page for gnutls_psk_set_server_credentials_function2, which is an API function π«Ά. this is the one where you tell your server how to look up PSK creds for a user β and unlike its sibling, it does not force usernames to be strings. iykyk. π
β¨ SYNOPSIS β¨
#include <gnutls/gnutls.h>
void
gnutls_psk_set_server_credentials_function2(gnutls_psk_server_credentials_t
cred, gnutls_psk_server_credentials_function2 func);
like, that's the whole vibe. one include, one function, two args. slay. π
πΈ ARGUMENTS πΈ
gnutls_psk_server_credentials_t credβ bestie this is literally agnutls_psk_server_credentials_ttype. that's it, that's the arg. πgnutls_psk_server_credentials_function2 funcβ and this one is the callback function. the star of the show. the main character. π
π DESCRIPTION π
so here's the tea: you can use this function to set a callback that retrieves the user's PSK credentials. literally that's its whole job. π
the callback's function form is:
int (*callback)(gnutls_session_t, const gnutls_datum_t* username, gnutls_datum_t* key);
now, this callback function has the same semantics as the one from gnutls_psk_set_server_credentials_function(), BUT β and this is the iconic part β it lets you use non-string usernames. no cap. π
usernamecontains the actual username. yes, fr fr, the real one.- the
keymust be filled in usinggnutls_malloc(). do not freestyle this, bestie, usegnutls_malloc(). π
β οΈ warning time: if the callback returns a negative number, gnutls will just assume the username does not exist. like, ghosted. π
also, the callback function will only be called once per handshake β so don't be out here expecting it to spam-call you, it's a one-and-done situation. β¨
return values, bestie, get them right:
- return
0on success π - return
-1to indicate an error π
π₯ REPORTING BUGS π₯
found a bug? don't suffer in silence, tell the people:
- report bugs to
<bugs@gnutls.org> - 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. periodt. π
π¦ 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, go visit:
https://www.gnutls.org/manual/
and that's a wrap on the gnutls manual, version 3.8.13, dated 3.8.13 πβ¨ go forth and set your PSK server credentials callbacks, bestie, you're gonna ate. ππ«Άπ
π¦ 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