blob: 6239cd8bee9ee9e9b8e0c0b20b0fa44169d16cd0 [file] [log] [blame]
Dr. Stephen Hensonaba3e651999-11-10 02:52:17 +00001=pod
2
Rich Salz9fcb9702019-10-12 17:45:56 -04003=begin comment
4{- join("\n", @autowarntext) -}
5
6=end comment
7
Dr. Stephen Hensonaba3e651999-11-10 02:52:17 +00008=head1 NAME
9
Dr. Matthias St. Pierreb6b66572019-08-22 01:04:41 +020010openssl-genrsa - generate an RSA private key
Dr. Stephen Hensonaba3e651999-11-10 02:52:17 +000011
Dr. Stephen Hensonaba3e651999-11-10 02:52:17 +000012=head1 SYNOPSIS
13
14B<openssl> B<genrsa>
A J Mohan Rao169394d2016-02-05 11:58:45 -050015[B<-help>]
Rich Salze8769712019-09-25 15:20:11 -040016[B<-out> I<filename>]
17[B<-passout> I<arg>]
Rich Salzfc1d88f2014-07-02 22:42:40 -040018[B<-aes128>]
Rich Salzfc1d88f2014-07-02 22:42:40 -040019[B<-aes192>]
20[B<-aes256>]
Paulid42d0a42017-02-01 10:10:13 +100021[B<-aria128>]
22[B<-aria192>]
23[B<-aria256>]
Rich Salzfc1d88f2014-07-02 22:42:40 -040024[B<-camellia128>]
25[B<-camellia192>]
26[B<-camellia256>]
Dr. Stephen Hensonaba3e651999-11-10 02:52:17 +000027[B<-des>]
28[B<-des3>]
29[B<-idea>]
Richard Levitte2f0ea932019-10-01 18:16:29 +020030[B<-f4>|B<-3>]
Rich Salze8769712019-09-25 15:20:11 -040031[B<-engine> I<id>]
32[B<-primes> I<num>]
Philip Prindevillec43fa562018-08-08 11:51:23 -060033[B<-verbose>]
Rich Salz9fcb9702019-10-12 17:45:56 -040034{- $OpenSSL::safe::opt_r_synopsis -}
Dr. Stephen Hensonaba3e651999-11-10 02:52:17 +000035[B<numbits>]
36
Rich Salz9f3c0762019-10-11 11:52:12 -040037=for openssl ifdef engine
Rich Salz1738c0c2019-09-22 19:49:25 -040038
Dr. Stephen Hensonaba3e651999-11-10 02:52:17 +000039=head1 DESCRIPTION
40
Richard Levitte35a810b2019-10-01 19:43:36 +020041This command generates an RSA private key.
Dr. Stephen Hensonaba3e651999-11-10 02:52:17 +000042
43=head1 OPTIONS
44
45=over 4
46
A J Mohan Rao169394d2016-02-05 11:58:45 -050047=item B<-help>
48
49Print out a usage message.
50
Rich Salze8769712019-09-25 15:20:11 -040051=item B<-out> I<filename>
Dr. Stephen Hensonf07fb9b2000-02-08 01:34:59 +000052
A J Mohan Rao169394d2016-02-05 11:58:45 -050053Output the key to the specified file. If this argument is not specified then
54standard output is used.
Dr. Stephen Hensonf07fb9b2000-02-08 01:34:59 +000055
Rich Salze8769712019-09-25 15:20:11 -040056=item B<-passout> I<arg>
Dr. Stephen Hensonf07fb9b2000-02-08 01:34:59 +000057
Paulic4de0742017-03-30 07:38:30 +100058The output file password source. For more information about the format
Rich Salz3a4e43d2019-10-08 13:10:04 -040059see L<openssl(1)/Pass Phrase Options>.
Dr. Stephen Hensonf07fb9b2000-02-08 01:34:59 +000060
Rich Salzdfee8622018-07-03 12:45:14 -040061=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 +000062
Rich Salzfc1d88f2014-07-02 22:42:40 -040063These options encrypt the private key with specified
64cipher before outputting it. If none of these options is
Dr. Stephen Hensonf07fb9b2000-02-08 01:34:59 +000065specified no encryption is used. If encryption is used a pass phrase is prompted
Dr. Stephen Hensona3fe3822000-02-16 23:16:01 +000066for if it is not supplied via the B<-passout> argument.
Dr. Stephen Hensonaba3e651999-11-10 02:52:17 +000067
Rich Salze8769712019-09-25 15:20:11 -040068=item B<-F4>|B<-3>
Dr. Stephen Hensonaba3e651999-11-10 02:52:17 +000069
Paulic4de0742017-03-30 07:38:30 +100070The public exponent to use, either 65537 or 3. The default is 65537.
Dr. Stephen Hensonaba3e651999-11-10 02:52:17 +000071
Rich Salze8769712019-09-25 15:20:11 -040072=item B<-engine> I<id>
Richard Levittebfa35552003-01-30 22:02:27 +000073
Richard Levitte35a810b2019-10-01 19:43:36 +020074Specifying an engine (by its unique I<id> string) will cause this command
Richard Levittebfa35552003-01-30 22:02:27 +000075to attempt to obtain a functional reference to the specified engine,
76thus initialising it if needed. The engine will then be set as the default
77for all available algorithms.
78
Rich Salze8769712019-09-25 15:20:11 -040079=item B<-primes> I<num>
Paul Yang665d8992017-08-02 02:19:43 +080080
Richard Levitte2f0ea932019-10-01 18:16:29 +020081Specify the number of primes to use while generating the RSA key. The I<num>
Paul Yang665d8992017-08-02 02:19:43 +080082parameter must be a positive integer that is greater than 1 and less than 16.
Richard Levitte2f0ea932019-10-01 18:16:29 +020083If I<num> is greater than 2, then the generated key is called a 'multi-prime'
Paul Yang665d8992017-08-02 02:19:43 +080084RSA key, which is defined in RFC 8017.
85
Philip Prindevillec43fa562018-08-08 11:51:23 -060086=item B<-verbose>
87
88Print extra details about the operations being performed.
89
Rich Salz9fcb9702019-10-12 17:45:56 -040090{- $OpenSSL::safe::opt_r_item -}
91
Dr. Stephen Hensonaba3e651999-11-10 02:52:17 +000092=item B<numbits>
93
Paulic4de0742017-03-30 07:38:30 +100094The size of the private key to generate in bits. This must be the last option
Sebastian Andrzej Siewiorcac19d12017-10-18 13:30:23 +020095specified. The default is 2048 and values less than 512 are not allowed.
Dr. Stephen Hensonaba3e651999-11-10 02:52:17 +000096
97=back
98
99=head1 NOTES
100
Paul Yang665d8992017-08-02 02:19:43 +0800101RSA private key generation essentially involves the generation of two or more
102prime numbers. When generating a private key various symbols will be output to
Dr. Stephen Hensona3fe3822000-02-16 23:16:01 +0000103indicate the progress of the generation. A B<.> represents each number which
104has passed an initial sieve test, B<+> means a number has passed a single
Paul Yang665d8992017-08-02 02:19:43 +0800105round of the Miller-Rabin primality test, B<*> means the current prime starts
106a regenerating progress due to some failed tests. A newline means that the number
107has passed all the prime tests (the actual number depends on the key size).
Dr. Stephen Hensonaba3e651999-11-10 02:52:17 +0000108
109Because key generation is a random process the time taken to generate a key
Paul Yang665d8992017-08-02 02:19:43 +0800110may vary somewhat. But in general, more primes lead to less generation time
111of a key.
Dr. Stephen Hensonaba3e651999-11-10 02:52:17 +0000112
Dr. Stephen Hensonaba3e651999-11-10 02:52:17 +0000113=head1 SEE ALSO
114
Dr. Matthias St. Pierreb6b66572019-08-22 01:04:41 +0200115L<openssl(1)>,
116L<openssl-gendsa(1)>
Ulf Möller369782a2000-03-18 22:00:26 +0000117
Rich Salze2f92612016-05-18 11:44:05 -0400118=head1 COPYRIGHT
119
Dr. Matthias St. Pierreb6b66572019-08-22 01:04:41 +0200120Copyright 2000-2019 The OpenSSL Project Authors. All Rights Reserved.
Rich Salze2f92612016-05-18 11:44:05 -0400121
Richard Levitte449040b2018-12-06 14:04:11 +0100122Licensed under the Apache License 2.0 (the "License"). You may not use
Rich Salze2f92612016-05-18 11:44:05 -0400123this file except in compliance with the License. You can obtain a copy
124in the file LICENSE in the source distribution or at
125L<https://www.openssl.org/source/license.html>.
126
127=cut