1gnutls_x509_privkey_generate(3) gnutls gnutls_x509_privkey_generate(3)
2
3
4
6 gnutls_x509_privkey_generate - API function
7
9 #include <gnutls/x509.h>
10
11 int gnutls_x509_privkey_generate(gnutls_x509_privkey_t key,
12 gnutls_pk_algorithm_t algo, unsigned int bits, unsigned int flags);
13
15 gnutls_x509_privkey_t key
16 an initialized 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_x509_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_generate(), gnutls_x509_privkey_generate2().
48
50 On success, GNUTLS_E_SUCCESS [22m(0) is returned, otherwise a negative
51 error value.
52
54 Report bugs to <bugs@gnutls.org>.
55 Home page: https://www.gnutls.org
56
57
59 Copyright © 2001-2020 Free Software Foundation, Inc., and others.
60 Copying and distribution of this file, with or without modification,
61 are permitted in any medium without royalty provided the copyright
62 notice and this notice are preserved.
63
65 The full documentation for gnutls is maintained as a Texinfo manual.
66 If the /usr/share/doc/gnutls/ directory does not contain the HTML form
67 visit
68
69 https://www.gnutls.org/manual/
70
71gnutls 3.6.13 gnutls_x509_privkey_generate(3)