gnutls_pkcs7_import(3)

πŸ’– gnutls_pkcs7_import πŸ’–

okay bestie, welcome to the gnutls manual β€” yes, that whole big cryptography library β€” and today's episode is all about gnutls_pkcs7_import, an API function that literally just takes your PKCS7 blob and makes it ✨native✨. no cap.


🌸 SYNOPSIS 🌸

#include <gnutls/pkcs7.h>

int gnutls_pkcs7_import(gnutls_pkcs7_t pkcs7, const gnutls_datum_t *
data, gnutls_x509_crt_fmt_t format);

πŸŽ€ ARGUMENTS πŸŽ€

  • gnutls_pkcs7_t pkcs7 β€” bestie this is where the parsed PKCS7 goes. it's the spot, the container, the little home for your data. 🏠
  • const gnutls_datum_t * data β€” the DER or PEM encoded PKCS7 itself. the actual goods. πŸ“¦
  • gnutls_x509_crt_fmt_t format β€” one of DER or PEM. pick your fighter. πŸ’…

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the vibe: this function converts the DER or PEM encoded PKCS7 you hand it into the native gnutls_pkcs7_t format. the output lands in pkcs7. simple, iconic, done.

⚠️ okay this part matters, listen up: any signed data that may be present inside the pkcs7 structure β€” like certificates you set with gnutls_pkcs7_set_crt() β€” will be freed and overwritten by this function. like, gone gone. not me warning you twice. 😭

and if your PKCS7 is PEM encoded? it should have a header of "PKCS7". that's the rule, no exceptions. ✨


⭐ RETURNS ⭐

on success, GNUTLS_E_SUCCESS (0) is returned. otherwise you get a negative error value, which is giving "something went wrong and it's telling you in the negative numbers" energy. πŸ’€


🌈 REPORTING BUGS 🌈

found a bug? don't be shy, report it to <bugs@gnutls.org>.

home page is right here: 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. (yes that's the whole thing, it's very generous, we love that for them 🫢)


🧚 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, page gnutls_pkcs7_import(3) β€” go forth and import your PKCS7 responsibly πŸ’œβœ¨

πŸ“¦ where this page comes from