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 a gnutls_x509_crt_t type, 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 of buf. 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 case buf_size gets 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? 0 is returned. slay. πŸ‘‘

πŸ”₯ REPORTING BUGS πŸ”₯

found a bug? report it, bestie:

Report bugs to <bugs@gnutls.org>.

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


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