gnutls_x509_crt_get_dn(3)
β¨ gnutls_x509_crt_get_dn β bestie, it's time to grab that Distinguished Name β¨
okay so this is a page from the gnutls manual, and it's all about gnutls_x509_crt_get_dn(3) β the function that pulls the DN out of a certificate and drops it in your buffer. let's go π
πΈ NAME πΈ
gnutls_x509_crt_get_dn β literally just an API function, that's it, that's the name π
π¦ SYNOPSIS π¦
#include <gnutls/x509.h>
int gnutls_x509_crt_get_dn(gnutls_x509_crt_t cert, char * buf, size_t *
buf_size);
π ARGUMENTS π
gnutls_x509_crt_t certβ should contain agnutls_x509_crt_ttype, no cap π«Άchar * bufβ a pointer to a structure to hold the name (may be null β yes, null, she's flexible like that)size_t * buf_sizeβ initially holds the size ofbuf. it's giving "tell me how much room you got" π
π DESCRIPTION π
bestie, listen. this function will copy the name of the Certificate into the buffer you provided. the name comes out looking like "C=xxxx,O=yyyy,CN=zzzz" exactly as described in RFC4514. and the output string? it'll be ASCII or UTF-8 encoded, depending on what the certificate data is serving. β¨
the buf returned will be null terminated, and the buf_size will account for that trailing null (she counts it, she's thorough π
). and if buf is null? then only the size gets filled in. just the size. nothing else. iconic behaviour honestly.
okay so important caveat time: this function does not output a fully RFC4514 compliant string. not fully. if that's what you need, go see gnutls_x509_crt_get_dn3() instead. don't come for her, she knows what she is. π
β RETURNS β
GNUTLS_E_SHORT_MEMORY_BUFFERβ your buffer was not long enough. rude, but also: in that casebuf_sizegets updated with the required size, so she's helping you fix it π«ΆGNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEβ the DN does not exist. it's not there. it's giving empty π³οΈ- another error value on error, obviously
- and on success?
0is returned. slay. π
π₯ REPORTING BUGS π₯
found a bug? report it, bestie:
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. 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/
and that's the whole page, fr fr. this one's from gnutls 3.8.13, manual page gnutls_x509_crt_get_dn(3) β go read it, love you, bye πβ¨π
π¦ 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