gnutls_x509_crt_list_import(3)

πŸ’– gnutls_x509_crt_list_import(3) β€” the manual page, but make it make sense

okay bestie so this is a page from the gnutls manual, and it's about one very specific little function that does a very specific little thing. let's get into it πŸ¦‹


✨ NAME ✨

gnutls_x509_crt_list_import β€” yes it's an API function, that's literally the whole name, she's not hiding anything πŸ’…


✨ SYNOPSIS ✨

#include <gnutls/x509.h>

int gnutls_x509_crt_list_import(gnutls_x509_crt_t * certs, unsigned int
* cert_max, const gnutls_datum_t * data, gnutls_x509_crt_fmt_t format,
unsigned int flags);

✨ ARGUMENTS ✨

  • gnutls_x509_crt_t * certs β€” this is where your parsed list is gonna get copied to. Important: it must not be initialized. like don't touch it first, she needs it fresh. no cap.
  • unsigned int * cert_max β€” at first this has to hold the maximum number of certs. then the function updates it with the number of certs that are actually available. so it's giving in-and-out, a lil two-way street 🫢
  • const gnutls_datum_t * data β€” the PEM encoded certificate.
  • gnutls_x509_crt_fmt_t format β€” one of DER or PEM. pick your fighter.
  • unsigned int flags β€” must be 0 or an OR'd sequence of gnutls_certificate_import_flags.

✨ DESCRIPTION ✨

so the whole vibe of this function: it takes the PEM encoded certificate list you handed it and converts it into the native gnutls_x509_crt_t format. the output gets stored in certs. and the bestie part? they will be automatically initialized for you. no manual setup, she just does it ✨

now, the flags. listen up:

  • The flag GNUTLS_X509_CRT_LIST_IMPORT_FAIL_IF_EXCEED will cause import to fail if the certificates in the provided buffer are more than the available structures. like, more certs than you made room for = she's not doing it, sorry πŸ’€
  • The GNUTLS_X509_CRT_LIST_FAIL_IF_UNSORTED flag will cause the function to fail if the provided list is not sorted from subject to issuer. sorted or it's over, periodt.

also, if the Certificate is PEM encoded it should have a header of "X509 CERTIFICATE", or "CERTIFICATE". those exact words, bestie, she checks 🌸


✨ RETURNS ✨

the number of certificates read, or a negative error value. so if it's negative, something went wrong and we're sad 😭


✨ REPORTING BUGS ✨

found a bug? 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. iconic behavior honestly πŸ‘‘


✨ 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, bestie πŸŽ€ this was gnutls version 3.8.13, from the gnutls manual, and yeah that's the whole thing β€” go read a certificate list or something, i believe in you πŸ’œπŸ¦‹

πŸ“¦ where this page comes from