gnutls_x509_crq_get_dn_by_oid(3)

gnutls_x509_crq_get_dn_by_oid πŸ’…

okay bestie, this one lives in the gnutls manual, section 3, and it's literally the glow-up that pulls one specific piece of a certificate request's subject name out by OID. sit down, hydrate, let's go 🫢


✨ NAME ✨

gnutls_x509_crq_get_dn_by_oid β€” API function 🌸


✨ SYNOPSIS ✨

#include <gnutls/x509.h>

int gnutls_x509_crq_get_dn_by_oid(gnutls_x509_crq_t crq, const char *
oid, unsigned indx, unsigned int raw_flag, void * buf, size_t *
buf_size);

no cap, that's the whole signature, character for character πŸ‘‘


✨ ARGUMENTS ✨

  • gnutls_x509_crq_t crq β€” should contain a gnutls_x509_crq_t type. that's the cert request you're snooping on, bestie πŸŽ€
  • const char * oid β€” holds an Object Identifier in a null terminated string. give it the OID of the thing you want, as a null-terminated string, periodt.
  • unsigned indx β€” In case multiple same OIDs exist in the RDN, this specifies which to get. Use (0) to get the first one. so if the RDN is giving duplicate-OID energy, this is your picker πŸ¦‹
  • unsigned int raw_flag β€” If non-zero returns the raw DER data of the DN part. raw mode. unfiltered. feral ✨
  • void * buf β€” a pointer to a structure to hold the name (may be NULL). yes, NULL is allowed, she's flexible πŸ’…
  • size_t * buf_size β€” initially holds the size of buf. you tell her how much room she's got, she'll tell you if it wasn't enough 😭

✨ DESCRIPTION ✨

This function will extract the part of the name of the Certificate request subject, specified by the given OID. The output will be encoded as described in RFC2253. The output string will be ASCII or UTF-8 encoded, depending on the certificate data. so like, sometimes plain ASCII, sometimes UTF-8 β€” it depends on what the certificate data is serving 🌈

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 RFC2253 -- in hex format with a 'using gnutls_x509_dn_oid_known().

ngl the manpage source literally trails off mid-sentence right there after that stray ' β€” I'm not going to invent an ending for it, I'm just your faithful messenger πŸ’€ what I can tell you is what it actually says: known OIDs come back as text when raw flag is (0), and other OIDs come back DER encoded per RFC2253, in hex format, with a '... and then the sentence just leaves the chat. iconic behaviour, honestly πŸ™ˆ

✨ RETURNS ✨

GNUTLS_E_SHORT_MEMORY_BUFFER if the provided buffer is not long enough, and in that case the * buf_size will be updated with the required size. On success 0 is returned.

so: buffer too smol? you get the error and she updates * buf_size with exactly how much room she needs. then you come back with a bigger buffer and slay πŸ’– zero means we ate.


✨ REPORTING BUGS ✨

Report bugs to <bugs@gnutls.org>.

Home page: https://www.gnutls.org

found something cursed? tell the gnutls girlies, they want to know 🫢


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. (free to share, just keep the receipts, bestie πŸ“œ)


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


that's the whole page, no crumbs left behind πŸŽ€ this was gnutls version 3.8.13, served fresh from the gnutls 3 manpage collection, and yes the copyright is Β© 2001-2023 Free Software Foundation, Inc., and others β€” mwah, bye bestie πŸ’œβœ¨

πŸ“¦ where this page comes from