gnutls_x509_crt_set_key_usage(3)

✨ gnutls_x509_crt_set_key_usage ✨

okay bestie, pull up a chair, because we're doing certificate extensions today and honestly? it's giving main character energy πŸ’…

this one lives in the gnutls manual β€” yeah, that gnutls, the TLS library that's been carrying the internet on its back since forever 🫢


🌸 NAME 🌸

gnutls_x509_crt_set_key_usage β€” an API function, and no, it's not gonna explain itself, that's literally why we're here πŸ’–


πŸŽ€ SYNOPSIS πŸŽ€

#include <gnutls/x509.h>

int gnutls_x509_crt_set_key_usage(gnutls_x509_crt_t crt, unsigned int
usage);

like, that's the whole vibe. two arguments, one int coming back at you πŸ”₯


πŸ¦‹ ARGUMENTS πŸ¦‹

  • gnutls_x509_crt_t crt β€” a certificate of type gnutls_x509_crt_t. yes the type is literally named the same as the argument, that's just how gnutls rolls, we don't question it πŸ™ˆ this is the cert you're about to mess with.
  • unsigned int usage β€” an ORed sequence of the GNUTLS_KEY_* elements. so you're not passing one single thing, you're passing a lil bundle β€” bitwise-OR them together and hand the whole stack over. it's giving ✨combination platter✨

πŸ’– DESCRIPTION πŸ’–

This function will set the keyUsage certificate extension.

that's it. that's the whole job. you hand it a cert, you hand it a usage (or several ORed together), and it stamps that keyUsage extension right onto the certificate. iconic. no cap πŸ‘‘


🌈 RETURNS 🌈

On success, GNUTLS_E_SUCCESS (0) is returned, otherwise a negative error value.

so like β€” 0 means slay, anything negative means something went sideways and you should go read the error code, fr fr. don't ignore a negative return, that's the universe telling you something 😭


πŸ› REPORTING BUGS πŸ›

found a bug? don't suffer in silence bestie, tell the people:


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.

(translation: go forth and share, just keep the receipts πŸ§ΎπŸ’œ)


πŸ‘€ 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/


lowkey if the local docs aren't there, the website always has you. no gatekeeping in this house 🫢

and that's the page, bestie!! written by the gnutls girlies, version 3.8.13, under the gnutls manual β€” gnutls_x509_crt_set_key_usage(3), periodt πŸ’…βœ¨πŸŒΈ

πŸ“¦ where this page comes from