gnutls_x509_privkey_get_key_id(3)

πŸ’– gnutls_x509_privkey_get_key_id β€” the gnutls manual, bestie edition πŸ’–

okay so this is a page from the gnutls manual (yes the whole manual, we're just vibing with one page of it), and it's all about pulling a lil unique ID out of a private key. let's get into it 🫢


✨ NAME ✨

gnutls_x509_privkey_get_key_id β€” it's an API function, periodt.


🌸 SYNOPSIS 🌸

#include <gnutls/x509.h>

int gnutls_x509_privkey_get_key_id(gnutls_x509_privkey_t key, unsigned
int flags, unsigned char * output_data, size_t * output_data_size);

look at her. iconic signature. πŸ’…


πŸŽ€ ARGUMENTS πŸŽ€

  • gnutls_x509_privkey_t key β€” bestie this is a key. that's the whole description. a key. πŸ’œ
  • unsigned int flags β€” should be one of the flags from gnutls_keyid_flags_t, no cap, pick from that list.
  • unsigned char * output_data β€” this is where the key ID is gonna land. it will contain the key ID. manifesting ✨
  • size_t * output_data_size β€” holds the size of output_data, and heads up, it will be replaced by the actual size of parameters. so it's not staying the same, it's getting a glow-up.

πŸ¦‹ DESCRIPTION πŸ¦‹

so this function returns a unique ID that depends on the public key parameters. the way that it works is it's derived from the public key params, so if you're like "hmm does this certificate correspond to this key??" β€” you can use this ID to check that. vibe check for certs fr fr.

now the important part, and not me being dramatic, this is genuinely important: if the buffer you provided is not long enough to hold the output, then *output_data_size gets updated and you get GNUTLS_E_SHORT_MEMORY_BUFFER back. so she tells you how much room she actually needs. 😭

and the output will normally be a SHA-1 hash output, which is 20 bytes. twenty. bytes. remember that number. 🌈


⭐ RETURNS ⭐

on success you get GNUTLS_E_SUCCESS (that's 0) returned to you, slay. otherwise you get a negative error value. negative = not slay. πŸ’€


😭 REPORTING BUGS 😭

found a bug? don't suffer in silence bestie, report it 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.

(translation: go off, share it, just keep the notice. we love a permissive queen. πŸ’…)


πŸ”₯ 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, then go visit:

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

iykyk, that's where the whole manual lives. 🧚


and that's the page!! this was gnutls 3.8.13, manual page gnutls_x509_privkey_get_key_id(3), and honestly? she ate. stay hydrated, read your manpages, and remember: 20 bytes. πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from