Fix: PEM_read_bio_PrivateKey with no-ui / no-stdio
[openssl.git] / doc / apps / openssl.pod
1 =pod
2
3 =head1 NAME
4
5 openssl - OpenSSL command line tool
6
7 =head1 SYNOPSIS
8
9 B<openssl>
10 I<command>
11 [ I<command_opts> ]
12 [ I<command_args> ]
13
14 B<openssl> B<list> [ B<standard-commands> | B<digest-commands> | B<cipher-commands> | B<cipher-algorithms> | B<digest-algorithms> | B<public-key-algorithms>]
15
16 B<openssl> B<no->I<XXX> [ I<arbitrary options> ]
17
18 =head1 DESCRIPTION
19
20 OpenSSL is a cryptography toolkit implementing the Secure Sockets Layer (SSL
21 v2/v3) and Transport Layer Security (TLS v1) network protocols and related
22 cryptography standards required by them.
23
24 The B<openssl> program is a command line tool for using the various
25 cryptography functions of OpenSSL's B<crypto> library from the shell.
26 It can be used for
27
28  o  Creation and management of private keys, public keys and parameters
29  o  Public key cryptographic operations
30  o  Creation of X.509 certificates, CSRs and CRLs
31  o  Calculation of Message Digests
32  o  Encryption and Decryption with Ciphers
33  o  SSL/TLS Client and Server Tests
34  o  Handling of S/MIME signed or encrypted mail
35  o  Time Stamp requests, generation and verification
36
37 =head1 COMMAND SUMMARY
38
39 The B<openssl> program provides a rich variety of commands (I<command> in the
40 SYNOPSIS above), each of which often has a wealth of options and arguments
41 (I<command_opts> and I<command_args> in the SYNOPSIS).
42
43 The list parameters B<standard-commands>, B<digest-commands>,
44 and B<cipher-commands> output a list (one entry per line) of the names
45 of all standard commands, message digest commands, or cipher commands,
46 respectively, that are available in the present B<openssl> utility.
47
48 The list parameters B<cipher-algorithms> and
49 B<digest-algorithms> list all cipher and message digest names, one entry per line. Aliases are listed as:
50
51  from => to
52
53 The list parameter B<public-key-algorithms> lists all supported public
54 key algorithms.
55
56 The command B<no->I<XXX> tests whether a command of the
57 specified name is available.  If no command named I<XXX> exists, it
58 returns 0 (success) and prints B<no->I<XXX>; otherwise it returns 1
59 and prints I<XXX>.  In both cases, the output goes to B<stdout> and
60 nothing is printed to B<stderr>.  Additional command line arguments
61 are always ignored.  Since for each cipher there is a command of the
62 same name, this provides an easy way for shell scripts to test for the
63 availability of ciphers in the B<openssl> program.  (B<no->I<XXX> is
64 not able to detect pseudo-commands such as B<quit>,
65 B<list>, or B<no->I<XXX> itself.)
66
67 =head2 Standard Commands
68
69 =over 10
70
71 =item L<B<asn1parse>|asn1parse(1)>
72
73 Parse an ASN.1 sequence.
74
75 =item L<B<ca>|ca(1)>
76
77 Certificate Authority (CA) Management.
78
79 =item L<B<ciphers>|ciphers(1)>
80
81 Cipher Suite Description Determination.
82
83 =item L<B<cms>|cms(1)>
84
85 CMS (Cryptographic Message Syntax) utility
86
87 =item L<B<crl>|crl(1)>
88
89 Certificate Revocation List (CRL) Management.
90
91 =item L<B<crl2pkcs7>|crl2pkcs7(1)>
92
93 CRL to PKCS#7 Conversion.
94
95 =item L<B<dgst>|dgst(1)>
96
97 Message Digest Calculation.
98
99 =item B<dh>
100
101 Diffie-Hellman Parameter Management.
102 Obsoleted by L<B<dhparam>|dhparam(1)>.
103
104 =item L<B<dhparam>|dhparam(1)>
105
106 Generation and Management of Diffie-Hellman Parameters. Superseded by
107 L<B<genpkey>|genpkey(1)> and L<B<pkeyparam>|pkeyparam(1)>
108
109
110 =item L<B<dsa>|dsa(1)>
111
112 DSA Data Management.
113
114 =item L<B<dsaparam>|dsaparam(1)>
115
116 DSA Parameter Generation and Management. Superseded by
117 L<B<genpkey>|genpkey(1)> and L<B<pkeyparam>|pkeyparam(1)>
118
119 =item L<B<ec>|ec(1)>
120
121 EC (Elliptic curve) key processing
122
123 =item L<B<ecparam>|ecparam(1)>
124
125 EC parameter manipulation and generation
126
127 =item L<B<enc>|enc(1)>
128
129 Encoding with Ciphers.
130
131 =item L<B<engine>|engine(1)>
132
133 Engine (loadable module) information and manipulation.
134
135 =item L<B<errstr>|errstr(1)>
136
137 Error Number to Error String Conversion.
138
139 =item B<gendh>
140
141 Generation of Diffie-Hellman Parameters.
142 Obsoleted by L<B<dhparam>|dhparam(1)>.
143
144 =item L<B<gendsa>|gendsa(1)>
145
146 Generation of DSA Private Key from Parameters. Superseded by
147 L<B<genpkey>|genpkey(1)> and L<B<pkey>|pkey(1)>
148
149 =item L<B<genpkey>|genpkey(1)>
150
151 Generation of Private Key or Parameters.
152
153 =item L<B<genrsa>|genrsa(1)>
154
155 Generation of RSA Private Key. Superseded by L<B<genpkey>|genpkey(1)>.
156
157 =item L<B<nseq>|nseq(1)>
158
159 Create or examine a netscape certificate sequence
160
161 =item L<B<ocsp>|ocsp(1)>
162
163 Online Certificate Status Protocol utility.
164
165 =item L<B<passwd>|passwd(1)>
166
167 Generation of hashed passwords.
168
169 =item L<B<pkcs12>|pkcs12(1)>
170
171 PKCS#12 Data Management.
172
173 =item L<B<pkcs7>|pkcs7(1)>
174
175 PKCS#7 Data Management.
176
177 =item L<B<pkey>|pkey(1)>
178
179 Public and private key management.
180
181 =item L<B<pkeyparam>|pkeyparam(1)>
182
183 Public key algorithm parameter management.
184
185 =item L<B<pkeyutl>|pkeyutl(1)>
186
187 Public key algorithm cryptographic operation utility.
188
189 =item L<B<rand>|rand(1)>
190
191 Generate pseudo-random bytes.
192
193 =item L<B<req>|req(1)>
194
195 PKCS#10 X.509 Certificate Signing Request (CSR) Management.
196
197 =item L<B<rsa>|rsa(1)>
198
199 RSA key management.
200
201
202 =item L<B<rsautl>|rsautl(1)>
203
204 RSA utility for signing, verification, encryption, and decryption. Superseded
205 by  L<B<pkeyutl>|pkeyutl(1)>
206
207 =item L<B<s_client>|s_client(1)>
208
209 This implements a generic SSL/TLS client which can establish a transparent
210 connection to a remote server speaking SSL/TLS. It's intended for testing
211 purposes only and provides only rudimentary interface functionality but
212 internally uses mostly all functionality of the OpenSSL B<ssl> library.
213
214 =item L<B<s_server>|s_server(1)>
215
216 This implements a generic SSL/TLS server which accepts connections from remote
217 clients speaking SSL/TLS. It's intended for testing purposes only and provides
218 only rudimentary interface functionality but internally uses mostly all
219 functionality of the OpenSSL B<ssl> library.  It provides both an own command
220 line oriented protocol for testing SSL functions and a simple HTTP response
221 facility to emulate an SSL/TLS-aware webserver.
222
223 =item L<B<s_time>|s_time(1)>
224
225 SSL Connection Timer.
226
227 =item L<B<sess_id>|sess_id(1)>
228
229 SSL Session Data Management.
230
231 =item L<B<smime>|smime(1)>
232
233 S/MIME mail processing.
234
235 =item L<B<speed>|speed(1)>
236
237 Algorithm Speed Measurement.
238
239 =item L<B<spkac>|spkac(1)>
240
241 SPKAC printing and generating utility
242
243 =item L<B<ts>|ts(1)>
244
245 Time Stamping Authority tool (client/server)
246
247 =item L<B<verify>|verify(1)>
248
249 X.509 Certificate Verification.
250
251 =item L<B<version>|version(1)>
252
253 OpenSSL Version Information.
254
255 =item L<B<x509>|x509(1)>
256
257 X.509 Certificate Data Management.
258
259 =back
260
261 =head2 Message Digest Commands
262
263 =over 10
264
265 =item B<md2>
266
267 MD2 Digest
268
269 =item B<md5>
270
271 MD5 Digest
272
273 =item B<mdc2>
274
275 MDC2 Digest
276
277 =item B<rmd160>
278
279 RMD-160 Digest
280
281 =item B<sha>
282
283 SHA Digest
284
285 =item B<sha1>
286
287 SHA-1 Digest
288
289 =item B<sha224>
290
291 SHA-224 Digest
292
293 =item B<sha256>
294
295 SHA-256 Digest
296
297 =item B<sha384>
298
299 SHA-384 Digest
300
301 =item B<sha512>
302
303 SHA-512 Digest
304
305 =back
306
307 =head2 Encoding and Cipher Commands
308
309 =over 10
310
311 =item B<base64>
312
313 Base64 Encoding
314
315 =item B<bf bf-cbc bf-cfb bf-ecb bf-ofb>
316
317 Blowfish Cipher
318
319 =item B<cast cast-cbc>
320
321 CAST Cipher
322
323 =item B<cast5-cbc cast5-cfb cast5-ecb cast5-ofb>
324
325 CAST5 Cipher
326
327 =item B<des des-cbc des-cfb des-ecb des-ede des-ede-cbc des-ede-cfb des-ede-ofb des-ofb>
328
329 DES Cipher
330
331 =item B<des3 desx des-ede3 des-ede3-cbc des-ede3-cfb des-ede3-ofb>
332
333 Triple-DES Cipher
334
335 =item B<idea idea-cbc idea-cfb idea-ecb idea-ofb>
336
337 IDEA Cipher
338
339 =item B<rc2 rc2-cbc rc2-cfb rc2-ecb rc2-ofb>
340
341 RC2 Cipher
342
343 =item B<rc4>
344
345 RC4 Cipher
346
347 =item B<rc5 rc5-cbc rc5-cfb rc5-ecb rc5-ofb>
348
349 RC5 Cipher
350
351 =back
352
353 =head1 PASS PHRASE ARGUMENTS
354
355 Several commands accept password arguments, typically using B<-passin>
356 and B<-passout> for input and output passwords respectively. These allow
357 the password to be obtained from a variety of sources. Both of these
358 options take a single argument whose format is described below. If no
359 password argument is given and a password is required then the user is
360 prompted to enter one: this will typically be read from the current
361 terminal with echoing turned off.
362
363 =over 10
364
365 =item B<pass:password>
366
367 the actual password is B<password>. Since the password is visible
368 to utilities (like 'ps' under Unix) this form should only be used
369 where security is not important.
370
371 =item B<env:var>
372
373 obtain the password from the environment variable B<var>. Since
374 the environment of other processes is visible on certain platforms
375 (e.g. ps under certain Unix OSes) this option should be used with caution.
376
377 =item B<file:pathname>
378
379 the first line of B<pathname> is the password. If the same B<pathname>
380 argument is supplied to B<-passin> and B<-passout> arguments then the first
381 line will be used for the input password and the next line for the output
382 password. B<pathname> need not refer to a regular file: it could for example
383 refer to a device or named pipe.
384
385 =item B<fd:number>
386
387 read the password from the file descriptor B<number>. This can be used to
388 send the data via a pipe for example.
389
390 =item B<stdin>
391
392 read the password from standard input.
393
394 =back
395
396 =head1 SEE ALSO
397
398 L<asn1parse(1)>, L<ca(1)>, L<config(5)>,
399 L<crl(1)>, L<crl2pkcs7(1)>, L<dgst(1)>,
400 L<dhparam(1)>, L<dsa(1)>, L<dsaparam(1)>,
401 L<enc(1)>, L<engine(1)>, L<gendsa(1)>, L<genpkey(1)>,
402 L<genrsa(1)>, L<nseq(1)>, L<openssl(1)>,
403 L<passwd(1)>,
404 L<pkcs12(1)>, L<pkcs7(1)>, L<pkcs8(1)>,
405 L<rand(1)>, L<req(1)>, L<rsa(1)>,
406 L<rsautl(1)>, L<s_client(1)>,
407 L<s_server(1)>, L<s_time(1)>,
408 L<smime(1)>, L<spkac(1)>,
409 L<verify(1)>, L<version(1)>, L<x509(1)>,
410 L<crypto(3)>, L<ssl(3)>, L<x509v3_config(5)>
411
412 =head1 HISTORY
413
414 The B<list->I<XXX>B<-algorithms> pseudo-commands were added in OpenSSL 1.0.0;
415 For notes on the availability of other commands, see their individual
416 manual pages.
417
418 =head1 COPYRIGHT
419
420 Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
421
422 Licensed under the OpenSSL license (the "License").  You may not use
423 this file except in compliance with the License.  You can obtain a copy
424 in the file LICENSE in the source distribution or at
425 L<https://www.openssl.org/source/license.html>.
426
427 =cut