gnutls_pubkey_verify_hash2(3)
π gnutls_pubkey_verify_hash2 β API function π
okay bestie, welcome to the gnutls manual, and specifically to the page for gnutls_pubkey_verify_hash2(3) β¨ it's an API function, it lives in the gnutls family, and it's about checking whether a signature actually checks out. no cap. let's go π«Ά
β¨ SYNOPSIS β¨
#include <gnutls/abstract.h>
int gnutls_pubkey_verify_hash2(gnutls_pubkey_t key,
gnutls_sign_algorithm_t algo, unsigned int flags, const gnutls_datum_t *
hash, const gnutls_datum_t * signature);
like, five args, one int back. that's the whole vibe π
πΈ ARGUMENTS πΈ
gnutls_pubkey_t keyβ this is your public key, the main character of the whole operation π it holds the key, you hold the hopes.gnutls_sign_algorithm_t algoβ the signature algorithm that was used. yes, signature algorithm, not digest algorithm, we'll get to why that's a whole thing in a sec πunsigned int flagsβ zero, or an OR list ofgnutls_certificate_verify_flags. zero is valid! zero is fine! zero is the "I have no extra opinions" option β¨const gnutls_datum_t * hashβ holds the hash digest that you want verified. the thing being checked.const gnutls_datum_t * signatureβ contains the signature. the thing doing the checking.
π¦ DESCRIPTION π¦
so this function verifies the given signed digest, using the parameters from the public key. that's the tea β
and here's the plot twist that lowkey trips people up: unlike gnutls_privkey_sign_hash(), this function accepts a signature algorithm instead of a digest algorithm. the way that these two are different things and nobody tells you π so if you've got a digest algorithm and you need the matching signature algorithm, you can use gnutls_pk_to_sign() to get the appropriate value. problem solved, slay π
π₯ RETURNS π₯
okay so if verification fails, you get GNUTLS_E_PK_SIG_VERIFY_FAILED back. if it succeeds, you get zero or a positive code. so like... check your return values, bestie, don't just assume π
β οΈ and for signatures that are known to be insecure, this function will returnGNUTLS_E_INSUFFICIENT_SECURITYβ unless you specified the flagGNUTLS_VERIFY_ALLOW_BROKEN. that flag is literally you going "yes I know it's broken, do it anyway" π so be normal about it.
β SINCE β
3.0 β been here since 3.0, an absolute icon, aging like fine wine π
π REPORTING BUGS π
found a bug? don't suffer in silence, tell the gnutls girlies:
- 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: go off, just keep the receipts π§)
π 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/
and that's the page!! this was gnutls 3.8.13, dropping gnutls_pubkey_verify_hash2(3) energy into your terminal, and if you read all the way down here you're literally the bestie of all time π«Άπ bye babe, go verify some signatures responsibly β¨
π¦ 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