GNUTLS_X509_CRT_GET_EXTENSION_INFO(3)

✨ NAME ✨

gnutls_x509_crt_get_extension_info β€” an API function, bestie πŸ’– (and yes, it lives in section 3 of the gnutls manual, iykyk)


🌸 SYNOPSIS 🌸

#include <gnutls/x509.h>

int gnutls_x509_crt_get_extension_info(gnutls_x509_crt_t cert, unsigned
indx, void * oid, size_t * oid_size, unsigned int * critical);

πŸŽ€ ARGUMENTS πŸŽ€

  • gnutls_x509_crt_t cert β€” okay so this should contain a gnutls_x509_crt_t type. that's the vibe. πŸ¦‹
  • unsigned indx β€” tells us which extension OID we're asking for. Use (0) to get the first one, like the very first episode of your fave series. ✨
  • void * oid β€” a pointer to a structure that's gonna hold the OID. it's the little house where the OID moves in 🏠
  • size_t * oid_size β€” on the way in, it holds the maximum size of oid. on the way out? it holds the actual size of oid. glow up, honestly. πŸ’…
  • unsigned int * critical β€” output variable carrying the critical flag. it may be NULL, no pressure bestie 🫢

πŸ’œ DESCRIPTION πŸ’œ

So this function returns the requested extension OID in the certificate, plus the critical flag for it. The extension OID gets stored as a string in the buffer you provided. Then use gnutls_x509_crt_get_extension() to extract the actual data β€” that's a different function, don't mix them up, not me doing that πŸ™ˆ

If the buffer you provided is not long enough to hold the output, then oid_size is updated and GNUTLS_E_SHORT_MEMORY_BUFFER will be returned. Sad but honest. 😭

The oid returned will be null terminated, although oid_size will not account for the trailing null. And heads up β€” that last part is not true for GnuTLS prior to 3.6.0, so if you're on something ancient, vibe check your version first. ⭐


πŸ”₯ RETURNS πŸ”₯

On success, GNUTLS_E_SUCCESS (0) is returned β€” slay. Otherwise a negative error code is returned. And if you have reached the last extension available, GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE will be returned. that's it, no more extensions, the list said goodbye πŸ’€


🌈 REPORTING BUGS 🌈

Found a bug? Report it to <bugs@gnutls.org>. they wanna hear about 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. iconic behavior, honestly πŸ’–


🧚 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 bestie that's the whole page, every last flag and error code accounted for, no cap 🫢✨

gnutls version 3.8.13, hanging out in section 3 of the manual, written on the day the footer says. mwah, take care of your extensions πŸ’…πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from