1gnutls_privkey_generate(3) gnutls gnutls_privkey_generate(3)
2
3
4
6 gnutls_privkey_generate - API function
7
9 #include <gnutls/abstract.h>
10
11 int gnutls_privkey_generate(gnutls_privkey_t pkey, gnutls_pk_algo‐
12 rithm_t algo, unsigned int bits, unsigned int flags);
13
15 gnutls_privkey_t pkey
16 An initialized private key
17
18 gnutls_pk_algorithm_t algo
19 is one of the algorithms in gnutls_pk_algorithm_t.
20
21 unsigned int bits
22 the size of the parameters to generate
23
24 unsigned int flags
25 Must be zero or flags from gnutls_privkey_flags_t.
26
28 This function will generate a random private key. Note that this func‐
29 tion must be called on an initialized private key.
30
31 The flag GNUTLS_PRIVKEY_FLAG_PROVABLE instructs the key generation
32 process to use algorithms like Shawe-Taylor (from FIPS PUB186-4) which
33 generate provable parameters out of a seed for RSA and DSA keys. See
34 gnutls_privkey_generate2() for more information.
35
36 Note that when generating an elliptic curve key, the curve can be sub‐
37 stituted in the place of the bits parameter using the
38 GNUTLS_CURVE_TO_BITS() macro. The input to the macro is any curve from
39 gnutls_ecc_curve_t.
40
41 For DSA keys, if the subgroup size needs to be specified check the
42 GNUTLS_SUBGROUP_TO_BITS() macro.
43
44 It is recommended to do not set the number of bits directly, use
45 gnutls_sec_param_to_pk_bits() instead .
46
47 See also gnutls_privkey_generate2().
48
50 On success, GNUTLS_E_SUCCESS (0) is returned, otherwise a negative er‐
51 ror value.
52
54 3.3.0
55
57 Report bugs to <bugs@gnutls.org>.
58 Home page: https://www.gnutls.org
59
60
62 Copyright © 2001- Free Software Foundation, Inc., and others.
63 Copying and distribution of this file, with or without modification,
64 are permitted in any medium without royalty provided the copyright no‐
65 tice and this notice are preserved.
66
68 The full documentation for gnutls is maintained as a Texinfo manual.
69 If the /usr/share/doc/gnutls/ directory does not contain the HTML form
70 visit
71
72 https://www.gnutls.org/manual/
73
74gnutls 3.7.2 gnutls_privkey_generate(3)