GNUTLS_X509_CRT_GET_ISSUER_DN_BY_OID(3)
π gnutls_x509_crt_get_issuer_dn_by_oid β okay bestie, let's read a cert's issuer like it's a group chat π
This lil icon lives in the gnutls manual, section 3, and it's an API function. Yes, the gnutls. Sit down, hydrate, we're doing X.509 today. π
β¨ NAME β¨
gnutls_x509_crt_get_issuer_dn_by_oid β API function
Like. That's the whole name. It's giving "I extract one specific piece of the issuer's distinguished name." Slay.
πΈ SYNOPSIS πΈ
#include <gnutls/x509.h>
int gnutls_x509_crt_get_issuer_dn_by_oid(gnutls_x509_crt_t cert, const
char * oid, unsigned indx, unsigned int raw_flag, void * buf, size_t *
buf_size);
Six args, one int back. No cap, that's just the signature. π
π¦ ARGUMENTS π¦
gnutls_x509_crt_t certβ bestie this should hold agnutls_x509_crt_ttype. That's the cert we're snooping on. πconst char * oidβ holds an Object Identified in null terminated string. (Yes the original says "Object Identified", we're keeping that energy, it's iconic.) So like, a null-terminated OID string. β¨unsigned indxβ in case multiple same OIDs exist in the RDN, this says which one you want. Use(0)to get the first one. Zero-indexed, obviously, we love a first-element situation. πunsigned int raw_flagβ if non-zero, returns the raw DER data of the DN part. Raw. Unfiltered. No makeup. πvoid * bufβ a pointer to a structure to hold the name (may be null). Yes, may be null, that's legal here, it's not a mistake, we'll get to it. π«Άsize_t * buf_sizeβ initially holds the size ofbuf. So like, you tell it how much room you brought. π
π DESCRIPTION π
Okay so here's the tea. This function will extract the part of the name of the Certificate issuer specified by the given OID. That's it, that's the job, and it does it flawlessly. π
The output, if the raw flag is not used, will be encoded as described in RFC4514. Thus a string that is ASCII or UTF-8 encoded, depending on the certificate data. So the encoding is doing a vibe check on your cert and picking accordingly. β¨
Some helper macros with popular OIDs can be found in gnutls/x509.h. If raw flag is (0), this function will only return known OIDs as text. Other OIDs will be DER encoded, as described in RFC4514 β in hex format with a '#' prefix. You can check about known OIDs using gnutls_x509_dn_oid_known(). So if you're getting a #-prefixed hex blob, that's not a bug, that's the function telling you "this OID is not one of the known ones, bestie." π₯
If buf is null then only the size will be filled. Cute, right? It's like window shopping. If the raw_flag is not specified the output is always null terminated, although the buf_size will not include the null character. That last bit is the trap. The null terminator is a little ghost π» β it's there in the buffer, but it's not counted in buf_size. Plan your allocations accordingly, bestie.
Also lowkey important: buf may be null, and when it is, all you get back is the size. That's a feature, not a flop.
π RETURNS π
GNUTLS_E_SHORT_MEMORY_BUFFERβ if the provided buffer is not long enough, and in that case thebuf_sizewill be updated with the required size. So it's not even being rude, it's telling you exactly how much more room you need. Helpful king. πGNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEβ if there are no data in the current index. Yourindxwent somewhere empty. Nothing there. Ghost town. π- On success 0 is returned. Zero. The good zero. β¨
π REPORTING BUGS π
Found a bug? Don't suffer in silence, tell the whole group chat:
- Report bugs to <bugs@gnutls.org>.
- Home page: https://www.gnutls.org
π 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.
(Translation: share it, remix it, print it on a tote bag, just keep the receipts. π«Ά)
π 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/
Like, if the local copy isn't there, the website literally always has your back. π¦
Mwah π this was the gnutls manual, page version 3.8.13, section 3 β gnutls_x509_crt_get_issuer_dn_by_oid(3). Go extract some issuer DNs, bestie, you're literally the main character of your own certificate chain. Periodt. πβ¨
π¦ 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