GNUTLS_SESSION_SET_VERIFY_FUNCTION(3)

πŸ’– NAME πŸ’–

gnutls_session_set_verify_function β€” the API function that lets you check a peer's certificate the moment it shows up, bestie πŸ’…

This is a page from the gnutls manual, section 3 (library calls). Yes it's a C library, no it's not scary, we're doing this together 🫢


✨ SYNOPSIS ✨

#include <gnutls/gnutls.h>

void gnutls_session_set_verify_function(gnutls_session_t session,
gnutls_certificate_verify_function * func);

okay so like. two things go in. nothing comes out. void, she's mysterious like that πŸ’œ


πŸŽ€ ARGUMENTS πŸŽ€

  • gnutls_session_t session β€” bestie this is literally just a gnutls_session_t type. that's the whole thing. that's the arg.
  • gnutls_certificate_verify_function * func β€” and this one is the callback function, aka the little guy that gets called to do the verifying πŸ‘‘

🌸 DESCRIPTION 🌸

Okay so here's the tea β˜• β€” this function sets a callback that gets called when the peer's certificate has been received, so you can verify it on receipt instead of waiting around until after the handshake is done. the way that saves you time... iconic behavior honestly.

Heads up: this overrides any callback you already set using gnutls_certificate_set_verify_function(). so if you set one there and then set one here, this one wins. periodt πŸ’…

The callback's function prototype is:

int (*callback)(gnutls_session_t);

If you do hand over a callback function, then gnutls will call it in the handshake, right after the certificate message has been received. ✨

And to verify or obtain the certificate, you can use these cuties:

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

And the callback function should return 0 for the handshake to continue, or non-zero to terminate. that's it. that's the whole vibe check β€” 0 = keep going, non-zero = we're done here 😭


⭐ SINCE ⭐

3.4.6 β€” she's been around, she's established, she's got lore πŸŽ€


πŸ¦‹ REPORTING BUGS πŸ¦‹

Found a bug? Not me finding a bug πŸ™ˆ report it to <bugs@gnutls.org>.

Home page is over at <https://www.gnutls.org> 🌈


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. fr fr, go off, share it, just keep the notice 🫢


πŸ’œ 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 page bestie, no cap πŸ’– this was gnutls version 3.8.13, manual page gnutls_session_set_verify_function(3), serving looks as always. go forth and verify those certs on receipt, you absolute main character πŸŒŸπŸ’…

πŸ“¦ where this page comes from