gnutls_x509_crt_set_version(3)

✨ gnutls_x509_crt_set_version ✨

okay bestie, welcome to the gnutls manual page for gnutls_x509_crt_set_version(3) β€” yes that's the whole name, it's giving "my parents named me after my job" energy but we move πŸ’…

🌸 NAME 🌸

gnutls_x509_crt_set_version β€” literally an API function, that's it, that's the vibe


πŸŽ€ SYNOPSIS πŸŽ€

#include <gnutls/x509.h>

int gnutls_x509_crt_set_version(gnutls_x509_crt_t crt, unsigned int version);

look at her. two args, one int coming back, no notes. iconic.


πŸ¦‹ ARGUMENTS πŸ¦‹

  • gnutls_x509_crt_t crt β€” bestie this is the certificate, and its type is literally gnutls_x509_crt_t. it is what it is 🫢
  • unsigned int version β€” this one holds the version number. and listen: for X.509v1 certificates it must be 1. no wiggle room, no "close enough", just 1.

πŸ’– DESCRIPTION πŸ’–

so what does this function actually DO. it sets the version of the certificate. that's the whole thing. the number you pass is the version β€” one for X.509 version 1, and so on, you get the pattern, it's not rocket science 🌈

plain certificates (the ones with no extensions, living their simple unbothered life) must have version set to one. periodt.

⚠️ okay this is the important part, bestie, pay attention: to create well-formed certificates you MUST specify version 3 if you're using any certificate extensions. not 1. not 2. 3. the vibe check is strict here 😭

and in case you're wondering "wait, who's making these extensions" β€” they're created by functions like gnutls_x509_crt_set_subject_alt_name() or gnutls_x509_crt_set_key_usage(). so if you're out here calling those and then setting version 1, that's not slay, that's a malformed certificate πŸ’€


🌟 RETURNS 🌟

on success you get GNUTLS_E_SUCCESS (which is 0, the good number, the green flag 🟒). otherwise you get a negative error value, which is giving red flag energy, and you should probably go look at what went wrong.


πŸ’œ REPORTING BUGS πŸ’œ

found a bug? no gatekeeping, tell the devs:


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. (aka: free to share, just keep the receipts 🧾)


🌈 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, go visit:

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


and that's the whole page bestie, you ate πŸ’…

this has been gnutls, version 3.8.13, dated with gnutls_x509_crt_set_version(3) β€” thanks for reading, mwah πŸŽ€βœ¨

πŸ“¦ where this page comes from