GNUTLS_X509_CRT_GET_EXTENSION_OID(3)
π gnutls_x509_crt_get_extension_oid β the manual page bestie π
okay so real talk, this is the gnutls_x509_crt_get_extension_oid page from the gnutls manual (yes the whole gnutls thing, we love her), and it's genuinely so useful. sit down, grab a strawberry π, and let's get into it.
β¨ NAME β¨
gnutls_x509_crt_get_extension_oid β it's an API function, bestie. that's the whole name section. iconic of her honestly.
π SYNOPSIS π
first things first, you gotta pull in the header:
#include <gnutls/x509.h>
and here's the signature, exactly as it lives:
int gnutls_x509_crt_get_extension_oid(gnutls_x509_crt_t cert, unsigned
indx, void * oid, size_t * oid_size);
no cap, that's it. four args, one int coming back at you. π
π ARGUMENTS π
okay let's meet the cast, one by one:
gnutls_x509_crt_t certβ this one "should contain agnutls_x509_crt_ttype". that's the cert you're interrogating, she's the main character of this whole operation πunsigned indxβ this says which extension OID you wanna send. and listen, use(0)to get the first one. zero-indexed, as always, the way the universe intended.void * oidβ a pointer to a structure that's gonna hold the OID. and yes, it may be null. (sometimes you just wanna know the size first, we see you, we respect the strategy π«Ά)size_t * oid_sizeβ this one initially holds the size ofoid. so you tell it how big your buffer is, and it does its thing.
π¦ DESCRIPTION π¦
so what does this function actually do? it returns the requested extension OID from inside the certificate. that's the whole vibe. the extension OID gets stored as a string in the buffer you provided. slay.
and here's the lil detail that gets people every time: the oid that comes back will be null terminated β but the oid_size will not account for that trailing null. so she's null-terminated but the size doesn't count the null. not me being obsessed with this detail. lowkey crucial, iykyk. π
β RETURNS β
on success? GNUTLS_E_SUCCESS (0) is returned. that's the good ending, we love to see it. πΈ
otherwise you get a negative error code back. sad girl hours.
and listen, if you've reached the last extension available, GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE gets returned. that's not a bug bestie, that's just the end of the list. you ran out of extensions. it happens to everyone. π
π REPORTING BUGS π
found something broken? spill it, but nicely, to the actual humans:
Report bugs to <bugs@gnutls.org>.
Home page: https://www.gnutls.org
π COPYRIGHT π
Copyright Β© 2001-2023 Free Software Foundation, Inc., and others.
and the license tea: 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. so like, take it, share it, just keep the receipts. periodt. β¨
π 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, go visit:
https://www.gnutls.org/manual/
that's your next stop, bestie, go read more. π§
ngl, if you're looping through extensions, remember: start at(0), pass a nulloidif you just need the size, and expectGNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEwhen you hit the end. that's the whole strategy. π
and that's the page!! this was gnutls_x509_crt_get_extension_oid(3) from the gnutls manual, version 3.8.13, brought to you by the lovely folks at the Free Software Foundation. thanks for reading, ily, go write some good C π«Άππ
π¦ 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