1RSA_GENERATE_KEY(3)                 OpenSSL                RSA_GENERATE_KEY(3)
2
3
4

NAME

6       RSA_generate_key_ex, RSA_generate_key, RSA_generate_multi_prime_key -
7       generate RSA key pair
8

SYNOPSIS

10        #include <openssl/rsa.h>
11
12        int RSA_generate_key_ex(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb);
13        int RSA_generate_multi_prime_key(RSA *rsa, int bits, int primes, BIGNUM *e, BN_GENCB *cb);
14
15       Deprecated:
16
17        #if OPENSSL_API_COMPAT < 0x00908000L
18        RSA *RSA_generate_key(int num, unsigned long e,
19                              void (*callback)(int, int, void *), void *cb_arg);
20        #endif
21

DESCRIPTION

23       RSA_generate_key_ex() generates a 2-prime RSA key pair and stores it in
24       the RSA structure provided in rsa. The pseudo-random number generator
25       must be seeded prior to calling RSA_generate_key_ex().
26
27       RSA_generate_multi_prime_key() generates a multi-prime RSA key pair and
28       stores it in the RSA structure provided in rsa. The number of primes is
29       given by the primes parameter. The pseudo-random number generator must
30       be seeded prior to calling RSA_generate_multi_prime_key().
31
32       The modulus size will be of length bits, the number of primes to form
33       the modulus will be primes, and the public exponent will be e. Key
34       sizes with num < 1024 should be considered insecure. The exponent is an
35       odd number, typically 3, 17 or 65537.
36
37       In order to maintain adequate security level, the maximum number of
38       permitted primes depends on modulus bit length:
39
40          <1024 | >=1024 | >=4096 | >=8192
41          ------+--------+--------+-------
42            2   |   3    |   4    |   5
43
44       A callback function may be used to provide feedback about the progress
45       of the key generation. If cb is not NULL, it will be called as follows
46       using the BN_GENCB_call() function described on the
47       BN_generate_prime(3) page.
48
49       RSA_generate_prime() is similar to RSA_generate_prime_ex() but expects
50       an old-style callback function; see BN_generate_prime(3) for
51       information on the old-style callback.
52
53       · While a random prime number is generated, it is called as described
54         in BN_generate_prime(3).
55
56       · When the n-th randomly generated prime is rejected as not suitable
57         for the key, BN_GENCB_call(cb, 2, n) is called.
58
59       · When a random p has been found with p-1 relatively prime to e, it is
60         called as BN_GENCB_call(cb, 3, 0).
61
62       The process is then repeated for prime q and other primes (if any) with
63       BN_GENCB_call(cb, 3, i) where i indicates the i-th prime.
64

RETURN VALUES

66       RSA_generate_multi_prime_key() returns 1 on success or 0 on error.
67       RSA_generate_key_ex() returns 1 on success or 0 on error.  The error
68       codes can be obtained by ERR_get_error(3).
69
70       RSA_generate_key() returns a pointer to the RSA structure or NULL if
71       the key generation fails.
72

BUGS

74       BN_GENCB_call(cb, 2, x) is used with two different meanings.
75

SEE ALSO

77       ERR_get_error(3), RAND_bytes(3), BN_generate_prime(3)
78

HISTORY

80       RSA_generate_key() was deprecated in OpenSSL 0.9.8; use
81       RSA_generate_key_ex() instead.
82
84       Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.
85
86       Licensed under the OpenSSL license (the "License").  You may not use
87       this file except in compliance with the License.  You can obtain a copy
88       in the file LICENSE in the source distribution or at
89       <https://www.openssl.org/source/license.html>.
90
91
92
931.1.1                             2018-09-11               RSA_GENERATE_KEY(3)
Impressum