gnutls_x509_ext_export_key_usage(3)
π gnutls_x509_ext_export_key_usage(3) β the gnutls manual, but make it make sense
okay bestie, sit down, hydrate, and let me tell you about a little function from the gnutls manual (that's the manual name, she's famous) that turns your key usage vibes into actual DER-encoded PKIX extension bytes. it's giving glow-up for bit strings β¨
πΈ NAME πΈ
gnutls_x509_ext_export_key_usage β an API function, and yes she's iconic for it π
β¨ SYNOPSIS β¨
#include <gnutls/x509-ext.h>
int gnutls_x509_ext_export_key_usage(unsigned int usage, gnutls_datum_t
* ext);
like. look at her. two args. no drama. periodt π
π¦ ARGUMENTS π¦
unsigned int usageβ an ORed sequence of theGNUTLS_KEY_*elements. so you literally just mash your flags together with|and she understands, no cap π«Άgnutls_datum_t * extβ the DER-encoded extension data. and listen, bestie, you must free this withgnutls_free(). notfree(). not vibes.gnutls_free(). the way that leaks are NOT the aesthetic π
π DESCRIPTION π
so what does she actually do? this function converts the keyUsage bit string into a DER encoded PKIX extension. that's the whole plot. the ext data gets allocated using gnutls_malloc(), which is exactly why you're freeing it with gnutls_free() later β they're a matched set, they're soulmates, don't separate them π
π RETURNS π
on success you get GNUTLS_E_SUCCESS (that's 0, the good number, the slay number) β¨ otherwise you get a negative error value. negative. as in, not it. as in, check your flags boo π
β SINCE β
3.3.0 β she's been around, she's got history, she's a legacy queen π
π REPORTING BUGS π
found something cursed? don't just tweet about it, report bugs to <bugs@gnutls.org>. π
home page: https://www.gnutls.org β go, be nosy, it's fine πΈ
π 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. fr fr, that's the deal, and it's a generous one π«Ά
π§ 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/
iykyk, that's the mothership π«
lowkey reminder:usageis ORedGNUTLS_KEY_*elements,extis DER-encoded extension data, and it must be freed usinggnutls_free(). no skipping, bestie π
and that's the page!! this one shipped as part of gnutls 3.8.13 (that's the source and version, right there in the footer, she said it herself) β mwah, go export some key usage, you're doing amazing sweetie πβ¨π
π¦ 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