1gnutls_privkey_sign_hash(3) gnutls gnutls_privkey_sign_hash(3)
2
3
4
6 gnutls_privkey_sign_hash - API function
7
9 #include <gnutls/abstract.h>
10
11 int gnutls_privkey_sign_hash(gnutls_privkey_t signer, gnutls_digest_al‐
12 gorithm_t hash_algo, unsigned int flags, const gnutls_datum_t *
13 hash_data, gnutls_datum_t * signature);
14
16 gnutls_privkey_t signer
17 Holds the signer's key
18
19 gnutls_digest_algorithm_t hash_algo
20 The hash algorithm used
21
22 unsigned int flags
23 Zero or one of gnutls_privkey_flags_t
24
25 const gnutls_datum_t * hash_data
26 holds the data to be signed
27
28 gnutls_datum_t * signature
29 will contain newly allocated signature
30
32 This function will sign the given hashed data using a signature algo‐
33 rithm supported by the private key. Signature algorithms are always
34 used together with a hash functions. Different hash functions may be
35 used for the RSA algorithm, but only SHA-XXX for the DSA keys.
36
37 You may use gnutls_pubkey_get_preferred_hash_algorithm() to determine
38 the hash algorithm.
39
40 The flags may be GNUTLS_PRIVKEY_SIGN_FLAG_TLS1_RSA or
41 GNUTLS_PRIVKEY_SIGN_FLAG_RSA_PSS. In the former case this function
42 will ignore hash_algo and perform a raw PKCS1 signature, and in the
43 latter an RSA-PSS signature will be generated.
44
45 Note that, not all algorithm support signing already hashed data. When
46 signing with Ed25519, gnutls_privkey_sign_data() should be used.
47
49 On success, GNUTLS_E_SUCCESS (0) is returned, otherwise a negative er‐
50 ror value.
51
53 2.12.0
54
56 Report bugs to <bugs@gnutls.org>.
57 Home page: https://www.gnutls.org
58
59
61 Copyright © 2001- Free Software Foundation, Inc., and others.
62 Copying and distribution of this file, with or without modification,
63 are permitted in any medium without royalty provided the copyright no‐
64 tice and this notice are preserved.
65
67 The full documentation for gnutls is maintained as a Texinfo manual.
68 If the /usr/share/doc/gnutls/ directory does not contain the HTML form
69 visit
70
71 https://www.gnutls.org/manual/
72
73gnutls 3.7.2 gnutls_privkey_sign_hash(3)