gnutls_privkey_sign_hash2(3)

✨ gnutls_privkey_sign_hash2(3) ✨

okay bestie, gather round, because we're doing a gnutls manpage and this one is a certified banger. it lives in the gnutls manual (section 3, the library-functions girlies πŸ’…), and it's literally the glow-up version of its older sibling. let's get into it 🫢


🌸 NAME 🌸

gnutls_privkey_sign_hash2 β€” API function


πŸŽ€ SYNOPSIS πŸŽ€

#include <gnutls/abstract.h>

int gnutls_privkey_sign_hash2(gnutls_privkey_t signer,
gnutls_sign_algorithm_t algo, unsigned int flags, const gnutls_datum_t *
hash_data, gnutls_datum_t * signature);

πŸ¦‹ ARGUMENTS πŸ¦‹

  • gnutls_privkey_t signer β€” this is the signer's key, like, the whole point of the operation. it holds the key that's doing the signing πŸ’–
  • gnutls_sign_algorithm_t algo β€” the signature algorithm you're using, your moment to pick the vibe ✨
  • unsigned int flags β€” zero, or one of the gnutls_privkey_flags_t values. zero or one, bestie, not a whole collection, we're not doing a haul here πŸŽ€
  • const gnutls_datum_t * hash_data β€” holds the data to be signed. yes it's already hashed, that's the whole thing, the name is not lying to you 😭
  • gnutls_datum_t * signature β€” this is where the newly allocated signature goes. freshly allocated, just for you, iconic πŸ‘‘

πŸ’œ DESCRIPTION πŸ’œ

so this function will sign the given hashed data using the specified signature algorithm. simple. elegant. main character energy ✨

but here's the tea: this function is an enhancement of gnutls_privkey_sign_hash(), because it lets you utilize an alternative signature algorithm where possible β€” like, for example, using an RSA key with RSA-PSS. it's giving glow-up. it's giving range πŸ”₯

the flags may be GNUTLS_PRIVKEY_SIGN_FLAG_TLS1_RSA. in that case, this function will ignore hash_algo and perform a raw PKCS1 signature. note that this flag is supported since 3.6.9. not me checking version numbers like they're release dates πŸ“…

also note β€” and this is important, so listen up β€” not all algorithms support signing already hashed data. when you're signing with Ed25519, you should use gnutls_privkey_sign_data2() instead. that's the move. don't fight it, just switch functions πŸ™ˆ


⭐ RETURNS ⭐

on success, GNUTLS_E_SUCCESS (0) is returned. otherwise you get a negative error value, which is the library's way of saying "no πŸ’€". check it, always check it, bestie 🫢


🌈 SINCE 🌈

3.6.0 β€” she's been around, she's seasoned, she's got history πŸ‘‘


πŸ› REPORTING BUGS πŸ›

found a bug? don't suffer in silence, report it:


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. slay, and also, legally binding 🫢


πŸ‘€ 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/

πŸ’– ok that's the whole page, no cap, every option and every warning accounted for. go forth and sign responsibly.

and that's a wrap on this little page from the gnutls manual, version 3.8.13 β€” gnutls_privkey_sign_hash2(3), periodt πŸ’…βœ¨

πŸ“¦ where this page comes from