gnutls_x509_cr...tension_by_oid2(3)

πŸ’– gnutls_x509_crt_get_extension_by_oid2 πŸ’–

okay bestie, so this one lives in the gnutls manual, and it's lowkey one of the most useful little x509 helpers you'll ever meet. it's literally the "gimme that one extension, i know its OID" function. no cap. πŸŽ€


✨ NAME ✨

gnutls_x509_crt_get_extension_by_oid2 β€” API function πŸ’…


🌸 SYNOPSIS 🌸

#include <gnutls/x509.h>

int gnutls_x509_crt_get_extension_by_oid2(gnutls_x509_crt_t cert, const
                                          char * oid, unsigned indx,
                                          gnutls_datum_t * output,
                                          unsigned int * critical);

πŸ¦‹ ARGUMENTS πŸ¦‹

  • gnutls_x509_crt_t cert β€” this should contain a gnutls_x509_crt_t type, bestie. like, the actual certificate you're digging through. πŸ‘‘
  • const char * oid β€” holds an Object Identified in null terminated string. yes, an Object Identified, that's what the original says and i'm not gonna gaslight you about it β€” it's your OID, as a null terminated string. 🌈
  • unsigned indx β€” in case multiple same OIDs exist in the extensions, this specifies which to send. use (0) to get the first one. the way that one certificate can have the same OID more than once is honestly iconic of it. 😭
  • gnutls_datum_t * output β€” will hold the allocated extension data. it's giving "here's your buffer, it's been allocated for you". πŸ“
  • unsigned int * critical β€” will be non-zero if the extension is marked as critical. so basically: truthy = critical, zero = chill. ⭐

πŸ’œ DESCRIPTION πŸ’œ

this function will return the extension specified by the OID in the certificate. periodt.

the extensions will be returned as binary data DER encoded, in the provided buffer. so what you get back is raw DER bytes, not some pretty printed thing β€” that's on you, babe. 🧚


πŸ‘‘ RETURNS πŸ‘‘

on success, GNUTLS_E_SUCCESS (0) is returned. otherwise a negative error code is returned. πŸ”₯

and listen β€” if the certificate does not contain the specified extension, GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE will be returned. so don't panic when you see it, it just means "girl, that extension isn't in there". πŸ’€


🌟 SINCE 🌟

3.3.8 β€” she's been around a minute, she's a veteran. 🫢


πŸ™ˆ REPORTING BUGS πŸ™ˆ

found something cursed? report bugs to <bugs@gnutls.org>.

home page: 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. slay, that's the whole license vibe right there. ✨


🌈 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/

fr fr, that's everything β€” every argument, every return code, every copyright line, untouched, just with better vibes. iykyk. πŸ’…

and that's a wrap, bestie πŸŽ€ β€” this page came straight out of gnutls 3.8.13, so go forth and fetch those extensions. mwah. πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from