GNUTLS_X509_CRQ_SET_ATTRIBUTE_BY_OID(3)

πŸ’– gnutls_x509_crq_set_attribute_by_oid β€” like, the whole vibe πŸ’–

okay bestie, so this is a page from the gnutls manual β€” section 3, the library-functions girlies πŸŽ€ β€” and it's all about one very specific little function. It's an API function, and no cap, it does exactly one thing and does it slay.


✨ SYNOPSIS ✨

First things first, you gotta pull in the header, periodt:

#include <gnutls/x509.h>

and here's the function signature, character for character, don't @ me:

int gnutls_x509_crq_set_attribute_by_oid(gnutls_x509_crq_t crq, const
char * oid, void * buf, size_t buf_size);

🫢 ARGUMENTS 🫢

  • gnutls_x509_crq_t crq β€” this one should contain a gnutls_x509_crq_t type. yes bestie, the type contains a type, it's giving inception but make it certificates πŸ’…
  • const char * oid β€” holds an Object Identifier in a null-terminated string. a whole OID, just vibing in a string 🌸
  • void * buf β€” a pointer to a structure that holds the attribute data. it's just a lil pointer to your data, she's flexible like that ✨
  • size_t buf_size β€” holds the size of buf. yes ma'am, you gotta tell her how big your buffer is, she's not a mind reader 😭

🌈 DESCRIPTION 🌈

So here's the tea, bestie. This function will set the attribute in the certificate request specified by the given Object ID. You point it at a cert request, you hand it an OID, boom β€” attribute set. iconic behaviour honestly.

⚠️ but listen β€” the provided attribute must be DER encoded. like, DER encoded DER encoded. no shortcuts, no "I'll do it later", she will not accept vibes in place of encoding. πŸ’€

and here's the context you need for the full picture: attributes in a certificate request is an optional set of data appended to the request. Optional! So if you don't have any, you're not doing anything wrong, she's just built different. Their interpretation depends on the CA policy β€” so like, what those attributes actually mean is between you and whatever Certificate Authority you're dealing with. iykyk. πŸ¦‹


⭐ RETURNS ⭐

On success, GNUTLS_E_SUCCESS (0) is returned β€” the big zero, the win, the moment πŸ‘‘

Otherwise you get a negative error value. not zero. negative. so if your check is like "is it 0" and it's not, that's your sign to go read the error code, bestie πŸ™ˆ


😭 REPORTING BUGS 😭

Found a bug? Don't suffer in silence, tell the girlies:


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 β€” go off, copy it, remix it, just keep the receipt (the copyright notice and this notice) attached. that's the whole deal, and honestly? generous of them 🫢


πŸŽ€ SEE ALSO πŸŽ€

The full documentation for gnutls is maintained as a Texinfo manual. So if the /usr/share/doc/gnutls/ directory does not contain the HTML form, bestie, go visit:

https://www.gnutls.org/manual/

the manual is right there, she's waiting for you 🌸


and that's the whole page, no notes. this lil gem is from gnutls 3.8.13, and the manual page herself was stamped with the usual gnutls date-and-version footer energy β€” so go forth, set those DER-encoded attributes, and stay slay. πŸ’…βœ¨πŸ’–

πŸ“¦ where this page comes from