gnutls_x509_crt_set_dn_by_oid(3)

πŸ’– NAME πŸ’–

ok so bestie, gather round β€” gnutls_x509_crt_set_dn_by_oid is an API function from the gnutls manual (yes, that gnutls, section 3, the library one). She sets one lil piece of a certificate's subject name, chosen by OID. That's the whole vibe. πŸ’…


✨ SYNOPSIS ✨

#include <gnutls/x509.h>

int gnutls_x509_crt_set_dn_by_oid(gnutls_x509_crt_t crt, const char *
oid, unsigned int raw_flag, const void * name, unsigned int
sizeof_name);

like… five arguments. she's a little extra but we love her for it 🫢


🌸 ARGUMENTS 🌸

  • gnutls_x509_crt_t crt β€” a certificate of type gnutls_x509_crt_t. the main character of this whole operation, no cap.
  • const char * oid β€” holds an Object Identifier in a null terminated string. yes, null terminated. don't come at her with anything else πŸ™ˆ
  • unsigned int raw_flag β€” must be 0, or 1 if the data are DER encoded. it's giving binary choice, literally.
  • const void * name β€” a pointer to the name. just… pointing at it. iconic.
  • unsigned int sizeof_name β€” holds the size of name. she needs the receipts, bestie β€” tell her how big it is πŸ’€

πŸ¦‹ DESCRIPTION πŸ¦‹

so what does she actually do? she sets the part of the name of the Certificate subject, specified by the given OID. and the input string should be ASCII or UTF-8 encoded. that part is not optional, okay? UTF-8 girlies rise 🌈

some helper macros with popular OIDs can be found in gnutls/x509.h β€” go look, they're right there, lowkey so convenient.

and here's the tea: with this function you can only set the known OIDs. wanna know if an OID is known? test it with gnutls_x509_dn_oid_known(). that's the vibe check right there.

for OIDs that are not known (by gnutls) you should properly DER encode your data, and call this function with raw_flag set. yes, actually DER encode it. do not skip this step, I'm begging 😭


πŸ‘‘ RETURNS πŸ‘‘

on success, GNUTLS_E_SUCCESS (0) is returned. otherwise a negative error value. so like… zero is the slay outcome. negative means something went wrong and you should probably read the error, bestie, not just ignore it πŸ’œ


πŸŽ€ REPORTING BUGS πŸŽ€

found a bug? don't be shy, 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. 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/

and that's the whole page, bestie β€” no crumbs left behind πŸ“

this was gnutls 3.8.13, gnutls_x509_crt_set_dn_by_oid(3), and yes she ate πŸ’…βœ¨

πŸ“¦ where this page comes from