GNUTLS_PUBKEY_GET_PREFERRED_HASH_ALGORITHM(3)

✨ NAME ✨

gnutls_pubkey_get_preferred_hash_algorithm β€” bestie, this is the lil gnutls function that tells you which hash algorithm your pubkey is literally begging to be signed with πŸ’…

(It lives in the gnutls manual, section 3, and if you're lost already, don't worry, we got you 🫢)


🌸 SYNOPSIS 🌸

#include <gnutls/abstract.h>

int gnutls_pubkey_get_preferred_hash_algorithm(gnutls_pubkey_t key,
       gnutls_digest_algorithm_t * hash, unsigned int * mand);

πŸŽ€ ARGUMENTS πŸŽ€

  • gnutls_pubkey_t key β€” holds the certificate. this is your main character, the key we're asking about πŸ‘‘
  • gnutls_digest_algorithm_t * hash β€” the result of the call with the hash algorithm used for signature. she's the output bestie, the whole point of the function ✨
  • unsigned int * mand β€” if non zero it means that the algorithm MUST use this hash. May be NULL. like if this comes back non-zero, no takebacks, no negotiating, you're using that hash periodt 😀

πŸ’– DESCRIPTION πŸ’–

okay so. this function will read the certificate and return the appropriate digest algorithm to use for signing with this certificate. some certificates (i.e. DSA might not be able to sign without the preferred algorithm) β€” like they're just built different and can't freestyle it πŸ’€

to get the signature algorithm instead of just the hash, use gnutls_pk_to_sign() with the algorithm of the certificate/key and the provided hash. iykyk, one layer deeper 🌈


⭐ RETURNS ⭐

the 0 if the hash algorithm is found. a negative error code is returned on error. so like, zero = slay, negative = not slay, that's the whole vibe check πŸ¦‹


🧚 SINCE 🧚

2.12.0 β€” she's been iconic since way back, no cap πŸ’œ


🌸 REPORTING BUGS 🌸

found a bug? not the cute kind? report it, bestie:


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. fr fr, that's the license, respect it 🫢


πŸ”₯ 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/


okay that's the whole page bestie, go forth and hash responsibly 🌈✨

mwah πŸ’‹ β€” this was the gnutls manual page for gnutls_pubkey_g..._hash_algorithm(3), from gnutls 3.8.13. thanks for reading, you ate that πŸŽ€πŸ‘‘

πŸ“¦ where this page comes from