Dr. Stephen Henson | aba3e65 | 1999-11-10 02:52:17 +0000 | [diff] [blame] | 1 | =pod |
Rich Salz | 625c781 | 2019-10-30 23:35:08 -0400 | [diff] [blame] | 2 | {- OpenSSL::safe::output_do_not_edit_headers(); -} |
Rich Salz | 9fcb970 | 2019-10-12 17:45:56 -0400 | [diff] [blame] | 3 | |
Dr. Stephen Henson | aba3e65 | 1999-11-10 02:52:17 +0000 | [diff] [blame] | 4 | =head1 NAME |
| 5 | |
Dr. Matthias St. Pierre | b6b6657 | 2019-08-22 01:04:41 +0200 | [diff] [blame] | 6 | openssl-genrsa - generate an RSA private key |
Dr. Stephen Henson | aba3e65 | 1999-11-10 02:52:17 +0000 | [diff] [blame] | 7 | |
Dr. Stephen Henson | aba3e65 | 1999-11-10 02:52:17 +0000 | [diff] [blame] | 8 | =head1 SYNOPSIS |
| 9 | |
| 10 | B<openssl> B<genrsa> |
A J Mohan Rao | 169394d | 2016-02-05 11:58:45 -0500 | [diff] [blame] | 11 | [B<-help>] |
Rich Salz | e876971 | 2019-09-25 15:20:11 -0400 | [diff] [blame] | 12 | [B<-out> I<filename>] |
| 13 | [B<-passout> I<arg>] |
Rich Salz | fc1d88f | 2014-07-02 22:42:40 -0400 | [diff] [blame] | 14 | [B<-aes128>] |
Rich Salz | fc1d88f | 2014-07-02 22:42:40 -0400 | [diff] [blame] | 15 | [B<-aes192>] |
| 16 | [B<-aes256>] |
Pauli | d42d0a4 | 2017-02-01 10:10:13 +1000 | [diff] [blame] | 17 | [B<-aria128>] |
| 18 | [B<-aria192>] |
| 19 | [B<-aria256>] |
Rich Salz | fc1d88f | 2014-07-02 22:42:40 -0400 | [diff] [blame] | 20 | [B<-camellia128>] |
| 21 | [B<-camellia192>] |
| 22 | [B<-camellia256>] |
Dr. Stephen Henson | aba3e65 | 1999-11-10 02:52:17 +0000 | [diff] [blame] | 23 | [B<-des>] |
| 24 | [B<-des3>] |
| 25 | [B<-idea>] |
Rich Salz | 65718c5 | 2020-01-16 13:40:52 -0500 | [diff] [blame] | 26 | [B<-F4>] |
| 27 | [B<-f4>] |
| 28 | [B<-3>] |
Rich Salz | e876971 | 2019-09-25 15:20:11 -0400 | [diff] [blame] | 29 | [B<-primes> I<num>] |
Philip Prindeville | c43fa56 | 2018-08-08 11:51:23 -0600 | [diff] [blame] | 30 | [B<-verbose>] |
Philip Prindeville | a414fd6 | 2021-12-21 20:44:07 -0700 | [diff] [blame] | 31 | [B<-quiet>] |
Kurt Roeckx | 10203a3 | 2019-04-13 15:52:47 +0200 | [diff] [blame] | 32 | [B<-traditional>] |
Rich Salz | 9fcb970 | 2019-10-12 17:45:56 -0400 | [diff] [blame] | 33 | {- $OpenSSL::safe::opt_r_synopsis -} |
Dr. David von Oheimb | d55e448 | 2020-09-21 11:56:01 +0200 | [diff] [blame] | 34 | {- $OpenSSL::safe::opt_engine_synopsis -}{- $OpenSSL::safe::opt_provider_synopsis -} |
Dr. Stephen Henson | aba3e65 | 1999-11-10 02:52:17 +0000 | [diff] [blame] | 35 | [B<numbits>] |
| 36 | |
| 37 | =head1 DESCRIPTION |
| 38 | |
Pauli | b9f733c | 2020-02-12 15:49:16 +1000 | [diff] [blame] | 39 | This command has been deprecated. |
| 40 | The L<openssl-genpkey(1)> command should be used instead. |
| 41 | |
Richard Levitte | 35a810b | 2019-10-01 19:43:36 +0200 | [diff] [blame] | 42 | This command generates an RSA private key. |
Dr. Stephen Henson | aba3e65 | 1999-11-10 02:52:17 +0000 | [diff] [blame] | 43 | |
| 44 | =head1 OPTIONS |
| 45 | |
| 46 | =over 4 |
| 47 | |
A J Mohan Rao | 169394d | 2016-02-05 11:58:45 -0500 | [diff] [blame] | 48 | =item B<-help> |
| 49 | |
| 50 | Print out a usage message. |
| 51 | |
Rich Salz | e876971 | 2019-09-25 15:20:11 -0400 | [diff] [blame] | 52 | =item B<-out> I<filename> |
Dr. Stephen Henson | f07fb9b | 2000-02-08 01:34:59 +0000 | [diff] [blame] | 53 | |
A J Mohan Rao | 169394d | 2016-02-05 11:58:45 -0500 | [diff] [blame] | 54 | Output the key to the specified file. If this argument is not specified then |
| 55 | standard output is used. |
Dr. Stephen Henson | f07fb9b | 2000-02-08 01:34:59 +0000 | [diff] [blame] | 56 | |
Rich Salz | e876971 | 2019-09-25 15:20:11 -0400 | [diff] [blame] | 57 | =item B<-passout> I<arg> |
Dr. Stephen Henson | f07fb9b | 2000-02-08 01:34:59 +0000 | [diff] [blame] | 58 | |
Pauli | c4de074 | 2017-03-30 07:38:30 +1000 | [diff] [blame] | 59 | The output file password source. For more information about the format |
Ankita Shetty | 4694915 | 2020-12-09 21:56:51 +0100 | [diff] [blame] | 60 | see L<openssl-passphrase-options(1)>. |
Dr. Stephen Henson | f07fb9b | 2000-02-08 01:34:59 +0000 | [diff] [blame] | 61 | |
Rich Salz | dfee862 | 2018-07-03 12:45:14 -0400 | [diff] [blame] | 62 | =item B<-aes128>, B<-aes192>, B<-aes256>, B<-aria128>, B<-aria192>, B<-aria256>, B<-camellia128>, B<-camellia192>, B<-camellia256>, B<-des>, B<-des3>, B<-idea> |
Dr. Stephen Henson | aba3e65 | 1999-11-10 02:52:17 +0000 | [diff] [blame] | 63 | |
Rich Salz | fc1d88f | 2014-07-02 22:42:40 -0400 | [diff] [blame] | 64 | These options encrypt the private key with specified |
| 65 | cipher before outputting it. If none of these options is |
Dr. Stephen Henson | f07fb9b | 2000-02-08 01:34:59 +0000 | [diff] [blame] | 66 | specified no encryption is used. If encryption is used a pass phrase is prompted |
Dr. Stephen Henson | a3fe382 | 2000-02-16 23:16:01 +0000 | [diff] [blame] | 67 | for if it is not supplied via the B<-passout> argument. |
Dr. Stephen Henson | aba3e65 | 1999-11-10 02:52:17 +0000 | [diff] [blame] | 68 | |
Rich Salz | 65718c5 | 2020-01-16 13:40:52 -0500 | [diff] [blame] | 69 | =item B<-F4>, B<-f4>, B<-3> |
Dr. Stephen Henson | aba3e65 | 1999-11-10 02:52:17 +0000 | [diff] [blame] | 70 | |
Pauli | c4de074 | 2017-03-30 07:38:30 +1000 | [diff] [blame] | 71 | The public exponent to use, either 65537 or 3. The default is 65537. |
Shane Lontis | 8bf3770 | 2020-06-10 08:59:56 +1000 | [diff] [blame] | 72 | The B<-3> option has been deprecated. |
Dr. Stephen Henson | aba3e65 | 1999-11-10 02:52:17 +0000 | [diff] [blame] | 73 | |
Rich Salz | e876971 | 2019-09-25 15:20:11 -0400 | [diff] [blame] | 74 | =item B<-primes> I<num> |
Paul Yang | 665d899 | 2017-08-02 02:19:43 +0800 | [diff] [blame] | 75 | |
Richard Levitte | 2f0ea93 | 2019-10-01 18:16:29 +0200 | [diff] [blame] | 76 | Specify the number of primes to use while generating the RSA key. The I<num> |
Paul Yang | 665d899 | 2017-08-02 02:19:43 +0800 | [diff] [blame] | 77 | parameter must be a positive integer that is greater than 1 and less than 16. |
Richard Levitte | 2f0ea93 | 2019-10-01 18:16:29 +0200 | [diff] [blame] | 78 | If I<num> is greater than 2, then the generated key is called a 'multi-prime' |
Paul Yang | 665d899 | 2017-08-02 02:19:43 +0800 | [diff] [blame] | 79 | RSA key, which is defined in RFC 8017. |
| 80 | |
Philip Prindeville | c43fa56 | 2018-08-08 11:51:23 -0600 | [diff] [blame] | 81 | =item B<-verbose> |
| 82 | |
| 83 | Print extra details about the operations being performed. |
| 84 | |
Philip Prindeville | a414fd6 | 2021-12-21 20:44:07 -0700 | [diff] [blame] | 85 | =item B<-quiet> |
| 86 | |
| 87 | Print fewer details about the operations being performed, which may |
| 88 | be handy during batch scripts and pipelines. |
| 89 | |
Kurt Roeckx | 10203a3 | 2019-04-13 15:52:47 +0200 | [diff] [blame] | 90 | =item B<-traditional> |
| 91 | |
| 92 | Write the key using the traditional PKCS#1 format instead of the PKCS#8 format. |
| 93 | |
Rich Salz | 9fcb970 | 2019-10-12 17:45:56 -0400 | [diff] [blame] | 94 | {- $OpenSSL::safe::opt_r_item -} |
| 95 | |
Rich Salz | 018aaeb | 2019-10-12 17:45:56 -0400 | [diff] [blame] | 96 | {- $OpenSSL::safe::opt_engine_item -} |
| 97 | |
Pauli | 6bd4e3f | 2020-02-25 14:29:30 +1000 | [diff] [blame] | 98 | {- $OpenSSL::safe::opt_provider_item -} |
| 99 | |
Dr. Stephen Henson | aba3e65 | 1999-11-10 02:52:17 +0000 | [diff] [blame] | 100 | =item B<numbits> |
| 101 | |
Pauli | c4de074 | 2017-03-30 07:38:30 +1000 | [diff] [blame] | 102 | The size of the private key to generate in bits. This must be the last option |
Sebastian Andrzej Siewior | cac19d1 | 2017-10-18 13:30:23 +0200 | [diff] [blame] | 103 | specified. The default is 2048 and values less than 512 are not allowed. |
Dr. Stephen Henson | aba3e65 | 1999-11-10 02:52:17 +0000 | [diff] [blame] | 104 | |
| 105 | =back |
| 106 | |
| 107 | =head1 NOTES |
| 108 | |
Paul Yang | 665d899 | 2017-08-02 02:19:43 +0800 | [diff] [blame] | 109 | RSA private key generation essentially involves the generation of two or more |
| 110 | prime numbers. When generating a private key various symbols will be output to |
Dr. Stephen Henson | a3fe382 | 2000-02-16 23:16:01 +0000 | [diff] [blame] | 111 | indicate the progress of the generation. A B<.> represents each number which |
| 112 | has passed an initial sieve test, B<+> means a number has passed a single |
Paul Yang | 665d899 | 2017-08-02 02:19:43 +0800 | [diff] [blame] | 113 | round of the Miller-Rabin primality test, B<*> means the current prime starts |
| 114 | a regenerating progress due to some failed tests. A newline means that the number |
| 115 | has passed all the prime tests (the actual number depends on the key size). |
Dr. Stephen Henson | aba3e65 | 1999-11-10 02:52:17 +0000 | [diff] [blame] | 116 | |
| 117 | Because key generation is a random process the time taken to generate a key |
Paul Yang | 665d899 | 2017-08-02 02:19:43 +0800 | [diff] [blame] | 118 | may vary somewhat. But in general, more primes lead to less generation time |
| 119 | of a key. |
Dr. Stephen Henson | aba3e65 | 1999-11-10 02:52:17 +0000 | [diff] [blame] | 120 | |
Dr. Stephen Henson | aba3e65 | 1999-11-10 02:52:17 +0000 | [diff] [blame] | 121 | =head1 SEE ALSO |
| 122 | |
Dr. Matthias St. Pierre | b6b6657 | 2019-08-22 01:04:41 +0200 | [diff] [blame] | 123 | L<openssl(1)>, |
Pauli | b9f733c | 2020-02-12 15:49:16 +1000 | [diff] [blame] | 124 | L<openssl-genpkey(1)>, |
Dr. Matthias St. Pierre | b6b6657 | 2019-08-22 01:04:41 +0200 | [diff] [blame] | 125 | L<openssl-gendsa(1)> |
Ulf Möller | 369782a | 2000-03-18 22:00:26 +0000 | [diff] [blame] | 126 | |
Pauli | b9f733c | 2020-02-12 15:49:16 +1000 | [diff] [blame] | 127 | =head1 HISTORY |
| 128 | |
| 129 | This command was deprecated in OpenSSL 3.0. |
| 130 | |
Rich Salz | e2f9261 | 2016-05-18 11:44:05 -0400 | [diff] [blame] | 131 | =head1 COPYRIGHT |
| 132 | |
Matt Caswell | fecb3aa | 2022-05-03 11:52:38 +0100 | [diff] [blame] | 133 | Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved. |
Rich Salz | e2f9261 | 2016-05-18 11:44:05 -0400 | [diff] [blame] | 134 | |
Richard Levitte | 449040b | 2018-12-06 14:04:11 +0100 | [diff] [blame] | 135 | Licensed under the Apache License 2.0 (the "License"). You may not use |
Rich Salz | e2f9261 | 2016-05-18 11:44:05 -0400 | [diff] [blame] | 136 | this file except in compliance with the License. You can obtain a copy |
| 137 | in the file LICENSE in the source distribution or at |
| 138 | L<https://www.openssl.org/source/license.html>. |
| 139 | |
| 140 | =cut |