gnutls_x509_crq_get_key_usage(3)

✨ gnutls_x509_crq_get_key_usage ✨

okay so bestie, this one lives in the gnutls manual, section 3, and it's about peeking at the key usage extension inside a certificate request πŸŽ€


πŸ’– NAME πŸ’–

gnutls_x509_crq_get_key_usage β€” it's literally an API function, that's the whole name, no notes πŸ’…


🌸 SYNOPSIS 🌸

#include <gnutls/x509.h>

int gnutls_x509_crq_get_key_usage(gnutls_x509_crq_t crq, unsigned int *
key_usage, unsigned int * critical);

πŸ¦‹ ARGUMENTS πŸ¦‹

  • gnutls_x509_crq_t crq β€” bestie this one should contain a gnutls_x509_crq_t type, like that's the vibe it needs to be giving ✨
  • unsigned int * key_usage β€” this is where the key usage bits get stored, it's the lil container okay 🫢
  • unsigned int * critical β€” will be non-zero if the extension is marked as critical. so if it's critical, this is giving nonzero 😌

πŸ’œ DESCRIPTION πŸ’œ

So this function returns the certificate's key usage by reading the keyUsage X.509 extension, which is 2.5.29.15 if you're keeping track πŸ‘‘

And the key usage value? It's the ORed values of these absolute icons:

  • 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

all of them, no skipping, they're a set and they ate πŸ”₯


🌈 RETURNS 🌈

It hands you back the certificate key usage πŸ’– … or a negative error code in case of parsing error 😭

And listen β€” if the certificate does not contain the keyUsage extension, you get GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE returned. that's the whole message, no cap, it's just not there πŸ™ˆ


⭐ SINCE ⭐

2.8.0 β€” it's been iconic since 2.8.0, we stan a legacy πŸŽ€


πŸ’€ REPORTING BUGS πŸ’€

Found a bug? Report it to <bugs@gnutls.org> β€” they want to hear it fr fr 🫢

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, remix it, just 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/


and that's the whole page, periodt ✨ this was gnutls_x509_crq_get_key_usage(3), brought to you by gnutls 3.8.13 β€” mwah, go read your certs πŸ’–πŸŒΈπŸ¦‹

πŸ“¦ where this page comes from