gnutls_x509_crt_privkey_sign(3)

πŸ’– gnutls_x509_crt_privkey_sign β€” the glow-up moment πŸ’–

okay bestie, so this one is from the gnutls manual, and it's the final boss of certificate making. it's literally the part where your cert gets its signature and becomes a real one. main character energy fr fr ✨


✨ NAME ✨

gnutls_x509_crt_privkey_sign β€” an API function, no cap 🫢


πŸŽ€ SYNOPSIS πŸŽ€

#include <gnutls/abstract.h>

int gnutls_x509_crt_privkey_sign(gnutls_x509_crt_t crt,
gnutls_x509_crt_t issuer, gnutls_privkey_t issuer_key,
gnutls_digest_algorithm_t dig, unsigned int flags);

🌸 ARGUMENTS 🌸

  • gnutls_x509_crt_t crt β€” a certificate of type gnutls_x509_crt_t. this is the baby you're signing πŸ’…
  • gnutls_x509_crt_t issuer β€” is the certificate of the certificate issuer. the one doing the signing, the queen bee πŸ‘‘
  • gnutls_privkey_t issuer_key β€” holds the issuer's private key πŸ”‘ keep it safe, don't be out here leaking it
  • gnutls_digest_algorithm_t dig β€” The message digest to use. GNUTLS_DIG_SHA256 is a safe choice. like, just pick SHA256 bestie, it's the safe one πŸ’–
  • unsigned int flags β€” must be 0. that's it. zero. nothing else. periodt πŸ’€

πŸ¦‹ DESCRIPTION πŸ¦‹

so what does this do? it signs the certificate with the issuer's private key, and β€” here's the cute part β€” it copies the issuer's information into the certificate. like, the issuer's whole vibe gets transferred over. it's giving ✨inheritance✨

this has to be the last step in a certificate generation. like, THE last one. because all the previously set parameters are now signed. once you do this, everything you set before is locked in. no take-backs, no edits, no "wait actuallyβ€”" πŸ™ˆ

ngl there's a known limitation of this function that you need to know about: a newly-signed certificate will not be fully functional (e.g., for signature verification) until it is exported and re-imported. yeah. it's a whole thing. you sign it, then you gotta ship it out and bring it back for it to work properly. iykyk 😭

and a lil glow-up note: after GnuTLS 3.6.1 the value of dig may be GNUTLS_DIG_UNKNOWN, and in that case, a suitable but reasonable one for the key algorithm will be selected. so if you don't feel like choosing, the library chooses for you. slay 🌈


⭐ RETURNS ⭐

On success, GNUTLS_E_SUCCESS (0) is returned. otherwise it's a negative error value. negative = not the vibe, go check your error handling bestie πŸ’œ


πŸ“ REPORTING BUGS πŸ“

found a bug? don't gatekeep, report it:


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/


okay that's the whole page, you ate that 🫢 go sign some certificates responsibly, and remember: export and re-import or it won't work, that's not me being dramatic that's literally in the docs πŸ’…

this was page gnutls_x509_crt_privkey_sign(3) from gnutls 3.8.13 β€” mwah, stan the Free Software Foundation, bye bestie πŸŽ€βœ¨

πŸ“¦ where this page comes from