mem functions cleanup
[openssl.git] / doc / apps / dhparam.pod
1 =pod
2
3 =head1 NAME
4
5 dhparam - DH parameter manipulation and generation
6
7 =head1 SYNOPSIS
8
9 B<openssl dhparam>
10 [B<-inform DER|PEM>]
11 [B<-outform DER|PEM>]
12 [B<-in> I<filename>]
13 [B<-out> I<filename>]
14 [B<-dsaparam>]
15 [B<-check>]
16 [B<-noout>]
17 [B<-text>]
18 [B<-C>]
19 [B<-2>]
20 [B<-5>]
21 [B<-rand> I<file(s)>]
22 [B<-engine id>]
23 [I<numbits>]
24
25 =head1 DESCRIPTION
26
27 This command is used to manipulate DH parameter files.
28
29 =head1 OPTIONS
30
31 =over 4
32
33 =item B<-inform DER|PEM>
34
35 This specifies the input format. The B<DER> option uses an ASN1 DER encoded
36 form compatible with the PKCS#3 DHparameter structure. The PEM form is the
37 default format: it consists of the B<DER> format base64 encoded with
38 additional header and footer lines.
39
40 =item B<-outform DER|PEM>
41
42 This specifies the output format, the options have the same meaning as the 
43 B<-inform> option.
44
45 =item B<-in> I<filename>
46
47 This specifies the input filename to read parameters from or standard input if
48 this option is not specified.
49
50 =item B<-out> I<filename>
51
52 This specifies the output filename parameters to. Standard output is used
53 if this option is not present. The output filename should B<not> be the same
54 as the input filename.
55
56 =item B<-dsaparam>
57
58 If this option is used, DSA rather than DH parameters are read or created;
59 they are converted to DH format.  Otherwise, "strong" primes (such
60 that (p-1)/2 is also prime) will be used for DH parameter generation.
61
62 DH parameter generation with the B<-dsaparam> option is much faster,
63 and the recommended exponent length is shorter, which makes DH key
64 exchange more efficient.  Beware that with such DSA-style DH
65 parameters, a fresh DH key should be created for each use to
66 avoid small-subgroup attacks that may be possible otherwise.
67
68 =item B<-check>
69
70 check if the parameters are valid primes and generator.
71
72 =item B<-2>, B<-5>
73
74 The generator to use, either 2 or 5. If present then the
75 input file is ignored and parameters are generated instead. If not
76 present but B<numbits> is present, parameters are generated with the
77 default generator 2.
78
79 =item B<-rand> I<file(s)>
80
81 a file or files containing random data used to seed the random number
82 generator, or an EGD socket (see L<RAND_egd(3)>).
83 Multiple files can be specified separated by a OS-dependent character.
84 The separator is B<;> for MS-Windows, B<,> for OpenVMS, and B<:> for
85 all others.
86
87 =item I<numbits>
88
89 this option specifies that a parameter set should be generated of size
90 I<numbits>. It must be the last option. If this option is present then
91 the input file is ignored and parameters are generated instead. If
92 this option is not present but a generator (B<-2> or B<-5>) is
93 present, parameters are generated with a default length of 2048 bits.
94
95 =item B<-noout>
96
97 this option inhibits the output of the encoded version of the parameters.
98
99 =item B<-text>
100
101 this option prints out the DH parameters in human readable form.
102
103 =item B<-C>
104
105 this option converts the parameters into C code. The parameters can then
106 be loaded by calling the get_dhNNNN() function.
107
108 =item B<-engine id>
109
110 specifying an engine (by its unique B<id> string) will cause B<dhparam>
111 to attempt to obtain a functional reference to the specified engine,
112 thus initialising it if needed. The engine will then be set as the default
113 for all available algorithms.
114
115 =back
116
117 =head1 WARNINGS
118
119 The program B<dhparam> combines the functionality of the programs B<dh> and
120 B<gendh> in previous versions of OpenSSL. The B<dh> and B<gendh>
121 programs are retained for now but may have different purposes in future 
122 versions of OpenSSL.
123
124 =head1 NOTES
125
126 PEM format DH parameters use the header and footer lines:
127
128  -----BEGIN DH PARAMETERS-----
129  -----END DH PARAMETERS-----
130
131 OpenSSL currently only supports the older PKCS#3 DH, not the newer X9.42
132 DH.
133
134 This program manipulates DH parameters not keys.
135
136 =head1 BUGS
137
138 There should be a way to generate and manipulate DH keys.
139
140 =head1 SEE ALSO
141
142 L<dsaparam(1)>
143
144 =cut