gnutls_x509_crt_list_import2(3)

✨ gnutls_x509_crt_list_import2 ✨

okay bestie, so this is a page from the gnutls manual β€” yes, that gnutls, the TLS library that's been holding down the internet since forever πŸ’… β€” and today we're looking at gnutls_x509_crt_list_import2(3), which is literally the "turn a blob of certs into actual usable cert objects" function. it's giving API function, it's giving glow-up for your PEM data 🌸


🌈 SYNOPSIS 🌈

#include <gnutls/x509.h>

int gnutls_x509_crt_list_import2(gnutls_x509_crt_t ** certs, unsigned
int * size, const gnutls_datum_t * data, gnutls_x509_crt_fmt_t format,
unsigned int flags);

πŸŽ€ ARGUMENTS πŸŽ€

  • gnutls_x509_crt_t ** certs β€” this is where the parsed certificate list is gonna live. it will hold it. it's the main character slot 🫢
  • unsigned int * size β€” and this one? it will contain the size of the list. like, how many crts are in there. iconic.
  • const gnutls_datum_t * data β€” the PEM encoded certificate. that's the raw input, the vibe before the glow-up.
  • gnutls_x509_crt_fmt_t format β€” one of DER or PEM. pick one, no cap.
  • unsigned int flags β€” must be (0) or an OR'd sequence of gnutls_certificate_import_flags. no random numbers here bestie, they have to be the actual flags 😭

πŸ’– DESCRIPTION πŸ’–

so like, the way this works: this function will convert the given PEM encoded certificate list to the native gnutls_x509_crt_t format. the output will be stored in certs, which will be allocated and initialized. periodt ✨

if the Certificate is PEM encoded it should have a header of "X509 CERTIFICATE", or "CERTIFICATE". those exact strings, bestie, don't freestyle them πŸ™ˆ

okay so the cleanup part is lowkey important: to deinitialize certs, you need to deinitialize each crt structure independently, and use gnutls_free() at certs. not one, not the other β€” both. it's giving "two-step skincare routine" but for memory πŸ’…

⭐ RETURNS ⭐

GNUTLS_E_SUCCESS on success, otherwise a negative error code. slay when it works, sad girl hours when it doesn't 😭


πŸ¦‹ SINCE πŸ¦‹

3.0 β€” she's been here a minute, an OG fr fr.


🌸 REPORTING BUGS 🌸

Report bugs 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.


πŸ’œ 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 came straight out of the gnutls manual, version 3.8.13, dated with the classic gnutls_x509_crt_list_import2(3) header energy πŸŽ€ go forth and import those certs, you absolute legend 🫢✨

πŸ“¦ where this page comes from