GNUTLS_X509_CRT_GET_PREFERRED_HASH_ALGORITHM(3)

πŸ’– gnutls_x509_crt_get_preferred_hash_algorithm(3) πŸ’–

okay bestie, sit down, hydrate, and let me tell you about a little function from the gnutls manual β€” yes, the actual manual, this is gnutls_x509_crt..._hash_algorithm(3), and she is iconic but also kinda retired. we'll get to that. 🫢


✨ NAME ✨

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


🌸 SYNOPSIS 🌸

#include <gnutls/compat.h>

int gnutls_x509_crt_get_preferred_hash_algorithm(gnutls_x509_crt_t crt,
       gnutls_digest_algorithm_t * hash, unsigned int * mand);

look at her. three args, one int return. she's simple, she's clean, she's giving utility. ✨


πŸŽ€ ARGUMENTS πŸŽ€

  • gnutls_x509_crt_t crt β€” bestie, this one holds the certificate. that's the whole job. she's just standing there holding it. πŸ’…
  • gnutls_digest_algorithm_t * hash β€” this is where the result of the call lands: the hash algorithm that was used for the signature. output city. πŸ™οΈ
  • unsigned int * mand β€” if this comes back non-zero, it means the algorithm MUST use this hash. no negotiating, no vibes-based alternatives. also: it may be NULL. totally optional, lowkey chill. πŸ™ˆ

πŸ¦‹ DESCRIPTION πŸ¦‹

so what does she actually do? she reads the certificate πŸ“– and hands you back the appropriate digest algorithm you should use for signing with this certificate.

and listen β€” some certificates just can't be flexible about it. like, DSA might not be able to sign at all without the preferred algorithm. it's giving no plan B. so yeah, this function exists precisely because sometimes there is only one correct answer. 🎯


πŸ’€ DEPRECATED πŸ’€

not me being the bearer of bad news but… this function is deprecated, bestie. please use gnutls_pubkey_get_preferred_hash_algorithm() instead. she's the newer, shinier main character now. πŸ‘‘

⭐ RETURNS ⭐

returns the 0 if the hash algorithm is found. and if something goes wrong? a negative error code comes back. classic. 😭


🌈 SINCE 🌈

2.12.0 β€” she's been here a minute. vintage. πŸ•°οΈ


πŸ› REPORTING BUGS πŸ›

found a bug? don't suffer in silence, 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. (translation: she's free, just keep the receipts, fr fr πŸ§ΎπŸ’–)


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

iykyk. go read the real docs, they ate. πŸ“šβœ¨


and that's the whole page, bestie β€” this was gnutls version 3.8.13, manual page gnutls_x509_crt..._hash_algorithm(3). stay hydrated, use the non-deprecated function, and slay. πŸ’…πŸŽ€πŸ¦‹πŸŒΈπŸ’–

πŸ“¦ where this page comes from