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