gnutls_x509_crt_get_key_usage(3)
π gnutls_x509_crt_get_key_usage π
okay bestie, so this one lives in the gnutls manual, section 3 β aka the "you type man 3 gnutls_x509_crt_get_key_usage and the whole vibe is C library functions" corner of the internet. it's giving β¨certificate inspectionβ¨ and honestly? we're obsessed.
β¨ NAME β¨
gnutls_x509_crt_get_key_usage β API function π
π¦ SYNOPSIS π¦
#include <gnutls/x509.h>
int gnutls_x509_crt_get_key_usage(gnutls_x509_crt_t cert, unsigned int *
key_usage, unsigned int * critical);
πΈ ARGUMENTS πΈ
gnutls_x509_crt_t certβ bestie this should contain agnutls_x509_crt_ttype, no cap. that's literally the whole job. πunsigned int * key_usageβ this is where the key usage bits get stored. like, the function drops them off here and dips. πunsigned int * criticalβ will be non-zero if the extension is marked as critical. so if it's not zero, the cert is being very serious about this extension. main character energy fr. π¨
π DESCRIPTION π
okay so this function will return the certificate's key usage, and it does that by reading the keyUsage X.509 extension, which is 2.5.29.15. iykyk. π₯
the key usage value you get back is gonna be the ORed values of these absolute icons:
GNUTLS_KEY_DIGITAL_SIGNATUREGNUTLS_KEY_NON_REPUDIATIONGNUTLS_KEY_KEY_ENCIPHERMENTGNUTLS_KEY_DATA_ENCIPHERMENTGNUTLS_KEY_KEY_AGREEMENTGNUTLS_KEY_KEY_CERT_SIGNGNUTLS_KEY_CRL_SIGNGNUTLS_KEY_ENCIPHER_ONLYGNUTLS_KEY_DECIPHER_ONLY
the way it just *or*s them all together... bitwise baddie behavior. π
β RETURNS β
zero on success π«Ά β or a negative error code in case of a parsing error π.
and listen: if the certificate does not contain the keyUsage extension, then GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE will be returned. so don't come for her, she's literally telling you the data isn't there. π
π REPORTING BUGS π
found a bug? report it to <bugs@gnutls.org> π
home page: https://www.gnutls.org π
π COPYRIGHT π
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. slay, that's the license, periodt. π
πΈ 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 was gnutls version 3.8.13 doing its thing, and yes we love her for it. go read some certs. bye!! πβ¨π
π¦ where this page comes from
- alpine 3.22: gnutls-doc 3.8.13-r0 Β· LGPL-2.1-or-later
- alpine 3.23: gnutls-doc 3.8.13-r0 Β· LGPL-2.1-or-later
- alpine 3.24: gnutls-doc 3.8.13-r0 Β· LGPL-2.1-or-later
- arch rolling: gnutls 3.8.13-3 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 43: gnutls-devel 3.8.13-1.fc43 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 43: gnutls-devel 3.8.13-1.fc43 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 44: gnutls-devel 3.8.13-1.fc44 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 44: gnutls-devel 3.8.13-1.fc44 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- ubuntu stonking: gnutls-doc 3.8.13-1ubuntu1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms