gnutls_x509_crt_check_ip(3)

✨ gnutls_x509_crt_check_ip ✨

okay so bestie, welcome to the gnutls manual, section 3 (library calls, the fun ones) πŸ’– this one is literally called gnutls_x509_crt_check_ip and it's the "does this cert actually belong to this IP" girlie. let's get into it 🫢


🌸 NAME 🌸

gnutls_x509_crt_check_ip β€” the API function that does the IP-matching thing, no cap πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <gnutls/x509.h>

unsigned gnutls_x509_crt_check_ip(gnutls_x509_crt_t cert, const unsigned
char * ip, unsigned int ip_size, unsigned int flags);

like, copy that exactly, don't freestyle it ✨


πŸŽ€ ARGUMENTS πŸŽ€

  • gnutls_x509_crt_t cert β€” this one should contain a gnutls_x509_crt_t type. that's the whole vibe, that's the assignment πŸ’œ
  • const unsigned char * ip β€” a pointer to the raw IP address. raw as in raw raw, not the cute dotted-decimal string version πŸ™ˆ
  • unsigned int ip_size β€” the number of bytes in ip. and the only valid answers are 4 or 16. that's it. 4 or 16. (4 for v4, 16 for v6, iykyk) πŸ‘‘
  • unsigned int flags β€” should be zero. like, genuinely zero. that's the whole job πŸ“

🌈 DESCRIPTION 🌈

so here's the tea β˜• this function checks if the IP allowed IP addresses listed in the certificate's subject alternative name match the IP address you handed it. that's it, that's the function. match β†’ slay, no match β†’ not slay πŸ’…


⭐ RETURNS ⭐

  • non-zero = successful match πŸŽ‰ (yes bestie, you ate)
  • zero = failure 😭 (it's giving "not your cert, not your IP")

πŸ’€ REPORTING BUGS πŸ’€

found a bug? not me gatekeeping the email β€” report it to <bugs@gnutls.org> 🫢

home page: 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. (translation: go off, just keep the receipt 🧾✨)


πŸ”₯ 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, periodt πŸ’… this was page gnutls_x509_crt_check_ip(3) from gnutls version 3.8.13 β€” go forth and match those IPs, main character πŸ¦‹πŸ‘‘πŸ’œ

πŸ“¦ where this page comes from