dade253e71d1bbb1e9d545d8fe61178e77689d38
[openssl.git] / doc / man1 / 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<mac-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 and Message Authentication Codes
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  Timestamp 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 Detailed documentation and use cases for most standard subcommands are available
44 (e.g., L<x509(1)> or L<openssl-x509(1)>).
45
46 Many commands use an external configuration file for some or all of their
47 arguments and have a B<-config> option to specify that file.
48 The environment variable B<OPENSSL_CONF> can be used to specify
49 the location of the file.
50 If the environment variable is not specified, then the file is named
51 B<openssl.cnf> in the default certificate storage area, whose value
52 depends on the configuration flags specified when the OpenSSL
53 was built.
54
55 The list parameters B<standard-commands>, B<digest-commands>,
56 and B<cipher-commands> output a list (one entry per line) of the names
57 of all standard commands, message digest commands, or cipher commands,
58 respectively, that are available in the present B<openssl> utility.
59
60 The list parameters B<cipher-algorithms>, B<digest-algorithms>,
61 and B<mac-algorithms> list all cipher, message digest, and message
62 authentication code names, one entry per line. Aliases are listed as:
63
64  from => to
65
66 The list parameter B<public-key-algorithms> lists all supported public
67 key algorithms.
68
69 The command B<no->I<XXX> tests whether a command of the
70 specified name is available.  If no command named I<XXX> exists, it
71 returns 0 (success) and prints B<no->I<XXX>; otherwise it returns 1
72 and prints I<XXX>.  In both cases, the output goes to B<stdout> and
73 nothing is printed to B<stderr>.  Additional command line arguments
74 are always ignored.  Since for each cipher there is a command of the
75 same name, this provides an easy way for shell scripts to test for the
76 availability of ciphers in the B<openssl> program.  (B<no->I<XXX> is
77 not able to detect pseudo-commands such as B<quit>,
78 B<list>, or B<no->I<XXX> itself.)
79
80 =head2 Standard Commands
81
82 =over 4
83
84 =item B<asn1parse>
85
86 Parse an ASN.1 sequence.
87
88 =item B<ca>
89
90 Certificate Authority (CA) Management.
91
92 =item B<ciphers>
93
94 Cipher Suite Description Determination.
95
96 =item B<cms>
97
98 CMS (Cryptographic Message Syntax) utility.
99
100 =item B<crl>
101
102 Certificate Revocation List (CRL) Management.
103
104 =item B<crl2pkcs7>
105
106 CRL to PKCS#7 Conversion.
107
108 =item B<dgst>
109
110 Message Digest calculation. MAC calculations are superseded by
111 L<mac(1)>.
112
113 =item B<dh>
114
115 Diffie-Hellman Parameter Management.
116 Obsoleted by L<dhparam(1)>.
117
118 =item B<dhparam>
119
120 Generation and Management of Diffie-Hellman Parameters. Superseded by
121 L<genpkey(1)> and L<pkeyparam(1)>.
122
123 =item B<dsa>
124
125 DSA Data Management.
126
127 =item B<dsaparam>
128
129 DSA Parameter Generation and Management. Superseded by
130 L<genpkey(1)> and L<pkeyparam(1)>.
131
132 =item B<ec>
133
134 EC (Elliptic curve) key processing.
135
136 =item B<ecparam>
137
138 EC parameter manipulation and generation.
139
140 =item B<enc>
141
142 Encoding with Ciphers.
143
144 =item B<engine>
145
146 Engine (loadable module) information and manipulation.
147
148 =item B<errstr>
149
150 Error Number to Error String Conversion.
151
152 =item B<gendh>
153
154 Generation of Diffie-Hellman Parameters.
155 Obsoleted by L<dhparam(1)>.
156
157 =item B<gendsa>
158
159 Generation of DSA Private Key from Parameters. Superseded by
160 L<genpkey(1)> and L<pkey(1)>.
161
162 =item B<genpkey>
163
164 Generation of Private Key or Parameters.
165
166 =item B<genrsa>
167
168 Generation of RSA Private Key. Superseded by L<genpkey(1)>.
169
170 =item B<info>
171
172 Display diverse information built into the OpenSSL libraries.
173
174 =item B<kdf>
175
176 Key Derivation Functions.
177
178 =item B<mac>
179
180 Message Authentication Code Calculation.
181
182 =item B<nseq>
183
184 Create or examine a Netscape certificate sequence.
185
186 =item B<ocsp>
187
188 Online Certificate Status Protocol utility.
189
190 =item B<passwd>
191
192 Generation of hashed passwords.
193
194 =item B<pkcs12>
195
196 PKCS#12 Data Management.
197
198 =item B<pkcs7>
199
200 PKCS#7 Data Management.
201
202 =item B<pkcs8>
203
204 PKCS#8 format private key conversion tool.
205
206 =item B<pkey>
207
208 Public and private key management.
209
210 =item B<pkeyparam>
211
212 Public key algorithm parameter management.
213
214 =item B<pkeyutl>
215
216 Public key algorithm cryptographic operation utility.
217
218 =item B<prime>
219
220 Compute prime numbers.
221
222 =item B<rand>
223
224 Generate pseudo-random bytes.
225
226 =item B<rehash>
227
228 Create symbolic links to certificate and CRL files named by the hash values.
229
230 =item B<req>
231
232 PKCS#10 X.509 Certificate Signing Request (CSR) Management.
233
234 =item B<rsa>
235
236 RSA key management.
237
238 =item B<rsautl>
239
240 RSA utility for signing, verification, encryption, and decryption. Superseded
241 by  L<pkeyutl(1)>.
242
243 =item B<s_client>
244
245 This implements a generic SSL/TLS client which can establish a transparent
246 connection to a remote server speaking SSL/TLS. It's intended for testing
247 purposes only and provides only rudimentary interface functionality but
248 internally uses mostly all functionality of the OpenSSL B<ssl> library.
249
250 =item B<s_server>
251
252 This implements a generic SSL/TLS server which accepts connections from remote
253 clients speaking SSL/TLS. It's intended for testing purposes only and provides
254 only rudimentary interface functionality but internally uses mostly all
255 functionality of the OpenSSL B<ssl> library.  It provides both an own command
256 line oriented protocol for testing SSL functions and a simple HTTP response
257 facility to emulate an SSL/TLS-aware webserver.
258
259 =item B<s_time>
260
261 SSL Connection Timer.
262
263 =item B<sess_id>
264
265 SSL Session Data Management.
266
267 =item B<smime>
268
269 S/MIME mail processing.
270
271 =item B<speed>
272
273 Algorithm Speed Measurement.
274
275 =item B<spkac>
276
277 SPKAC printing and generating utility.
278
279 =item B<srp>
280
281 Maintain SRP password file.
282
283 =item B<storeutl>
284
285 Utility to list and display certificates, keys, CRLs, etc.
286
287 =item B<ts>
288
289 Time Stamping Authority tool (client/server).
290
291 =item B<verify>
292
293 X.509 Certificate Verification.
294
295 =item B<version>
296
297 OpenSSL Version Information.
298
299 =item B<x509>
300
301 X.509 Certificate Data Management.
302
303 =back
304
305 =head2 Message Digest Commands
306
307 =over 4
308
309 =item B<blake2b512>
310
311 BLAKE2b-512 Digest
312
313 =item B<blake2s256>
314
315 BLAKE2s-256 Digest
316
317 =item B<md2>
318
319 MD2 Digest
320
321 =item B<md4>
322
323 MD4 Digest
324
325 =item B<md5>
326
327 MD5 Digest
328
329 =item B<mdc2>
330
331 MDC2 Digest
332
333 =item B<rmd160>
334
335 RMD-160 Digest
336
337 =item B<sha1>
338
339 SHA-1 Digest
340
341 =item B<sha224>
342
343 SHA-2 224 Digest
344
345 =item B<sha256>
346
347 SHA-2 256 Digest
348
349 =item B<sha384>
350
351 SHA-2 384 Digest
352
353 =item B<sha512>
354
355 SHA-2 512 Digest
356
357 =item B<sha3-224>
358
359 SHA-3 224 Digest
360
361 =item B<sha3-256>
362
363 SHA-3 256 Digest
364
365 =item B<sha3-384>
366
367 SHA-3 384 Digest
368
369 =item B<sha3-512>
370
371 SHA-3 512 Digest
372
373 =item B<shake128>
374
375 SHA-3 SHAKE128 Digest
376
377 =item B<shake256>
378
379 SHA-3 SHAKE256 Digest
380
381 =item B<sm3>
382
383 SM3 Digest
384
385 =back
386
387 =head2 Encoding and Cipher Commands
388
389 The following aliases provide convenient access to the most used encodings
390 and ciphers.
391
392 Depending on how OpenSSL was configured and built, not all ciphers listed
393 here may be present. See L<enc(1)> for more information and command usage.
394
395 =over 4
396
397 =item B<aes128>, B<aes-128-cbc>, B<aes-128-cfb>, B<aes-128-ctr>, B<aes-128-ecb>, B<aes-128-ofb>
398
399 AES-128 Cipher
400
401 =item B<aes192>, B<aes-192-cbc>, B<aes-192-cfb>, B<aes-192-ctr>, B<aes-192-ecb>, B<aes-192-ofb>
402
403 AES-192 Cipher
404
405 =item B<aes256>, B<aes-256-cbc>, B<aes-256-cfb>, B<aes-256-ctr>, B<aes-256-ecb>, B<aes-256-ofb>
406
407 AES-256 Cipher
408
409 =item B<aria128>, B<aria-128-cbc>, B<aria-128-cfb>, B<aria-128-ctr>, B<aria-128-ecb>, B<aria-128-ofb>
410
411 Aria-128 Cipher
412
413 =item B<aria192>, B<aria-192-cbc>, B<aria-192-cfb>, B<aria-192-ctr>, B<aria-192-ecb>, B<aria-192-ofb>
414
415 Aria-192 Cipher
416
417 =item B<aria256>, B<aria-256-cbc>, B<aria-256-cfb>, B<aria-256-ctr>, B<aria-256-ecb>, B<aria-256-ofb>
418
419 Aria-256 Cipher
420
421 =item B<base64>
422
423 Base64 Encoding
424
425 =item B<bf>, B<bf-cbc>, B<bf-cfb>, B<bf-ecb>, B<bf-ofb>
426
427 Blowfish Cipher
428
429 =item B<camellia128>, B<camellia-128-cbc>, B<camellia-128-cfb>, B<camellia-128-ctr>, B<camellia-128-ecb>, B<camellia-128-ofb>
430
431 Camellia-128 Cipher
432
433 =item B<camellia192>, B<camellia-192-cbc>, B<camellia-192-cfb>, B<camellia-192-ctr>, B<camellia-192-ecb>, B<camellia-192-ofb>
434
435 Camellia-192 Cipher
436
437 =item B<camellia256>, B<camellia-256-cbc>, B<camellia-256-cfb>, B<camellia-256-ctr>, B<camellia-256-ecb>, B<camellia-256-ofb>
438
439 Camellia-256 Cipher
440
441 =item B<cast>, B<cast-cbc>
442
443 CAST Cipher
444
445 =item B<cast5-cbc>, B<cast5-cfb>, B<cast5-ecb>, B<cast5-ofb>
446
447 CAST5 Cipher
448
449 =item B<chacha20>
450
451 Chacha20 Cipher
452
453 =item B<des>, B<des-cbc>, B<des-cfb>, B<des-ecb>, B<des-ede>, B<des-ede-cbc>, B<des-ede-cfb>, B<des-ede-ofb>, B<des-ofb>
454
455 DES Cipher
456
457 =item B<des3>, B<desx>, B<des-ede3>, B<des-ede3-cbc>, B<des-ede3-cfb>, B<des-ede3-ofb>
458
459 Triple-DES Cipher
460
461 =item B<idea>, B<idea-cbc>, B<idea-cfb>, B<idea-ecb>, B<idea-ofb>
462
463 IDEA Cipher
464
465 =item B<rc2>, B<rc2-cbc>, B<rc2-cfb>, B<rc2-ecb>, B<rc2-ofb>
466
467 RC2 Cipher
468
469 =item B<rc4>
470
471 RC4 Cipher
472
473 =item B<rc5>, B<rc5-cbc>, B<rc5-cfb>, B<rc5-ecb>, B<rc5-ofb>
474
475 RC5 Cipher
476
477 =item B<seed>, B<seed-cbc>, B<seed-cfb>, B<seed-ecb>, B<seed-ofb>
478
479 SEED Cipher
480
481 =item B<sm4>, B<sm4-cbc>, B<sm4-cfb>, B<sm4-ctr>, B<sm4-ecb>, B<sm4-ofb>
482
483 SM4 Cipher
484
485 =back
486
487 =head1 OPTIONS
488
489 Details of which options are available depend on the specific command.
490 This section describes some common options with common behavior.
491
492 =head2 Common Options
493
494 =over 4
495
496 =item B<-help>
497
498 Provides a terse summary of all options.
499
500 =back
501
502 =head2 Pass Phrase Options
503
504 Several commands accept password arguments, typically using B<-passin>
505 and B<-passout> for input and output passwords respectively. These allow
506 the password to be obtained from a variety of sources. Both of these
507 options take a single argument whose format is described below. If no
508 password argument is given and a password is required then the user is
509 prompted to enter one: this will typically be read from the current
510 terminal with echoing turned off.
511
512 Note that character encoding may be relevant, please see
513 L<passphrase-encoding(7)>.
514
515 =over 4
516
517 =item B<pass:password>
518
519 The actual password is B<password>. Since the password is visible
520 to utilities (like 'ps' under Unix) this form should only be used
521 where security is not important.
522
523 =item B<env:var>
524
525 Obtain the password from the environment variable B<var>. Since
526 the environment of other processes is visible on certain platforms
527 (e.g. ps under certain Unix OSes) this option should be used with caution.
528
529 =item B<file:pathname>
530
531 The first line of B<pathname> is the password. If the same B<pathname>
532 argument is supplied to B<-passin> and B<-passout> arguments then the first
533 line will be used for the input password and the next line for the output
534 password. B<pathname> need not refer to a regular file: it could for example
535 refer to a device or named pipe.
536
537 =item B<fd:number>
538
539 Read the password from the file descriptor B<number>. This can be used to
540 send the data via a pipe for example.
541
542 =item B<stdin>
543
544 Read the password from standard input.
545
546 =back
547
548 =head1 ENVIRONMENT
549
550 =over 4
551
552 =item B<OPENSSL_TRACE=>I<name,...>
553
554 Enable tracing output of OpenSSL library, by name.
555 This output will only make sense if you know OpenSSL internals well.
556 Also, it might not give you any output at all, depending on how
557 OpenSSL was built.
558
559 The value is a comma separated list of names, with the following
560 available:
561
562 =over 4
563
564 =item B<TRACE>
565
566 The tracing functionality.
567
568 =item B<TLS>
569
570 General SSL/TLS.
571
572 =item B<TLS_CIPHER>
573
574 SSL/TLS cipher.
575
576 =item B<ENGINE_CONF>
577
578 ENGINE configuration.
579
580 =item B<ENGINE_TABLE>
581
582 The function that is used by RSA, DSA (etc) code to select registered
583 ENGINEs, cache defaults and functional references (etc), will generate
584 debugging summaries.
585
586 =item B<ENGINE_REF_COUNT>
587
588 Reference counts in the ENGINE structure will be monitored with a line
589 of generated for each change.
590
591 =item B<PKCS5V2>
592
593 PKCS#5 v2 keygen.
594
595 =item B<PKCS12_KEYGEN>
596
597 PKCS#12 key generation.
598
599 =item B<PKCS12_DECRYPT>
600
601 PKCS#12 decryption.
602
603 =item B<X509V3_POLICY>
604
605 Generates the complete policy tree at various point during X.509 v3
606 policy evaluation.
607
608 =item B<BN_CTX>
609
610 BIGNUM context.
611
612 =back
613
614 =back
615
616 =head1 SEE ALSO
617
618 L<openssl-asn1parse(1)>,
619 L<openssl-ca(1)>,
620 L<openssl-ciphers(1)>,
621 L<openssl-cms(1)>,
622 L<openssl-crl(1)>,
623 L<openssl-crl2pkcs7(1)>,
624 L<openssl-dgst(1)>,
625 L<openssl-dhparam(1)>,
626 L<openssl-dsa(1)>,
627 L<openssl-dsaparam(1)>,
628 L<openssl-ec(1)>,
629 L<openssl-ecparam(1)>,
630 L<openssl-enc(1)>,
631 L<openssl-engine(1)>,
632 L<openssl-errstr(1)>,
633 L<openssl-gendsa(1)>,
634 L<openssl-genpkey(1)>,
635 L<openssl-genrsa(1)>,
636 L<openssl-kdf(1)>,
637 L<openssl-mac(1)>,
638 L<openssl-nseq(1)>,
639 L<openssl-ocsp(1)>,
640 L<openssl-passwd(1)>,
641 L<openssl-pkcs12(1)>,
642 L<openssl-pkcs7(1)>,
643 L<openssl-pkcs8(1)>,
644 L<openssl-pkey(1)>,
645 L<openssl-pkeyparam(1)>,
646 L<openssl-pkeyutl(1)>,
647 L<openssl-prime(1)>,
648 L<openssl-rand(1)>,
649 L<openssl-rehash(1)>,
650 L<openssl-req(1)>,
651 L<openssl-rsa(1)>,
652 L<openssl-rsautl(1)>,
653 L<openssl-s_client(1)>,
654 L<openssl-s_server(1)>,
655 L<openssl-s_time(1)>,
656 L<openssl-sess_id(1)>,
657 L<openssl-smime(1)>,
658 L<openssl-speed(1)>,
659 L<openssl-spkac(1)>,
660 L<openssl-srp(1)>,
661 L<openssl-storeutl(1)>,
662 L<openssl-ts(1)>,
663 L<openssl-verify(1)>,
664 L<openssl-version(1)>,
665 L<openssl-x509(1)>,
666 L<config(5)>,
667 L<crypto(7)>,
668 L<ssl(7)>,
669 L<x509v3_config(5)>
670
671
672 =head1 HISTORY
673
674 The B<list->I<XXX>B<-algorithms> pseudo-commands were added in OpenSSL 1.0.0;
675 For notes on the availability of other commands, see their individual
676 manual pages.
677
678 =head1 COPYRIGHT
679
680 Copyright 2000-2019 The OpenSSL Project Authors. All Rights Reserved.
681
682 Licensed under the Apache License 2.0 (the "License").  You may not use
683 this file except in compliance with the License.  You can obtain a copy
684 in the file LICENSE in the source distribution or at
685 L<https://www.openssl.org/source/license.html>.
686
687 =cut