Debian Codegraph @

doc/functions/gnutls_dh_params_generate2

raw
1
2
3
4
5 @deftypefun {int} {gnutls_dh_params_generate2} (gnutls_dh_params_t @var{dparams}, unsigned int @var{bits})
6 @var{dparams}: The parameters
7
8 @var{bits}: is the prime's number of bits
9
10 This function will generate a new pair of prime and generator for use in
11 the Diffie-Hellman key exchange. This may take long time.
12
13 It is recommended not to set the number of bits directly, but
14 use @code{gnutls_sec_param_to_pk_bits()} instead.
15 Also note that the DH parameters are only useful to servers.
16 Since clients use the parameters sent by the server, it's of
17 no use to call this in client side.
18
19 The parameters generated are of the DSA form. It also is possible
20 to generate provable parameters (following the Shawe-Taylor
21 algorithm), using @code{gnutls_x509_privkey_generate2()} with DSA option
22 and the @code{GNUTLS_PRIVKEY_FLAG_PROVABLE} flag set. These can the
23 be imported with @code{gnutls_dh_params_import_dsa()} .
24
25 It is no longer recommended for applications to generate parameters.
26 See the "Parameter generation" section in the manual.
27
28 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS} (0) is returned,
29 otherwise a negative error code is returned.
30 @end deftypefun