gnutls_x509_ext_import_key_usage(3)

✨ gnutls_x509_ext_import_key_usage ✨

okay bestie, welcome to the gnutls manual page for gnutls_x509_ext_import_key_usage(3) πŸ’– this is an API function and it's here to tell you exactly what a cert is and isn't allowed to do, no cap.


🌸 NAME 🌸

gnutls_x509_ext_import_key_usage β€” it's an API function, bestie. that's the whole name vibe.


πŸŽ€ SYNOPSIS πŸŽ€

#include <gnutls/x509-ext.h>

int gnutls_x509_ext_import_key_usage(const gnutls_datum_t * ext,
unsigned int * key_usage);

like, that's the whole call. two args, one int back, we move. πŸ’…


πŸ¦‹ ARGUMENTS πŸ¦‹

  • const gnutls_datum_t * ext β€” this is the DER encoded extension data. it's the raw bytes, the actual material, the moment before the glow-up. ✨
  • unsigned int * key_usage β€” this is where the key usage bits will be stored. you hand it a pointer and it fills it in, like a bestie holding your bag while you take a pic. 🫢

πŸ’œ DESCRIPTION πŸ’œ

so this function will return the certificate's key usage, okay? it does that by reading the DER data of the keyUsage X.509 extension, which is 2.5.29.15 (iykyk, that's the OID). 🧚

the key usage value you get back will be ORed values of these bad boys right here:

  • GNUTLS_KEY_DIGITAL_SIGNATURE
  • GNUTLS_KEY_NON_REPUDIATION
  • GNUTLS_KEY_KEY_ENCIPHERMENT
  • GNUTLS_KEY_DATA_ENCIPHERMENT
  • GNUTLS_KEY_KEY_AGREEMENT
  • GNUTLS_KEY_KEY_CERT_SIGN
  • GNUTLS_KEY_CRL_SIGN
  • GNUTLS_KEY_ENCIPHER_ONLY
  • GNUTLS_KEY_DECIPHER_ONLY

it's giving bitmask realness. they all get mashed together into that one unsigned int and it's your job to pick them apart. πŸ‘‘


⭐ RETURNS ⭐

you get back the certificate key usage, or a negative error code if the parsing went sideways. πŸ’€

and listen β€” if the certificate does not contain the keyUsage extension at all, you get GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE back. that's not a bug, that's just the cert being mysterious. πŸ™ˆ


🌈 SINCE 🌈

3.3.0 β€” she's been iconic for a minute, fr fr.


πŸ“ REPORTING BUGS πŸ“

found a bug? spill it to <bugs@gnutls.org>. πŸ“§

home page is right here: https://www.gnutls.org β€” go say hi. ✨


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. so like, keep the receipts, bestie. 🫢


πŸ”₯ 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 it, you understood it, main character energy all around. πŸ‘‘

signing off with love from gnutls 3.8.13 β€” that's the version and the vibe, periodt. πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from