GNUTLS_PCERT_LIST_IMPORT_X509_FILE(3)

✨ NAME ✨

gnutls_pcert_list_import_x509_file β€” an API function, bestie πŸ’… (this one lives in the gnutls manual, and honestly? she's a baddie)


πŸŽ€ SYNOPSIS πŸŽ€

#include <gnutls/abstract.h>

int gnutls_pcert_list_import_x509_file(gnutls_pcert_st * pcert_list,
unsigned * pcert_list_size, const char * file, gnutls_x509_crt_fmt_t
format, gnutls_pin_callback_t pin_fn, void * pin_fn_userdata, unsigned
int flags);

πŸ’– ARGUMENTS πŸ’–

  • gnutls_pcert_st * pcert_list β€” the structures where the certs get stored, okay? And listen: it must not contain already-initialized gnutls_pcert_st structures. Fresh out the box, no cap πŸ™…β™€οΈ
  • unsigned * 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 goes in as a limit and comes out as a headcount, she's doing double duty fr fr πŸ’…
  • const char * file β€” a file or a supported URI with the certificates to load 🌸
  • gnutls_x509_crt_fmt_t format β€” either GNUTLS_X509_FMT_DER or GNUTLS_X509_FMT_PEM, but only if a file is given ✨
  • gnutls_pin_callback_t pin_fn β€” a PIN callback, for when it's not globally set 🫢
  • void * pin_fn_userdata β€” the parameter for the PIN callback, obviously πŸ’œ
  • unsigned int flags β€” zero, or flags from gnutls_certificate_import_flags πŸ¦‹

πŸ‘‘ DESCRIPTION πŸ‘‘

Okay so this convenience function will import a certificate chain from the given file (or supported URI) straight into gnutls_pcert_st structures. Iconic behaviour, truly.

Heads up bestie: those structures must be deinitialized afterwards using gnutls_pcert_deinit(). Not optional, she needs her cleanup πŸ’€

And the little detail that matters: this function will always return a sorted certificate chain. Always. Sorted. Ate and left no crumbs ⭐


🌈 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 β€” like, she's telling you to make room, respectfully 😭


🧚 SINCE 🧚

3.6.3 β€” been iconic since way back πŸŽ€


πŸ› 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. (Slay, and also legally binding πŸ’…)


πŸ¦‹ 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 whole page, bestie β€” gnutls version 3.8.13, gnutls_pcert_li...mport_x509_file(3), and yeah the title got truncated in the header but we know her full name πŸ’– mwah, go deinit your pcerts 🫢

πŸ“¦ where this page comes from