gnutls_x509_crt_get_key_id(3)

πŸ’… gnutls_x509_crt_get_key_id β€” bestie edition ✨

okay so this page lives in the gnutls manual (yeah, the whole gnutls docs set, section 3, the library-functions corner) and it's literally about pulling a key ID out of a certificate. sit down, hydrate, let's go 🫢


🌸 NAME 🌸

gnutls_x509_crt_get_key_id β€” the API function that gets you that key ID, no cap


✨ SYNOPSIS ✨

#include <gnutls/x509.h>

int gnutls_x509_crt_get_key_id(gnutls_x509_crt_t crt, unsigned int
flags, unsigned char * output_data, size_t * output_data_size);

πŸŽ€ ARGUMENTS πŸŽ€

  • gnutls_x509_crt_t crt β€” holds the certificate, bestie. that's the one we're reading from πŸ’–
  • unsigned int flags β€” should be one of the flags from gnutls_keyid_flags_t. pick one, don't be chaotic πŸ™ˆ
  • unsigned char * output_data β€” will contain the key ID. this is where the magic lands ✨
  • size_t * output_data_size β€” holds the size of output_data (and will be replaced by the actual size of parameters). yes, it gets overwritten, it's giving in-and-out energy πŸ”

πŸ’œ DESCRIPTION πŸ’œ

this function will return a unique ID that depends on the public key parameters. that's the whole vibe β€” same key params, same ID.

this ID can be used in checking whether a certificate corresponds to the given private key. so like, "is this cert the one that matches my key?" β€” that's the question it answers, and it answers it slayfully πŸ‘‘

if the buffer provided is not long enough to hold the output, then *output_data_size is updated and GNUTLS_E_SHORT_MEMORY_BUFFER will be returned. so it tells you how much room you actually needed, which is honestly so thoughtful of it 😭

the output will normally be a SHA-1 hash output, which is 20 bytes. twenty. bytes. periodt.


⭐ RETURNS ⭐

in case of failure a negative error code will be returned, and 0 on success. zero is the happy number, negative is the "not me crying in errno" number πŸ’€


πŸ”₯ REPORTING BUGS πŸ”₯

found a bug? don't gatekeep it, tell the people:


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, just keep the receipt πŸ§ΎπŸ’–


🌈 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/


fr fr, go read the full Texinfo manual if you want the deep lore. this page is the group chat summary, not the whole syllabus πŸ“š

and that's the page bestie!! πŸ’…βœ¨ this was gnutls 3.8.13, dated with all the love, brought to you by the gnutls_x509_crt_get_key_id(3) girlies. mwah, go get that key ID πŸŽ€πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from