1gnutls_privkey_generate2(3)         gnutls         gnutls_privkey_generate2(3)
2
3
4

NAME

6       gnutls_privkey_generate2 - API function
7

SYNOPSIS

9       #include <gnutls/abstract.h>
10
11       int   gnutls_privkey_generate2(gnutls_privkey_t  pkey,  gnutls_pk_algo‐
12       rithm_t algo, unsigned int bits, unsigned int flags, const  gnutls_key‐
13       gen_data_st * data, unsigned data_size);
14

ARGUMENTS

16       gnutls_privkey_t pkey
17                   The private key
18
19       gnutls_pk_algorithm_t algo
20                   is one of the algorithms in gnutls_pk_algorithm_t.
21
22       unsigned int bits
23                   the size of the modulus
24
25       unsigned int flags
26                   Must be zero or flags from gnutls_privkey_flags_t.
27
28       const gnutls_keygen_data_st * data
29                   Allow  specifying  gnutls_keygen_data_st  types such as the
30                   seed to be used.
31
32       unsigned data_size
33                   The number of  data available.
34

DESCRIPTION

36       This function will generate a random private key. Note that this  func‐
37       tion must be called on an initialized private key.
38
39       The  flag  GNUTLS_PRIVKEY_FLAG_PROVABLE  instructs  the  key generation
40       process to use algorithms like Shawe-Taylor (from FIPS PUB186-4)  which
41       generate provable parameters out of a seed for RSA and DSA keys. On DSA
42       keys the PQG parameters are generated using the seed, while on RSA  the
43       two  primes.  To  specify an explicit seed (by default a random seed is
44       used), use the  data with a GNUTLS_KEYGEN_SEED type.
45
46       Note that when generating an elliptic curve key, the curve can be  sub‐
47       stituted   in   the   place   of   the   bits   parameter   using   the
48       GNUTLS_CURVE_TO_BITS() macro.
49
50       To export the generated keys in memory or in files it is recommended to
51       use  the PKCS8 form as it can handle all key types, and can store addi‐
52       tional parameters such as the seed, in case  of  provable  RSA  or  DSA
53       keys.     Generated    keys   can   be   exported   in   memory   using
54       gnutls_privkey_export_x509(),          and          then           with
55       gnutls_x509_privkey_export2_pkcs8().
56
57       If key generation is part of your application, avoid setting the number
58       of bits directly, and instead use gnutls_sec_param_to_pk_bits().   That
59       way  the generated keys will adapt to the security levels of the under‐
60       lying GnuTLS library.
61

RETURNS

63       On success, GNUTLS_E_SUCCESS (0)  is  returned,  otherwise  a  negative
64       error value.
65

SINCE

67       3.5.0
68

REPORTING BUGS

70       Report bugs to <bugs@gnutls.org>.
71       Home page: https://www.gnutls.org
72
73
75       Copyright © 2001-2020 Free Software Foundation, Inc., and others.
76       Copying  and  distribution  of this file, with or without modification,
77       are permitted in any medium  without  royalty  provided  the  copyright
78       notice and this notice are preserved.
79

SEE ALSO

81       The  full  documentation  for gnutls is maintained as a Texinfo manual.
82       If the /usr/share/doc/gnutls/ directory does not contain the HTML  form
83       visit
84
85       https://www.gnutls.org/manual/
86
87gnutls                              3.6.13         gnutls_privkey_generate2(3)
Impressum