GNUTLS_X509_CRT_GET_EXTENSION_BY_OID(3)

✨ gnutls_x509_crt_get_extension_by_oid β€” the manual page bestie πŸ’–

okay so this is a page from the gnutls manual (you know, the TLS library, she's iconic, she's giving secure-connection main character energy) πŸŽ€ and we're about to get into one very specific little function. buckle up, it's actually not that deep, i promise. ✨


🌸 NAME 🌸

gnutls_x509_crt_get_extension_by_oid β€” bestie, it's an API function πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <gnutls/x509.h>

int gnutls_x509_crt_get_extension_by_oid(gnutls_x509_crt_t cert, const
                                         char * oid, unsigned indx, void * buf, size_t * buf_size, unsigned int *
                                         critical);

like look at her. five-ish params, one int return, no drama. 🫢


πŸ’œ ARGUMENTS πŸ’œ

  • gnutls_x509_crt_t cert β€” this one should contain a gnutls_x509_crt_t type. that's the certificate you're snooping around in. πŸ“œ
  • const char * oid β€” holds an Object Identified in a null terminated string. yes, that's exactly how the original words it, and yes we're keeping it fr fr. πŸ”
  • unsigned indx β€” so like, in case multiple same OIDs exist in the extensions, this specifies which to send. use (0) to get the first one. because apparently some certs are extra and have duplicates πŸ™ˆ
  • void * buf β€” a pointer to a structure to hold the name (it may be null). ngl, "name" is what the original says here, we're not gonna fight it. 🧺
  • size_t * buf_size β€” initially holds the size of buf. it knows how big the buffer is before you start, so be honest with it. πŸ“
  • unsigned int * critical β€” will be non-zero if the extension is marked as critical. so basically a little flag that goes πŸ‘€ when something's marked critical. 🚨

🌈 DESCRIPTION 🌈

so the whole vibe of this function is: it will return the extension specified by the OID in the certificate. and the extensions will be returned as binary data DER encoded, in the provided buffer. that's it, that's the whole thing, no cap. πŸ’–


⭐ RETURNS ⭐

on success, GNUTLS_E_SUCCESS (0) is returned. slay. otherwise a negative error code is returned, which is the universe telling you no. 😭

and if the certificate does not contain the specified extension, GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE will be returned. so like, the data you asked for? not available. it said what it said. πŸ’€


πŸŽ€ REPORTING BUGS πŸŽ€

found a bug? report it to <bugs@gnutls.org>. they wanna hear about it, for real.

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. (yes that's the whole legal bit, verbatim, because we do not mess with license text, ever.) πŸ“œπŸ’…


🌟 SEE ALSO 🌟

the full documentation for gnutls is maintained as a Texinfo manual. so if the /usr/share/doc/gnutls/ directory does not contain the HTML form, visit:

https://www.gnutls.org/manual/

go read it, it's giving lore. πŸ“šπŸ¦‹


okay that's the whole page bestie, every flag, every return code, every link, all of it, preserved like a pressed flower 🌸

this was pulled from the gnutls manual, version 3.8.13, and the page itself is the gnutls_x509_crt_get_extension_by_oid(3) entry β€” the copyright line up there runs 2001-2023, so that's our date energy πŸŽ€. mwah, go get those extensions. πŸ’–βœ¨

πŸ“¦ where this page comes from