gnutls_x509_crt_get_dn3(3)

πŸ’– gnutls_x509_crt_get_dn3(3) πŸ’–

okay bestie, so this one lives in the gnutls manual (that's the manual name, keeping it cute for you) and it's literally just... getting the Distinguished Name out of a certificate. the whole vibe. let's go πŸ¦‹


✨ NAME ✨

gnutls_x509_crt_get_dn3 β€” API function. that's it, that's the name, no notes πŸ’…


🌸 SYNOPSIS 🌸

#include <gnutls/x509.h>

int gnutls_x509_crt_get_dn3(gnutls_x509_crt_t cert, gnutls_datum_t * dn,
       unsigned flags);

look at that signature, she's giving three arguments and a dream ✨


πŸŽ€ ARGUMENTS πŸŽ€

  • gnutls_x509_crt_t cert β€” this one should contain a gnutls_x509_crt_t type. that's the whole job. that's the assignment. πŸ‘‘
  • gnutls_datum_t * dn β€” a pointer to a structure that's gonna hold the name. heads up bestie, you must free it using gnutls_free(). it is not a "leak it and hope" situation, it is a "you own this memory now" situation. 🫢
  • unsigned flags β€” either zero, or GNUTLS_X509_DN_FLAG_COMPAT. pick your fighter. no cap. ⭐

πŸ’œ DESCRIPTION πŸ’œ

so what does she actually do? this function will allocate a buffer and copy the name of the Certificate into it. iconic behaviour honestly.

the name comes out in the form "C=xxxx,O=yyyy,CN=zzzz" β€” exactly like RFC4514 describes it. we love a standards-compliant moment.

the output string is going to be ASCII or UTF-8 encoded, depending on what's in the certificate data. it's giving "we'll see what the cert says" energy and honestly? respect. 🧚

now here's the fun part. when you pass the flag GNUTLS_X509_DN_FLAG_COMPAT, the output format will match the format that was output by versions of GnuTLS previous to 3.5.6 β€” which was not not fully RFC4514-compliant. (yes, the original really said "not not". we are preserving the lore. it was not fully compliant. that's the tea. 😭)

πŸ”₯ RETURNS πŸ”₯

on success, GNUTLS_E_SUCCESS (0) is returned. otherwise you get a negative error value. that negative number is your sign from the universe that something went sideways. πŸ’€


🌈 SINCE 🌈

3.5.7 β€” she's been around. a legacy icon. πŸ‘‘


πŸ› REPORTING BUGS πŸ›

found a bug? don't be shy, report it to <bugs@gnutls.org>.

home page is right here: 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. so like, share it, remix it, just keep the receipts. periodt. πŸ’…


πŸ¦‹ 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/

go read it. it's giving educated. ✨


and that's the whole page bestie πŸ’– this was brought to you by gnutls 3.8.13, from the gnutls_x509_crt_get_dn3(3) page β€” now go free that datum with gnutls_free() before you forget, i am literally begging you. mwah. πŸŽ€πŸŒΈπŸ«Ά

πŸ“¦ where this page comes from