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 beNULL. 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:
- Report bugs to <bugs@gnutls.org>.
- Home page: https://www.gnutls.org
π COPYRIGHT π
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
- alpine 3.22: gnutls-doc 3.8.13-r0 Β· LGPL-2.1-or-later
- alpine 3.23: gnutls-doc 3.8.13-r0 Β· LGPL-2.1-or-later
- alpine 3.24: gnutls-doc 3.8.13-r0 Β· LGPL-2.1-or-later
- arch rolling: gnutls 3.8.13-3 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 43: gnutls-devel 3.8.13-1.fc43 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 43: gnutls-devel 3.8.13-1.fc43 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 44: gnutls-devel 3.8.13-1.fc44 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 44: gnutls-devel 3.8.13-1.fc44 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- ubuntu stonking: gnutls-doc 3.8.13-1ubuntu1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms