3396f684f9f1cc6e9847b21bc25ab412365aedff
[openssl.git] / doc / man1 / openssl.pod
1 =pod
2
3 =head1 NAME
4
5 openssl - OpenSSL command line program
6
7 =head1 SYNOPSIS
8
9 B<openssl>
10 I<command>
11 [ I<options> ... ]
12 [ I<parameters> ... ]
13
14 B<openssl>
15 B<list>
16 B<-standard-commands> |
17 B<-digest-commands> |
18 B<-cipher-commands> |
19 B<-cipher-algorithms> |
20 B<-digest-algorithms> |
21 B<-mac-algorithms> |
22 B<-public-key-algorithms>
23
24 B<openssl> B<no->I<XXX> [ I<options> ]
25
26 =head1 DESCRIPTION
27
28 OpenSSL is a cryptography toolkit implementing the Secure Sockets Layer (SSL
29 v2/v3) and Transport Layer Security (TLS v1) network protocols and related
30 cryptography standards required by them.
31
32 The B<openssl> program is a command line program for using the various
33 cryptography functions of OpenSSL's B<crypto> library from the shell.
34 It can be used for
35
36  o  Creation and management of private keys, public keys and parameters
37  o  Public key cryptographic operations
38  o  Creation of X.509 certificates, CSRs and CRLs
39  o  Calculation of Message Digests and Message Authentication Codes
40  o  Encryption and Decryption with Ciphers
41  o  SSL/TLS Client and Server Tests
42  o  Handling of S/MIME signed or encrypted mail
43  o  Timestamp requests, generation and verification
44
45 =head1 COMMAND SUMMARY
46
47 The B<openssl> program provides a rich variety of commands (I<command> in
48 the L</SYNOPSIS> above).
49 Each command can have many options and argument parameters, shown above as
50 I<options> and I<parameters>.
51
52 Detailed documentation and use cases for most standard subcommands are available
53 (e.g., L<openssl-x509(1)>).
54
55 The list options 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.
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 Configuration Option
81
82 Many commands use an external configuration file for some or all of their
83 arguments and have a B<-config> option to specify that file.
84 The default name of the file is F<openssl.cnf> in the default certificate
85 storage area, which can be determined from the L<openssl-version(1)>
86 command using the B<-d> or B<-a> option.
87 The environment variable B<OPENSSL_CONF> can be used to specify a different
88 file location or to disable loading a configuration (using the empty string).
89
90 Among others, the configuration file can be used to load modules
91 and to specify parameters for generating certificates and random numbers.
92 See L<config(5)> for details.
93
94 =head2 Standard Commands
95
96 =over 4
97
98 =item B<asn1parse>
99
100 Parse an ASN.1 sequence.
101
102 =item B<ca>
103
104 Certificate Authority (CA) Management.
105
106 =item B<ciphers>
107
108 Cipher Suite Description Determination.
109
110 =item B<cms>
111
112 CMS (Cryptographic Message Syntax) command.
113
114 =item B<crl>
115
116 Certificate Revocation List (CRL) Management.
117
118 =item B<crl2pkcs7>
119
120 CRL to PKCS#7 Conversion.
121
122 =item B<dgst>
123
124 Message Digest calculation. MAC calculations are superseded by
125 L<openssl-mac(1)>.
126
127 =item B<dhparam>
128
129 Generation and Management of Diffie-Hellman Parameters. Superseded by
130 L<openssl-genpkey(1)> and L<openssl-pkeyparam(1)>.
131
132 =item B<dsa>
133
134 DSA Data Management.
135
136 =item B<dsaparam>
137
138 DSA Parameter Generation and Management. Superseded by
139 L<openssl-genpkey(1)> and L<openssl-pkeyparam(1)>.
140
141 =item B<ec>
142
143 EC (Elliptic curve) key processing.
144
145 =item B<ecparam>
146
147 EC parameter manipulation and generation.
148
149 =item B<enc>
150
151 Encryption, decryption, and encoding.
152
153 =item B<engine>
154
155 Engine (loadable module) information and manipulation.
156
157 =item B<errstr>
158
159 Error Number to Error String Conversion.
160
161 =item B<fipsinstall>
162
163 FIPS configuration installation.
164
165 =item B<gendsa>
166
167 Generation of DSA Private Key from Parameters. Superseded by
168 L<openssl-genpkey(1)> and L<openssl-pkey(1)>.
169
170 =item B<genpkey>
171
172 Generation of Private Key or Parameters.
173
174 =item B<genrsa>
175
176 Generation of RSA Private Key. Superseded by L<openssl-genpkey(1)>.
177
178 =item B<help>
179
180 Display information about a command's options.
181
182 =item B<info>
183
184 Display diverse information built into the OpenSSL libraries.
185
186 =item B<kdf>
187
188 Key Derivation Functions.
189
190 =item B<list>
191
192 List algorithms and features.
193
194 =item B<mac>
195
196 Message Authentication Code Calculation.
197
198 =item B<nseq>
199
200 Create or examine a Netscape certificate sequence.
201
202 =item B<ocsp>
203
204 Online Certificate Status Protocol command.
205
206 =item B<passwd>
207
208 Generation of hashed passwords.
209
210 =item B<pkcs12>
211
212 PKCS#12 Data Management.
213
214 =item B<pkcs7>
215
216 PKCS#7 Data Management.
217
218 =item B<pkcs8>
219
220 PKCS#8 format private key conversion command.
221
222 =item B<pkey>
223
224 Public and private key management.
225
226 =item B<pkeyparam>
227
228 Public key algorithm parameter management.
229
230 =item B<pkeyutl>
231
232 Public key algorithm cryptographic operation command.
233
234 =item B<prime>
235
236 Compute prime numbers.
237
238 =item B<rand>
239
240 Generate pseudo-random bytes.
241
242 =item B<rehash>
243
244 Create symbolic links to certificate and CRL files named by the hash values.
245
246 =item B<req>
247
248 PKCS#10 X.509 Certificate Signing Request (CSR) Management.
249
250 =item B<rsa>
251
252 RSA key management.
253
254 =item B<rsautl>
255
256 RSA command for signing, verification, encryption, and decryption. Superseded
257 by  L<openssl-pkeyutl(1)>.
258
259 =item B<s_client>
260
261 This implements a generic SSL/TLS client which can establish a transparent
262 connection to a remote server speaking SSL/TLS. It's intended for testing
263 purposes only and provides only rudimentary interface functionality but
264 internally uses mostly all functionality of the OpenSSL B<ssl> library.
265
266 =item B<s_server>
267
268 This implements a generic SSL/TLS server which accepts connections from remote
269 clients speaking SSL/TLS. It's intended for testing purposes only and provides
270 only rudimentary interface functionality but internally uses mostly all
271 functionality of the OpenSSL B<ssl> library.  It provides both an own command
272 line oriented protocol for testing SSL functions and a simple HTTP response
273 facility to emulate an SSL/TLS-aware webserver.
274
275 =item B<s_time>
276
277 SSL Connection Timer.
278
279 =item B<sess_id>
280
281 SSL Session Data Management.
282
283 =item B<smime>
284
285 S/MIME mail processing.
286
287 =item B<speed>
288
289 Algorithm Speed Measurement.
290
291 =item B<spkac>
292
293 SPKAC printing and generating command.
294
295 =item B<srp>
296
297 Maintain SRP password file.
298
299 =item B<storeutl>
300
301 Command to list and display certificates, keys, CRLs, etc.
302
303 =item B<ts>
304
305 Time Stamping Authority command.
306
307 =item B<verify>
308
309 X.509 Certificate Verification.
310 See also the L<openssl-verification-options(1)> manual page.
311
312 =item B<version>
313
314 OpenSSL Version Information.
315
316 =item B<x509>
317
318 X.509 Certificate Data Management.
319
320 =back
321
322 =head2 Message Digest Commands
323
324 =over 4
325
326 =item B<blake2b512>
327
328 BLAKE2b-512 Digest
329
330 =item B<blake2s256>
331
332 BLAKE2s-256 Digest
333
334 =item B<md2>
335
336 MD2 Digest
337
338 =item B<md4>
339
340 MD4 Digest
341
342 =item B<md5>
343
344 MD5 Digest
345
346 =item B<mdc2>
347
348 MDC2 Digest
349
350 =item B<rmd160>
351
352 RMD-160 Digest
353
354 =item B<sha1>
355
356 SHA-1 Digest
357
358 =item B<sha224>
359
360 SHA-2 224 Digest
361
362 =item B<sha256>
363
364 SHA-2 256 Digest
365
366 =item B<sha384>
367
368 SHA-2 384 Digest
369
370 =item B<sha512>
371
372 SHA-2 512 Digest
373
374 =item B<sha3-224>
375
376 SHA-3 224 Digest
377
378 =item B<sha3-256>
379
380 SHA-3 256 Digest
381
382 =item B<sha3-384>
383
384 SHA-3 384 Digest
385
386 =item B<sha3-512>
387
388 SHA-3 512 Digest
389
390 =item B<shake128>
391
392 SHA-3 SHAKE128 Digest
393
394 =item B<shake256>
395
396 SHA-3 SHAKE256 Digest
397
398 =item B<sm3>
399
400 SM3 Digest
401
402 =back
403
404 =head2 Encryption, Decryption, and Encoding Commands
405
406 The following aliases provide convenient access to the most used encodings
407 and ciphers.
408
409 Depending on how OpenSSL was configured and built, not all ciphers listed
410 here may be present. See L<openssl-enc(1)> for more information.
411
412 =over 4
413
414 =item B<aes128>, B<aes-128-cbc>, B<aes-128-cfb>, B<aes-128-ctr>, B<aes-128-ecb>, B<aes-128-ofb>
415
416 AES-128 Cipher
417
418 =item B<aes192>, B<aes-192-cbc>, B<aes-192-cfb>, B<aes-192-ctr>, B<aes-192-ecb>, B<aes-192-ofb>
419
420 AES-192 Cipher
421
422 =item B<aes256>, B<aes-256-cbc>, B<aes-256-cfb>, B<aes-256-ctr>, B<aes-256-ecb>, B<aes-256-ofb>
423
424 AES-256 Cipher
425
426 =item B<aria128>, B<aria-128-cbc>, B<aria-128-cfb>, B<aria-128-ctr>, B<aria-128-ecb>, B<aria-128-ofb>
427
428 Aria-128 Cipher
429
430 =item B<aria192>, B<aria-192-cbc>, B<aria-192-cfb>, B<aria-192-ctr>, B<aria-192-ecb>, B<aria-192-ofb>
431
432 Aria-192 Cipher
433
434 =item B<aria256>, B<aria-256-cbc>, B<aria-256-cfb>, B<aria-256-ctr>, B<aria-256-ecb>, B<aria-256-ofb>
435
436 Aria-256 Cipher
437
438 =item B<base64>
439
440 Base64 Encoding
441
442 =item B<bf>, B<bf-cbc>, B<bf-cfb>, B<bf-ecb>, B<bf-ofb>
443
444 Blowfish Cipher
445
446 =item B<camellia128>, B<camellia-128-cbc>, B<camellia-128-cfb>, B<camellia-128-ctr>, B<camellia-128-ecb>, B<camellia-128-ofb>
447
448 Camellia-128 Cipher
449
450 =item B<camellia192>, B<camellia-192-cbc>, B<camellia-192-cfb>, B<camellia-192-ctr>, B<camellia-192-ecb>, B<camellia-192-ofb>
451
452 Camellia-192 Cipher
453
454 =item B<camellia256>, B<camellia-256-cbc>, B<camellia-256-cfb>, B<camellia-256-ctr>, B<camellia-256-ecb>, B<camellia-256-ofb>
455
456 Camellia-256 Cipher
457
458 =item B<cast>, B<cast-cbc>
459
460 CAST Cipher
461
462 =item B<cast5-cbc>, B<cast5-cfb>, B<cast5-ecb>, B<cast5-ofb>
463
464 CAST5 Cipher
465
466 =item B<chacha20>
467
468 Chacha20 Cipher
469
470 =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>
471
472 DES Cipher
473
474 =item B<des3>, B<desx>, B<des-ede3>, B<des-ede3-cbc>, B<des-ede3-cfb>, B<des-ede3-ofb>
475
476 Triple-DES Cipher
477
478 =item B<idea>, B<idea-cbc>, B<idea-cfb>, B<idea-ecb>, B<idea-ofb>
479
480 IDEA Cipher
481
482 =item B<rc2>, B<rc2-cbc>, B<rc2-cfb>, B<rc2-ecb>, B<rc2-ofb>
483
484 RC2 Cipher
485
486 =item B<rc4>
487
488 RC4 Cipher
489
490 =item B<rc5>, B<rc5-cbc>, B<rc5-cfb>, B<rc5-ecb>, B<rc5-ofb>
491
492 RC5 Cipher
493
494 =item B<seed>, B<seed-cbc>, B<seed-cfb>, B<seed-ecb>, B<seed-ofb>
495
496 SEED Cipher
497
498 =item B<sm4>, B<sm4-cbc>, B<sm4-cfb>, B<sm4-ctr>, B<sm4-ecb>, B<sm4-ofb>
499
500 SM4 Cipher
501
502 =back
503
504 =head1 OPTIONS
505
506 Details of which options are available depend on the specific command.
507 This section describes some common options with common behavior.
508
509 =head2 Common Options
510
511 =over 4
512
513 =item B<-help>
514
515 Provides a terse summary of all options.
516 If an option takes an argument, the "type" of argument is also given.
517
518 =item B<-->
519
520 This terminates the list of options. It is mostly useful if any filename
521 parameters start with a minus sign:
522
523  openssl verify [flags...] -- -cert1.pem...
524
525 =back
526
527 =head2 Format Options
528
529 See L<openssl-format-options(1)> for manual page.
530
531 =head2 Pass Phrase Options
532
533 See the L<openssl-passphrase-options(1)> manual page.
534
535 =head2 Random State Options
536
537 Prior to OpenSSL 1.1.1, it was common for applications to store information
538 about the state of the random-number generator in a file that was loaded
539 at startup and rewritten upon exit. On modern operating systems, this is
540 generally no longer necessary as OpenSSL will seed itself from a trusted
541 entropy source provided by the operating system. These flags are still
542 supported for special platforms or circumstances that might require them.
543
544 It is generally an error to use the same seed file more than once and
545 every use of B<-rand> should be paired with B<-writerand>.
546
547 =over 4
548
549 =item B<-rand> I<files>
550
551 A file or files containing random data used to seed the random number
552 generator.
553 Multiple files can be specified separated by an OS-dependent character.
554 The separator is C<;> for MS-Windows, C<,> for OpenVMS, and C<:> for
555 all others. Another way to specify multiple files is to repeat this flag
556 with different filenames.
557
558 =item B<-writerand> I<file>
559
560 Writes the seed data to the specified I<file> upon exit.
561 This file can be used in a subsequent command invocation.
562
563 =back
564
565 =head2 Certificate Verification Options
566
567 See the L<openssl-verification-options(1)> manual page.
568
569 =head2 Name Format Options
570
571 See the L<openssl-namedisplay-options(1)> manual page.
572
573 =head2 TLS Version Options
574
575 Several commands use SSL, TLS, or DTLS. By default, the commands use TLS and
576 clients will offer the lowest and highest protocol version they support,
577 and servers will pick the highest version that the client offers that is also
578 supported by the server.
579
580 The options below can be used to limit which protocol versions are used,
581 and whether TCP (SSL and TLS) or UDP (DTLS) is used.
582 Note that not all protocols and flags may be available, depending on how
583 OpenSSL was built.
584
585 =over 4
586
587 =item B<-ssl3>, B<-tls1>, B<-tls1_1>, B<-tls1_2>, B<-tls1_3>, B<-no_ssl3>, B<-no_tls1>, B<-no_tls1_1>, B<-no_tls1_2>, B<-no_tls1_3>
588
589 These options require or disable the use of the specified SSL or TLS protocols.
590 When a specific TLS version is required, only that version will be offered or
591 accepted.
592 Only one specific protocol can be given and it cannot be combined with any of
593 the B<no_> options.
594
595 =item B<-dtls>, B<-dtls1>, B<-dtls1_2>
596
597 These options specify to use DTLS instead of DLTS.
598 With B<-dtls>, clients will negotiate any supported DTLS protocol version.
599 Use the B<-dtls1> or B<-dtls1_2> options to support only DTLS1.0 or DTLS1.2,
600 respectively.
601
602 =back
603
604 =head2 Engine Options
605
606 =over 4
607
608 =item B<-engine> I<id>
609
610 Load the engine identified by I<id> and use all the methods it implements
611 (algorithms, key storage, etc.), unless specified otherwise in the
612 command-specific documentation or it is configured to do so, as described in
613 L<config(5)/Engine Configuration>.
614
615 The engine will be used for key ids specified with B<-key> and similar
616 options when an option like B<-keyform engine> is given.
617
618 =back
619
620 Options specifying keys, like B<-key> and similar, can use the generic
621 OpenSSL engine key loading URI scheme C<org.openssl.engine:> to retrieve
622 private keys and public keys.  The URI syntax is as follows, in simplified
623 form:
624
625     org.openssl.engine:{engineid}:{keyid}
626
627 Where C<{engineid}> is the identity/name of the engine, and C<{keyid}> is a
628 key identifier that's acceptable by that engine.  For example, when using an
629 engine that interfaces against a PKCS#11 implementation, the generic key URI
630 would be something like this (this happens to be an example for the PKCS#11
631 engine that's part of OpenSC):
632
633     -key org.openssl.engine:pkcs11:label_some-private-key
634
635 As a third possibility, for engines and providers that have implemented
636 their own L<OSSL_STORE_LOADER(3)>, C<org.openssl.engine:> should not be
637 necessary.  For a PKCS#11 implementation that has implemented such a loader,
638 the PKCS#11 URI as defined in RFC 7512 should be possible to use directly:
639
640     -key pkcs11:object=some-private-key;pin-value=1234
641
642 =head1 ENVIRONMENT
643
644 The OpenSSL library can be take some configuration parameters from the
645 environment.  Some of these variables are listed below.  For information
646 about specific commands, see L<openssl-engine(1)>,
647 L<openssl-rehash(1)>, and L<tsget(1)>.
648
649 For information about the use of environment variables in configuration,
650 see L<config(5)/ENVIRONMENT>.
651
652 For information about querying or specifying CPU architecture flags, see
653 L<OPENSSL_ia32cap(3)>, and L<OPENSSL_s390xcap(3)>.
654
655 For information about all environment variables used by the OpenSSL libraries,
656 see L<openssl-env(7)>.
657
658 =over 4
659
660 =item B<OPENSSL_TRACE=>I<name>[,...]
661
662 Enable tracing output of OpenSSL library, by name.
663 This output will only make sense if you know OpenSSL internals well.
664 Also, it might not give you any output at all, depending on how
665 OpenSSL was built.
666
667 The value is a comma separated list of names, with the following
668 available:
669
670 =over 4
671
672 =item B<TRACE>
673
674 The tracing functionality.
675
676 =item B<TLS>
677
678 General SSL/TLS.
679
680 =item B<TLS_CIPHER>
681
682 SSL/TLS cipher.
683
684 =item B<CONF>
685
686 Show details about provider and engine configuration.
687
688 =item B<ENGINE_TABLE>
689
690 The function that is used by RSA, DSA (etc) code to select registered
691 ENGINEs, cache defaults and functional references (etc), will generate
692 debugging summaries.
693
694 =item B<ENGINE_REF_COUNT>
695
696 Reference counts in the ENGINE structure will be monitored with a line
697 of generated for each change.
698
699 =item B<PKCS5V2>
700
701 PKCS#5 v2 keygen.
702
703 =item B<PKCS12_KEYGEN>
704
705 PKCS#12 key generation.
706
707 =item B<PKCS12_DECRYPT>
708
709 PKCS#12 decryption.
710
711 =item B<X509V3_POLICY>
712
713 Generates the complete policy tree at various point during X.509 v3
714 policy evaluation.
715
716 =item B<BN_CTX>
717
718 BIGNUM context.
719
720 =back
721
722 =back
723
724 =head1 SEE ALSO
725
726 L<openssl-asn1parse(1)>,
727 L<openssl-ca(1)>,
728 L<openssl-ciphers(1)>,
729 L<openssl-cms(1)>,
730 L<openssl-crl(1)>,
731 L<openssl-crl2pkcs7(1)>,
732 L<openssl-dgst(1)>,
733 L<openssl-dhparam(1)>,
734 L<openssl-dsa(1)>,
735 L<openssl-dsaparam(1)>,
736 L<openssl-ec(1)>,
737 L<openssl-ecparam(1)>,
738 L<openssl-enc(1)>,
739 L<openssl-engine(1)>,
740 L<openssl-errstr(1)>,
741 L<openssl-gendsa(1)>,
742 L<openssl-genpkey(1)>,
743 L<openssl-genrsa(1)>,
744 L<openssl-kdf(1)>,
745 L<openssl-mac(1)>,
746 L<openssl-nseq(1)>,
747 L<openssl-ocsp(1)>,
748 L<openssl-passwd(1)>,
749 L<openssl-pkcs12(1)>,
750 L<openssl-pkcs7(1)>,
751 L<openssl-pkcs8(1)>,
752 L<openssl-pkey(1)>,
753 L<openssl-pkeyparam(1)>,
754 L<openssl-pkeyutl(1)>,
755 L<openssl-prime(1)>,
756 L<openssl-rand(1)>,
757 L<openssl-rehash(1)>,
758 L<openssl-req(1)>,
759 L<openssl-rsa(1)>,
760 L<openssl-rsautl(1)>,
761 L<openssl-s_client(1)>,
762 L<openssl-s_server(1)>,
763 L<openssl-s_time(1)>,
764 L<openssl-sess_id(1)>,
765 L<openssl-smime(1)>,
766 L<openssl-speed(1)>,
767 L<openssl-spkac(1)>,
768 L<openssl-srp(1)>,
769 L<openssl-storeutl(1)>,
770 L<openssl-ts(1)>,
771 L<openssl-verify(1)>,
772 L<openssl-version(1)>,
773 L<openssl-x509(1)>,
774 L<config(5)>,
775 L<crypto(7)>,
776 L<openssl-env(7)>.
777 L<ssl(7)>,
778 L<x509v3_config(5)>
779
780
781 =head1 HISTORY
782
783 The B<list> -I<XXX>B<-algorithms> options were added in OpenSSL 1.0.0;
784 For notes on the availability of other commands, see their individual
785 manual pages.
786
787 The B<-issuer_checks> option is deprecated as of OpenSSL 1.1.0 and
788 is silently ignored.
789
790 The B<-xcertform> and B<-xkeyform> options
791 are obsolete since OpenSSL 3.0 and have no effect.
792
793 The interactive mode, which could be invoked by running C<openssl>
794 with no further arguments, was removed in OpenSSL 3.0, and running
795 that program with no arguments is now equivalent to C<openssl help>.
796
797 =head1 COPYRIGHT
798
799 Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.
800
801 Licensed under the Apache License 2.0 (the "License").  You may not use
802 this file except in compliance with the License.  You can obtain a copy
803 in the file LICENSE in the source distribution or at
804 L<https://www.openssl.org/source/license.html>.
805
806 =cut