gnutls_x509_crt_sign2(3)

✨ gnutls_x509_crt_sign2 ✨

okay bestie, gather round, because this is the gnutls_x509_crt_sign2(3) page from the gnutls manual and it's literally the moment your certificate gets its official signature πŸ’…


🌸 NAME 🌸

gnutls_x509_crt_sign2 β€” it's an API function, periodt ✨


πŸŽ€ SYNOPSIS πŸŽ€

#include <gnutls/x509.h>

int gnutls_x509_crt_sign2(gnutls_x509_crt_t crt, gnutls_x509_crt_t
       issuer, gnutls_x509_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 your main character, the one getting signed πŸ‘‘
  • gnutls_x509_crt_t issuer β€” is the certificate of the certificate issuer. the whole "who's vouching for you" situation 🫢
  • gnutls_x509_privkey_t issuer_key β€” holds the issuer's private key πŸ”‘ keep it safe, no cap
  • gnutls_digest_algorithm_t dig β€” The message digest to use, GNUTLS_DIG_SHA256 is a safe choice. like, genuinely, just use SHA256 bestie πŸ’œ
  • unsigned int flags β€” must be 0. that's it. that's the whole assignment. zero. 🚫

πŸ’– DESCRIPTION πŸ’–

so this function will sign the certificate with the issuer's private key, and will copy the issuer's information into the certificate. two things, one call, slay ✨

This must be the last step in a certificate generation since all the previously set parameters are now signed. like, once you do this, the door is closed, the vibe is locked in, everything before it is now part of the signed package. so don't be out here calling it early, okay? πŸ™ˆ

A known limitation of this function is, that a newly-signed certificate will not be fully functional (e.g., for signature verification), until it is exported an re-imported.

yeah bestie that's real, that's in the docs, that's not me being dramatic 😭 export it, re-import it, then it's fully functional. the way that it just has to be Like That... it's giving "known limitation" and we respect it πŸ’€

After GnuTLS 3.6.1 the value of dig may be GNUTLS_DIG_UNKNOWN, and in that case, a suitable but reasonable for the key algorithm will be selected. so if you're on the newer side of things, you can just hand it GNUTLS_DIG_UNKNOWN and it'll pick something appropriate for the key algorithm itself 🧚 lowkey convenient


🌈 RETURNS 🌈

On success, GNUTLS_E_SUCCESS (0) is returned, otherwise a negative error value. so if you see 0, we're winning, if you see negative, something went sideways and you gotta go read the error πŸ’…


πŸ“ REPORTING BUGS πŸ“

found a bug? tell the gnutls girlies: 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. like, go off, share it, just keep the notice, that's the deal 🫢


πŸ‘‘ 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 is gnutls version 3.8.13, page gnutls_x509_crt_sign2(3), and it's dated with that same version tag β€” go forth and sign responsibly, mwah πŸ’–πŸŽ€βœ¨

πŸ“¦ where this page comes from