gnutls_x509_crt_set_serial(3)

✨ NAME ✨

gnutls_x509_crt_set_serial β€” bestie, it's an API function πŸ’… (from the gnutls manual, page gnutls_x509_crt_set_serial(3))


🌸 SYNOPSIS 🌸

#include <gnutls/x509.h>

int gnutls_x509_crt_set_serial(gnutls_x509_crt_t cert, const void *
serial, size_t serial_size);

πŸŽ€ ARGUMENTS πŸŽ€

  • gnutls_x509_crt_t cert β€” a certificate of type gnutls_x509_crt_t. yes girl, that's the one you're about to mess with πŸ’–
  • const void * serial β€” The serial number. that's it, that's the whole vibe
  • size_t serial_size β€” Holds the size of the serial field. so like… how many bytes of serial we talkin' πŸ¦‹

πŸ’« DESCRIPTION πŸ’«

okay so. This function will set the X.509 certificate's serial number. iconic, I know.

Here's the tea though: while the serial number is technically an integer, it is often handled as an opaque field by several CAs. like, they just pass it around as a blob and don't think about it 😭. For this reason this function accepts any kind of data as a serial number. no judgment, it'll take it.

But β€” and this is the part where you gotta be a good citizen β€” to be consistent with the X.509/PKIX specifications, the provided serial should be a big-endian positive number (i.e. its leftmost bit should be zero). 🫢

πŸ’€ the size of the serial is restricted to 20 bytes maximum by RFC5280. This function allows writing more than 20 bytes, but the generated certificates in that case may be rejected by other implementations. so like, you can do it, but bestie… why. πŸ™ˆ

⭐ RETURNS ⭐

On success, GNUTLS_E_SUCCESS (0) is returned. otherwise you get a negative error value. slay either way, but one of these is definitely the one you want πŸ‘‘


πŸ› REPORTING BUGS πŸ›

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.


🌈 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, no cap 🧚 this was gnutls 3.8.13, gnutls_x509_crt_set_serial(3) β€” go set some serials, bestie, and keep 'em under 20 bytes for me πŸ’œ

πŸ“¦ where this page comes from