gnutls_privkey_sign_data(3)
π gnutls_privkey_sign_data β bestie, we're signing DATA today π
okay so this is a page from the gnutls manual, and it's all about one little function that goes by the name gnutls_privkey_sign_data. She signs stuff. With your private key. Iconic behaviour honestly. Let's get into it π
β¨ NAME β¨
gnutls_privkey_sign_data β literally just an API function, no cap
πΈ SYNOPSIS πΈ
#include <gnutls/abstract.h>
int gnutls_privkey_sign_data(gnutls_privkey_t signer,
gnutls_digest_algorithm_t hash, unsigned int flags, const gnutls_datum_t
* data, gnutls_datum_t * signature);
π¦ ARGUMENTS π¦
gnutls_privkey_t signerβ the key that's holding all the power here. she's the one doing the signing, main character energy fr πgnutls_digest_algorithm_t hashβ should be a digest algorithm. that's the vibe check on your hash function πunsigned int flagsβ zero, or one ofgnutls_privkey_flags_t. yes bestie, one. not a whole lil collection of them πconst gnutls_datum_t * dataβ holds the data that's about to get signed. she's the payload, she's the moment β¨gnutls_datum_t * signatureβ will contain the signature, and it's allocated withgnutls_malloc(). so like, it's yours now, remember to free her π«Ά
π DESCRIPTION π
This function will sign the given data using a signature algorithm supported by the private key. Periodt.
Signature algorithms are always used together with a hash function β they're a package deal, they don't come separately, iykyk. And here's the tea: different hash functions may be used for the RSA algorithm, but for DSA keys it's only the SHA family. that's it. that's the whole list. DSA said "SHA only, and I'm not discussing it" π
You may use gnutls_pubkey_get_preferred_hash_algorithm() to determine the hash algorithm β so if you're sitting there like "which hash do I even use π", that's your girl, go ask her π
β RETURNS β
On success, GNUTLS_E_SUCCESS (0) is returned, otherwise a negative error value. so if you see a negative number, that's not a slay, that's a warning sign bestie π
π SINCE π
2.12.0 β she's been around a minute, she's a legacy icon π
π₯ REPORTING BUGS π₯
Found a bug? Do not suffer in silence, that's not the vibe. 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. so like, go off, redistribute, just keep the receipts attached 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/
okay one last thing bestie β thesignatureyou get back isgnutls_malloc'd, so please free it when you're done. no leaking in this household π
and that's the page!! this one's from gnutls 3.8.13, and the date slot at the bottom was justβ¦ empty. mysterious. enigmatic. she didn't feel like dating herself today π anyway ily, go sign something 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