Debian Codegraph @

doc/functions/gnutls_privkey_generate

raw
1
2
3
4
5 @deftypefun {int} {gnutls_privkey_generate} (gnutls_privkey_t @var{pkey}, gnutls_pk_algorithm_t @var{algo}, unsigned int @var{bits}, unsigned int @var{flags})
6 @var{pkey}: An initialized private key
7
8 @var{algo}: is one of the algorithms in @code{gnutls_pk_algorithm_t} .
9
10 @var{bits}: the size of the parameters to generate
11
12 @var{flags}: Must be zero or flags from @code{gnutls_privkey_flags_t} .
13
14 This function will generate a random private key. Note that this
15 function must be called on an initialized private key.
16
17 The flag @code{GNUTLS_PRIVKEY_FLAG_PROVABLE}
18 instructs the key generation process to use algorithms like Shawe-Taylor
19 (from FIPS PUB186-4) which generate provable parameters out of a seed
20 for RSA and DSA keys. See @code{gnutls_privkey_generate2()} for more
21 information.
22
23 Note that when generating an elliptic curve key, the curve
24 can be substituted in the place of the bits parameter using the
25 @code{GNUTLS_CURVE_TO_BITS()} macro. The input to the macro is any curve from
26 @code{gnutls_ecc_curve_t} .
27
28 For DSA keys, if the subgroup size needs to be specified check
29 the @code{GNUTLS_SUBGROUP_TO_BITS()} macro.
30
31 It is recommended to do not set the number of @code{bits} directly, use @code{gnutls_sec_param_to_pk_bits()} instead .
32
33 See also @code{gnutls_privkey_generate2()} .
34
35 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS} (0) is returned, otherwise a
36 negative error value.
37
38 @strong{Since:} 3.3.0
39 @end deftypefun