gnutls_x509_crt_check_hostname(3)

πŸ’– gnutls_x509_crt_check_hostname πŸ’–

okay bestie, so this one lives in the gnutls manual, and it's literally the vibe check for certificates. like, does this cert actually belong to this hostname or is it lying to you? that's the whole thing. let's get into it πŸ¦‹


✨ NAME ✨

gnutls_x509_crt_check_hostname β€” API function


🌸 SYNOPSIS 🌸

#include <gnutls/x509.h>

unsigned gnutls_x509_crt_check_hostname(gnutls_x509_crt_t cert, const
char * hostname);

πŸŽ€ ARGUMENTS πŸŽ€

  • gnutls_x509_crt_t cert β€” bestie this should contain an gnutls_x509_crt_t type. like that's the cert you're interrogating πŸ’…
  • const char * hostname β€” a null terminated string that contains a DNS name. so the name you're checking against, no cap.

πŸ‘‘ DESCRIPTION πŸ‘‘

so here's the tea: this function will check if the given certificate's subject matches the given hostname. that's it, that's the job 🫢

it's a basic implementation of the matching described in RFC6125, and it takes into account wildcards, and the DNSName/IPAddress subject alternative name PKIX extension. so yes, wildcards are handled, and yes, the SAN extension is very much in the room with us πŸ’€

for details see also gnutls_x509_crt_check_hostname2(). iykyk ✨


⭐ RETURNS ⭐

non-zero for a successful match, and zero on failure. so like… truthy = slay, falsy = not slay πŸŽ€


πŸ™ˆ REPORTING BUGS πŸ™ˆ

Report bugs to <bugs@gnutls.org>. Home page: https://www.gnutls.org

if something's broken, tell the gnutls girlies directly, don't suffer in silence πŸ’œ

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.


πŸ’œ 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/

okay that's the whole page, no notes. this is from gnutls 3.8.13, and it was serving gnutls_x509_crt_check_hostname(3) realness the entire time. go check those hostnames, bestie, and stay iconic πŸ‘‘πŸ’–βœ¨

πŸ“¦ where this page comes from