GNUTLS_PCERT_LIST_IMPORT_X509_RAW(3)

✨ gnutls_pcert_list_import_x509_raw ✨

okay bestie, gather round, because we're about to get into the gnutls manual (yes, that gnutls, the GNU TLS library, we're literally in the big leagues πŸ’…) and this one is a banger. It's an API function. It's giving "I import your certificates and I look cute doing it". Let's go πŸ¦‹


🌸 NAME 🌸

gnutls_pcert_list_import_x509_raw β€” it's an API function, periodt.


πŸŽ€ SYNOPSIS πŸŽ€

#include <gnutls/abstract.h>

int gnutls_pcert_list_import_x509_raw(gnutls_pcert_st * pcert_list,
unsigned int * pcert_list_size, const gnutls_datum_t * data,
gnutls_x509_crt_fmt_t format, unsigned int flags);

πŸ’– ARGUMENTS πŸ’–

  • gnutls_pcert_st * pcert_list β€” these are the structures where the certs are gonna live. and like, must not already contain initialized gnutls_pcert_st structures, ok? don't bring pre-loaded baggage to this function, it's not that kind of party πŸ™ˆ
  • unsigned int * pcert_list_size β€” at first this has to hold the maximum number of certs. then it gets updated with the number of certs that are actually available. so it's an in-and-out situation, she changes on the way through ✨
  • const gnutls_datum_t * data β€” the certificates themselves. the main characters πŸ‘‘
  • gnutls_x509_crt_fmt_t format β€” one of DER or PEM. pick your fighter, no third option bestie πŸ’€
  • unsigned int flags β€” must be (0) or an OR'd sequence of gnutls_certificate_import_flags. that's it, that's the whole rule 🫢

🌈 DESCRIPTION 🌈

so basically, this function imports the DER or PEM encoded certificates you hand it into an already allocated set of gnutls_pcert_st structures. key word: already allocated. she does not allocate for you, she fills in what you gave her, ok? πŸ’…

and the way that you must deinitialize those structures afterwards using gnutls_pcert_deinit()... yeah, no skipping that step, that's the cleanup era and we respect it 🧚

also, pcert_list should contain space for at least pcert_list_size elements. lowkey important. highkey important actually.

if the certificate is PEM encoded, it should have a header of "X509 CERTIFICATE", or "CERTIFICATE". those exact strings, don't get creative with the header, she's picky 😭


⭐ RETURNS ⭐

on success, GNUTLS_E_SUCCESS (0) is returned πŸŽ‰ otherwise you get a negative error value. and if the pcert list doesn't have enough space, GNUTLS_E_SHORT_MEMORY_BUFFER will be returned β€” that's your cue that you under-allocated, bestie, size up πŸ“


πŸ¦‹ SINCE πŸ¦‹

3.0 β€” she's been iconic for a minute, no cap.


πŸ’œ REPORTING BUGS πŸ’œ

found a bug? not the vibe. report it to <bugs@gnutls.org> and they'll handle it 🫢

home page is over at https://www.gnutls.org β€” go say hi.


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. so like, go off, just keep the receipts πŸ’–


πŸ”₯ 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/

that's the mothership, that's where all the lore lives πŸ“šβœ¨


and that's the whole page bestie, every option, every return code, every string, all of it, untouched. slay πŸ’…

okay bye ily, this was gnutls version 3.8.13 from the gnutls_pcert_list_import_x509_raw(3) manual page, mwah πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from