gnutls_pkcs7_sign(3)

πŸ’– gnutls_pkcs7_sign β€” like, the PKCS#7 signing era πŸ’–

okay bestie, this one lives in the gnutls manual (section 3, the library functions girlies), and it's literally the "put a signature on a PKCS 7 structure" function. no cap. let's get into it πŸŽ€


✨ NAME ✨

gnutls_pkcs7_sign β€” API function πŸ¦‹


✨ SYNOPSIS ✨

#include <gnutls/pkcs7.h>

int gnutls_pkcs7_sign(gnutls_pkcs7_t pkcs7, gnutls_x509_crt_t signer,
gnutls_privkey_t signer_key, const gnutls_datum_t * data,
gnutls_pkcs7_attrs_t signed_attrs, gnutls_pkcs7_attrs_t unsigned_attrs,
gnutls_digest_algorithm_t dig, unsigned flags);

✨ ARGUMENTS ✨

  • gnutls_pkcs7_t pkcs7 β€” should contain a gnutls_pkcs7_t type πŸ’…
  • gnutls_x509_crt_t signer β€” the certificate that's doing the signing of the structure πŸ‘‘
  • gnutls_privkey_t signer_key β€” the key that's doing the signing of the structure πŸ”‘
  • const gnutls_datum_t * data β€” the data to be signed, or NULL if the data are already embedded 🫣
  • gnutls_pkcs7_attrs_t signed_attrs β€” any additional attributes to be included in the signed ones (or NULL) ✍️
  • gnutls_pkcs7_attrs_t unsigned_attrs β€” any additional attributes to be included in the unsigned ones (or NULL) πŸ™ˆ
  • gnutls_digest_algorithm_t dig β€” the digest algorithm to use for signing 🌈
  • unsigned flags β€” should be zero or one of the GNUTLS_PKCS7 flags ⭐

✨ DESCRIPTION ✨

so this function will add a signature into the PKCS 7 structure you handed it, for the data you handed it. that's the whole assignment bestie, and it ate πŸ’…

and the iconic part? you can make multiple signatures with different signers. not me being a polyamorous-signature icon πŸ”₯

the available flags are: GNUTLS_PKCS7_EMBED_DATA, GNUTLS_PKCS7_INCLUDE_TIME, GNUTLS_PKCS7_INCLUDE_CERT, and GNUTLS_PKCS7_WRITE_SPKI. they are explained in the gnutls_pkcs7_sign_flags definition β€” go read that one, iykyk πŸ“–


✨ RETURNS ✨

on success, GNUTLS_E_SUCCESS (0) is returned πŸŽ‰ otherwise you get a negative error value 😭 (it's giving "the vibe check failed", fr fr)


✨ SINCE ✨

3.4.2 β€” a classic, been serving since way back 🧚


✨ 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. slay, that's the license, no gatekeeping here πŸ’–


✨ 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 3.8.13, dated with the gnutls_pkcs7_sign(3) footer energy β€” mwah, go sign something, periodt πŸ’…βœ¨

πŸ“¦ where this page comes from