GNUTLS_CERTIFICATE_SET_VERIFY_FUNCTION(3)

πŸ’– gnutls_certificate_set_verify_function β€” API function πŸ’–

okay bestie, pull up a chair, because this one is from the gnutls manual (that's the GNU TLS library, she's iconic, she's giving secure-transport main character energy) and we're gonna talk about her in full. no skipping, no summarizing, we're doing the whole thing. πŸŽ€


✨ NAME ✨

gnutls_certificate_set_verify_function β€” it's an API function, fr fr. that's literally her whole job title. πŸ’…


🌸 SYNOPSIS 🌸

#include <gnutls/gnutls.h>

void
gnutls_certificate_set_verify_function(gnutls_certificate_credentials_t
cred, gnutls_certificate_verify_function * func);

not her returning anything cute btw, she's void. she just does the thing and leaves. periodt. πŸ’€


πŸ¦‹ ARGUMENTS πŸ¦‹

  • gnutls_certificate_credentials_t cred β€” this one is a gnutls_certificate_credentials_t type. that's it, that's the whole vibe. your credentials, your little bundle of trust. 🫢
  • gnutls_certificate_verify_function * func β€” this is the callback function. the star of the show. the one who gets called. ⭐

πŸ’œ DESCRIPTION πŸ’œ

so the way this works β€” you're setting a callback that gnutls will hit up when the peer's certificate shows up, so it gets verified on receipt instead of you sitting around waiting until after the whole handshake is done. like, why wait when you could just verify right then? exactly. no cap. πŸ”₯

the callback's function prototype is literally:

int (*callback)(gnutls_session_t);

and if you do hand over a callback function, gnutls will call it during the handshake, right after the certificate message has been received. so it's early, it's eager, it's on top of things. 😌

and if you wanna verify or grab the certificate while you're in there, these are the functions you can use:

  • gnutls_certificate_verify_peers2()
  • gnutls_certificate_type_get()
  • gnutls_certificate_get_peers()

and now the important part, bestie, do not skip this one:

your callback function needs to return 0 for the handshake to keep going, or non-zero to terminate it. zero = we ball, non-zero = shut it down. that's the whole decision. πŸ’…

⏳ SINCE ⏳

2.10.0 β€” she's been around, she's seasoned, she's not new here. πŸ‘‘


πŸ™ˆ REPORTING BUGS πŸ™ˆ

found a bug? tell the people, they wanna know:


Copyright Β© 2001-2023 Free Software Foundation, Inc., and others.

and the license tea, since we always give credit where it's due: 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 like, go off, just keep the receipts. πŸ’–


πŸ‘€ SEE ALSO πŸ‘€

the full documentation for gnutls is maintained as a Texinfo manual. so if the /usr/share/doc/gnutls/ directory isn't giving HTML form for you, go visit:

https://www.gnutls.org/manual/

that's where the full lore lives. iykyk. 🌈


and that's the whole page, bestie!! this one came from gnutls version 3.8.13 in the gnutls manual β€” go forth and verify those certificates early, you absolute legend. mwah. πŸ’…βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’–

πŸ“¦ where this page comes from