blob: 4906c652077c0a8eecafe1ab66d1e7f47d227e47 [file] [log] [blame]
Dr. Stephen Hensonaba3e651999-11-10 02:52:17 +00001=pod
Rich Salz625c7812019-10-30 23:35:08 -04002{- OpenSSL::safe::output_do_not_edit_headers(); -}
Rich Salz9fcb9702019-10-12 17:45:56 -04003
Dr. Stephen Hensonaba3e651999-11-10 02:52:17 +00004=head1 NAME
5
Dr. Matthias St. Pierreb6b66572019-08-22 01:04:41 +02006openssl-genrsa - generate an RSA private key
Dr. Stephen Hensonaba3e651999-11-10 02:52:17 +00007
Dr. Stephen Hensonaba3e651999-11-10 02:52:17 +00008=head1 SYNOPSIS
9
10B<openssl> B<genrsa>
A J Mohan Rao169394d2016-02-05 11:58:45 -050011[B<-help>]
Rich Salze8769712019-09-25 15:20:11 -040012[B<-out> I<filename>]
13[B<-passout> I<arg>]
Rich Salzfc1d88f2014-07-02 22:42:40 -040014[B<-aes128>]
Rich Salzfc1d88f2014-07-02 22:42:40 -040015[B<-aes192>]
16[B<-aes256>]
Paulid42d0a42017-02-01 10:10:13 +100017[B<-aria128>]
18[B<-aria192>]
19[B<-aria256>]
Rich Salzfc1d88f2014-07-02 22:42:40 -040020[B<-camellia128>]
21[B<-camellia192>]
22[B<-camellia256>]
Dr. Stephen Hensonaba3e651999-11-10 02:52:17 +000023[B<-des>]
24[B<-des3>]
25[B<-idea>]
Rich Salz65718c52020-01-16 13:40:52 -050026[B<-F4>]
27[B<-f4>]
28[B<-3>]
Rich Salze8769712019-09-25 15:20:11 -040029[B<-primes> I<num>]
Philip Prindevillec43fa562018-08-08 11:51:23 -060030[B<-verbose>]
Philip Prindevillea414fd62021-12-21 20:44:07 -070031[B<-quiet>]
Kurt Roeckx10203a32019-04-13 15:52:47 +020032[B<-traditional>]
Rich Salz9fcb9702019-10-12 17:45:56 -040033{- $OpenSSL::safe::opt_r_synopsis -}
Dr. David von Oheimbd55e4482020-09-21 11:56:01 +020034{- $OpenSSL::safe::opt_engine_synopsis -}{- $OpenSSL::safe::opt_provider_synopsis -}
Dr. Stephen Hensonaba3e651999-11-10 02:52:17 +000035[B<numbits>]
36
37=head1 DESCRIPTION
38
Paulib9f733c2020-02-12 15:49:16 +100039This command has been deprecated.
40The L<openssl-genpkey(1)> command should be used instead.
41
Richard Levitte35a810b2019-10-01 19:43:36 +020042This command generates an RSA private key.
Dr. Stephen Hensonaba3e651999-11-10 02:52:17 +000043
44=head1 OPTIONS
45
46=over 4
47
A J Mohan Rao169394d2016-02-05 11:58:45 -050048=item B<-help>
49
50Print out a usage message.
51
Rich Salze8769712019-09-25 15:20:11 -040052=item B<-out> I<filename>
Dr. Stephen Hensonf07fb9b2000-02-08 01:34:59 +000053
A J Mohan Rao169394d2016-02-05 11:58:45 -050054Output the key to the specified file. If this argument is not specified then
55standard output is used.
Dr. Stephen Hensonf07fb9b2000-02-08 01:34:59 +000056
Rich Salze8769712019-09-25 15:20:11 -040057=item B<-passout> I<arg>
Dr. Stephen Hensonf07fb9b2000-02-08 01:34:59 +000058
Paulic4de0742017-03-30 07:38:30 +100059The output file password source. For more information about the format
Ankita Shetty46949152020-12-09 21:56:51 +010060see L<openssl-passphrase-options(1)>.
Dr. Stephen Hensonf07fb9b2000-02-08 01:34:59 +000061
Rich Salzdfee8622018-07-03 12:45:14 -040062=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 Hensonaba3e651999-11-10 02:52:17 +000063
Rich Salzfc1d88f2014-07-02 22:42:40 -040064These options encrypt the private key with specified
65cipher before outputting it. If none of these options is
Dr. Stephen Hensonf07fb9b2000-02-08 01:34:59 +000066specified no encryption is used. If encryption is used a pass phrase is prompted
Dr. Stephen Hensona3fe3822000-02-16 23:16:01 +000067for if it is not supplied via the B<-passout> argument.
Dr. Stephen Hensonaba3e651999-11-10 02:52:17 +000068
Rich Salz65718c52020-01-16 13:40:52 -050069=item B<-F4>, B<-f4>, B<-3>
Dr. Stephen Hensonaba3e651999-11-10 02:52:17 +000070
Paulic4de0742017-03-30 07:38:30 +100071The public exponent to use, either 65537 or 3. The default is 65537.
Shane Lontis8bf37702020-06-10 08:59:56 +100072The B<-3> option has been deprecated.
Dr. Stephen Hensonaba3e651999-11-10 02:52:17 +000073
Rich Salze8769712019-09-25 15:20:11 -040074=item B<-primes> I<num>
Paul Yang665d8992017-08-02 02:19:43 +080075
Richard Levitte2f0ea932019-10-01 18:16:29 +020076Specify the number of primes to use while generating the RSA key. The I<num>
Paul Yang665d8992017-08-02 02:19:43 +080077parameter must be a positive integer that is greater than 1 and less than 16.
Richard Levitte2f0ea932019-10-01 18:16:29 +020078If I<num> is greater than 2, then the generated key is called a 'multi-prime'
Paul Yang665d8992017-08-02 02:19:43 +080079RSA key, which is defined in RFC 8017.
80
Philip Prindevillec43fa562018-08-08 11:51:23 -060081=item B<-verbose>
82
83Print extra details about the operations being performed.
84
Philip Prindevillea414fd62021-12-21 20:44:07 -070085=item B<-quiet>
86
87Print fewer details about the operations being performed, which may
88be handy during batch scripts and pipelines.
89
Kurt Roeckx10203a32019-04-13 15:52:47 +020090=item B<-traditional>
91
92Write the key using the traditional PKCS#1 format instead of the PKCS#8 format.
93
Rich Salz9fcb9702019-10-12 17:45:56 -040094{- $OpenSSL::safe::opt_r_item -}
95
Rich Salz018aaeb2019-10-12 17:45:56 -040096{- $OpenSSL::safe::opt_engine_item -}
97
Pauli6bd4e3f2020-02-25 14:29:30 +100098{- $OpenSSL::safe::opt_provider_item -}
99
Dr. Stephen Hensonaba3e651999-11-10 02:52:17 +0000100=item B<numbits>
101
Paulic4de0742017-03-30 07:38:30 +1000102The size of the private key to generate in bits. This must be the last option
Sebastian Andrzej Siewiorcac19d12017-10-18 13:30:23 +0200103specified. The default is 2048 and values less than 512 are not allowed.
Dr. Stephen Hensonaba3e651999-11-10 02:52:17 +0000104
105=back
106
107=head1 NOTES
108
Paul Yang665d8992017-08-02 02:19:43 +0800109RSA private key generation essentially involves the generation of two or more
110prime numbers. When generating a private key various symbols will be output to
Dr. Stephen Hensona3fe3822000-02-16 23:16:01 +0000111indicate the progress of the generation. A B<.> represents each number which
112has passed an initial sieve test, B<+> means a number has passed a single
Paul Yang665d8992017-08-02 02:19:43 +0800113round of the Miller-Rabin primality test, B<*> means the current prime starts
114a regenerating progress due to some failed tests. A newline means that the number
115has passed all the prime tests (the actual number depends on the key size).
Dr. Stephen Hensonaba3e651999-11-10 02:52:17 +0000116
117Because key generation is a random process the time taken to generate a key
Paul Yang665d8992017-08-02 02:19:43 +0800118may vary somewhat. But in general, more primes lead to less generation time
119of a key.
Dr. Stephen Hensonaba3e651999-11-10 02:52:17 +0000120
Dr. Stephen Hensonaba3e651999-11-10 02:52:17 +0000121=head1 SEE ALSO
122
Dr. Matthias St. Pierreb6b66572019-08-22 01:04:41 +0200123L<openssl(1)>,
Paulib9f733c2020-02-12 15:49:16 +1000124L<openssl-genpkey(1)>,
Dr. Matthias St. Pierreb6b66572019-08-22 01:04:41 +0200125L<openssl-gendsa(1)>
Ulf Möller369782a2000-03-18 22:00:26 +0000126
Paulib9f733c2020-02-12 15:49:16 +1000127=head1 HISTORY
128
129This command was deprecated in OpenSSL 3.0.
130
Rich Salze2f92612016-05-18 11:44:05 -0400131=head1 COPYRIGHT
132
Matt Caswellfecb3aa2022-05-03 11:52:38 +0100133Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.
Rich Salze2f92612016-05-18 11:44:05 -0400134
Richard Levitte449040b2018-12-06 14:04:11 +0100135Licensed under the Apache License 2.0 (the "License"). You may not use
Rich Salze2f92612016-05-18 11:44:05 -0400136this file except in compliance with the License. You can obtain a copy
137in the file LICENSE in the source distribution or at
138L<https://www.openssl.org/source/license.html>.
139
140=cut