gnutls_x509_privkey_sign_data(3)

πŸ’– gnutls_x509_privkey_sign_data πŸ’–

okay so bestie, welcome to the gnutls manual, page for gnutls_x509_privkey_sign_data(3). this one is literally about signing data with a private key and it's giving main character energy. let's get into it 🫢


✨ NAME ✨

gnutls_x509_privkey_sign_data β€” API function 🌸


🌈 SYNOPSIS 🌈

#include <gnutls/x509.h>

int gnutls_x509_privkey_sign_data(gnutls_x509_privkey_t key,
gnutls_digest_algorithm_t digest, unsigned int flags, const
gnutls_datum_t * data, void * signature, size_t * signature_size);

πŸŽ€ ARGUMENTS πŸŽ€

  • gnutls_x509_privkey_t key β€” a key πŸ’… that's it that's the arg
  • gnutls_digest_algorithm_t digest β€” should be a digest algorithm, no cap
  • unsigned int flags β€” should be 0 for now (yes, just 0, we're being so serious)
  • const gnutls_datum_t * data β€” holds the data to be signed πŸ“
  • void * signature β€” will contain the signature ✨
  • size_t * signature_size β€” holds the size of signature (and will be replaced by the new size πŸ‘€)

πŸ’œ DESCRIPTION πŸ’œ

so this function will sign the given data using a signature algorithm supported by the private key. signature algorithms are always used together with hash functions, they're like a package deal fr fr. different hash functions may be used for the RSA algorithm, but only SHA-1 for the DSA keys. that's just how it is bestie.

if the buffer provided is not long enough to hold the output, then *signature_size is updated and GNUTLS_E_SHORT_MEMORY_BUFFER will be returned. classic buffer situation, we've all been there 😭

use gnutls_x509_crt_get_preferred_hash_algorithm() to determine the hash algorithm. yes queen, go check what hash you should be using 🧚

⭐ RETURNS ⭐

on success, GNUTLS_E_SUCCESS (0) is returned, otherwise a negative error value. negative = not slaying, 0 = slaying πŸ’–


πŸ™ˆ REPORTING BUGS πŸ™ˆ

report bugs to <bugs@gnutls.org>. πŸ“§

home page: <https://www.gnutls.org> β€” no links here but like, you know, go look at 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. iconic behaviour honestly.


πŸ¦‹ 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/>

periodt. that's the whole page. πŸ’€


and that's a wrap on this page from the <strong>gnutls</strong> manual, version <strong>3.8.13</strong> (dated with the gnutls_x509_privkey_sign_data(3) header, if you were wondering) πŸ’œβœ¨ go forth and sign some data bestie, you've got this πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from