xref: /freebsd/crypto/openssl/doc/man1/openssl.pod (revision e0c4386e)
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
19v2/v3) and Transport Layer Security (TLS v1) 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<shake128>
368
369SHA-3 SHAKE128 Digest
370
371=item B<shake256>
372
373SHA-3 SHAKE256 Digest
374
375=item B<sm3>
376
377SM3 Digest
378
379=back
380
381=head2 Encryption, Decryption, and Encoding Commands
382
383The following aliases provide convenient access to the most used encodings
384and ciphers.
385
386Depending on how OpenSSL was configured and built, not all ciphers listed
387here may be present. See L<openssl-enc(1)> for more information.
388
389=over 4
390
391=item B<aes128>, B<aes-128-cbc>, B<aes-128-cfb>, B<aes-128-ctr>, B<aes-128-ecb>, B<aes-128-ofb>
392
393AES-128 Cipher
394
395=item B<aes192>, B<aes-192-cbc>, B<aes-192-cfb>, B<aes-192-ctr>, B<aes-192-ecb>, B<aes-192-ofb>
396
397AES-192 Cipher
398
399=item B<aes256>, B<aes-256-cbc>, B<aes-256-cfb>, B<aes-256-ctr>, B<aes-256-ecb>, B<aes-256-ofb>
400
401AES-256 Cipher
402
403=item B<aria128>, B<aria-128-cbc>, B<aria-128-cfb>, B<aria-128-ctr>, B<aria-128-ecb>, B<aria-128-ofb>
404
405Aria-128 Cipher
406
407=item B<aria192>, B<aria-192-cbc>, B<aria-192-cfb>, B<aria-192-ctr>, B<aria-192-ecb>, B<aria-192-ofb>
408
409Aria-192 Cipher
410
411=item B<aria256>, B<aria-256-cbc>, B<aria-256-cfb>, B<aria-256-ctr>, B<aria-256-ecb>, B<aria-256-ofb>
412
413Aria-256 Cipher
414
415=item B<base64>
416
417Base64 Encoding
418
419=item B<bf>, B<bf-cbc>, B<bf-cfb>, B<bf-ecb>, B<bf-ofb>
420
421Blowfish Cipher
422
423=item B<camellia128>, B<camellia-128-cbc>, B<camellia-128-cfb>, B<camellia-128-ctr>, B<camellia-128-ecb>, B<camellia-128-ofb>
424
425Camellia-128 Cipher
426
427=item B<camellia192>, B<camellia-192-cbc>, B<camellia-192-cfb>, B<camellia-192-ctr>, B<camellia-192-ecb>, B<camellia-192-ofb>
428
429Camellia-192 Cipher
430
431=item B<camellia256>, B<camellia-256-cbc>, B<camellia-256-cfb>, B<camellia-256-ctr>, B<camellia-256-ecb>, B<camellia-256-ofb>
432
433Camellia-256 Cipher
434
435=item B<cast>, B<cast-cbc>
436
437CAST Cipher
438
439=item B<cast5-cbc>, B<cast5-cfb>, B<cast5-ecb>, B<cast5-ofb>
440
441CAST5 Cipher
442
443=item B<chacha20>
444
445Chacha20 Cipher
446
447=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>
448
449DES Cipher
450
451=item B<des3>, B<desx>, B<des-ede3>, B<des-ede3-cbc>, B<des-ede3-cfb>, B<des-ede3-ofb>
452
453Triple-DES Cipher
454
455=item B<idea>, B<idea-cbc>, B<idea-cfb>, B<idea-ecb>, B<idea-ofb>
456
457IDEA Cipher
458
459=item B<rc2>, B<rc2-cbc>, B<rc2-cfb>, B<rc2-ecb>, B<rc2-ofb>
460
461RC2 Cipher
462
463=item B<rc4>
464
465RC4 Cipher
466
467=item B<rc5>, B<rc5-cbc>, B<rc5-cfb>, B<rc5-ecb>, B<rc5-ofb>
468
469RC5 Cipher
470
471=item B<seed>, B<seed-cbc>, B<seed-cfb>, B<seed-ecb>, B<seed-ofb>
472
473SEED Cipher
474
475=item B<sm4>, B<sm4-cbc>, B<sm4-cfb>, B<sm4-ctr>, B<sm4-ecb>, B<sm4-ofb>
476
477SM4 Cipher
478
479=back
480
481=head1 OPTIONS
482
483Details of which options are available depend on the specific command.
484This section describes some common options with common behavior.
485
486=head2 Common Options
487
488=over 4
489
490=item B<-help>
491
492Provides a terse summary of all options.
493If an option takes an argument, the "type" of argument is also given.
494
495=item B<-->
496
497This terminates the list of options. It is mostly useful if any filename
498parameters start with a minus sign:
499
500 openssl verify [flags...] -- -cert1.pem...
501
502=back
503
504=head2 Format Options
505
506See L<openssl-format-options(1)> for manual page.
507
508=head2 Pass Phrase Options
509
510See the L<openssl-passphrase-options(1)> manual page.
511
512=head2 Random State Options
513
514Prior to OpenSSL 1.1.1, it was common for applications to store information
515about the state of the random-number generator in a file that was loaded
516at startup and rewritten upon exit. On modern operating systems, this is
517generally no longer necessary as OpenSSL will seed itself from a trusted
518entropy source provided by the operating system. These flags are still
519supported for special platforms or circumstances that might require them.
520
521It is generally an error to use the same seed file more than once and
522every use of B<-rand> should be paired with B<-writerand>.
523
524=over 4
525
526=item B<-rand> I<files>
527
528A file or files containing random data used to seed the random number
529generator.
530Multiple files can be specified separated by an OS-dependent character.
531The separator is C<;> for MS-Windows, C<,> for OpenVMS, and C<:> for
532all others. Another way to specify multiple files is to repeat this flag
533with different filenames.
534
535=item B<-writerand> I<file>
536
537Writes the seed data to the specified I<file> upon exit.
538This file can be used in a subsequent command invocation.
539
540=back
541
542=head2 Certificate Verification Options
543
544See the L<openssl-verification-options(1)> manual page.
545
546=head2 Name Format Options
547
548See the L<openssl-namedisplay-options(1)> manual page.
549
550=head2 TLS Version Options
551
552Several commands use SSL, TLS, or DTLS. By default, the commands use TLS and
553clients will offer the lowest and highest protocol version they support,
554and servers will pick the highest version that the client offers that is also
555supported by the server.
556
557The options below can be used to limit which protocol versions are used,
558and whether TCP (SSL and TLS) or UDP (DTLS) is used.
559Note that not all protocols and flags may be available, depending on how
560OpenSSL was built.
561
562=over 4
563
564=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>
565
566These options require or disable the use of the specified SSL or TLS protocols.
567When a specific TLS version is required, only that version will be offered or
568accepted.
569Only one specific protocol can be given and it cannot be combined with any of
570the B<no_> options.
571The B<no_*> options do not work with B<s_time> and B<ciphers> commands but work with
572B<s_client> and B<s_server> commands.
573
574=item B<-dtls>, B<-dtls1>, B<-dtls1_2>
575
576These options specify to use DTLS instead of TLS.
577With B<-dtls>, clients will negotiate any supported DTLS protocol version.
578Use the B<-dtls1> or B<-dtls1_2> options to support only DTLS1.0 or DTLS1.2,
579respectively.
580
581=back
582
583=head2 Engine Options
584
585=over 4
586
587=item B<-engine> I<id>
588
589Load the engine identified by I<id> and use all the methods it implements
590(algorithms, key storage, etc.), unless specified otherwise in the
591command-specific documentation or it is configured to do so, as described in
592L<config(5)/Engine Configuration>.
593
594The engine will be used for key ids specified with B<-key> and similar
595options when an option like B<-keyform engine> is given.
596
597A special case is the C<loader_attic> engine, which
598is meant just for internal OpenSSL testing purposes and
599supports loading keys, parameters, certificates, and CRLs from files.
600When this engine is used, files with such credentials are read via this engine.
601Using the C<file:> schema is optional; a plain file (path) name will do.
602
603=back
604
605Options specifying keys, like B<-key> and similar, can use the generic
606OpenSSL engine key loading URI scheme C<org.openssl.engine:> to retrieve
607private keys and public keys.  The URI syntax is as follows, in simplified
608form:
609
610    org.openssl.engine:{engineid}:{keyid}
611
612Where C<{engineid}> is the identity/name of the engine, and C<{keyid}> is a
613key identifier that's acceptable by that engine.  For example, when using an
614engine that interfaces against a PKCS#11 implementation, the generic key URI
615would be something like this (this happens to be an example for the PKCS#11
616engine that's part of OpenSC):
617
618    -key org.openssl.engine:pkcs11:label_some-private-key
619
620As a third possibility, for engines and providers that have implemented
621their own L<OSSL_STORE_LOADER(3)>, C<org.openssl.engine:> should not be
622necessary.  For a PKCS#11 implementation that has implemented such a loader,
623the PKCS#11 URI as defined in RFC 7512 should be possible to use directly:
624
625    -key pkcs11:object=some-private-key;pin-value=1234
626
627=head2 Provider Options
628
629=over 4
630
631=item B<-provider> I<name>
632
633Load and initialize the provider identified by I<name>. The I<name>
634can be also a path to the provider module. In that case the provider name
635will be the specified path and not just the provider module name.
636Interpretation of relative paths is platform specific. The configured
637"MODULESDIR" path, B<OPENSSL_MODULES> environment variable, or the path
638specified by B<-provider-path> is prepended to relative paths.
639See L<provider(7)> for a more detailed description.
640
641=item B<-provider-path> I<path>
642
643Specifies the search path that is to be used for looking for providers.
644Equivalently, the B<OPENSSL_MODULES> environment variable may be set.
645
646=item B<-propquery> I<propq>
647
648Specifies the I<property query clause> to be used when fetching algorithms
649from the loaded providers.
650See L<property(7)> for a more detailed description.
651
652=back
653
654=head1 ENVIRONMENT
655
656The OpenSSL library can be take some configuration parameters from the
657environment.  Some of these variables are listed below.  For information
658about specific commands, see L<openssl-engine(1)>,
659L<openssl-rehash(1)>, and L<tsget(1)>.
660
661For information about the use of environment variables in configuration,
662see L<config(5)/ENVIRONMENT>.
663
664For information about querying or specifying CPU architecture flags, see
665L<OPENSSL_ia32cap(3)>, and L<OPENSSL_s390xcap(3)>.
666
667For information about all environment variables used by the OpenSSL libraries,
668see L<openssl-env(7)>.
669
670=over 4
671
672=item B<OPENSSL_TRACE=>I<name>[,...]
673
674Enable tracing output of OpenSSL library, by name.
675This output will only make sense if you know OpenSSL internals well.
676Also, it might not give you any output at all, depending on how
677OpenSSL was built.
678
679The value is a comma separated list of names, with the following
680available:
681
682=over 4
683
684=item B<TRACE>
685
686Traces the OpenSSL trace API itself.
687
688=item B<INIT>
689
690Traces OpenSSL library initialization and cleanup.
691
692=item B<TLS>
693
694Traces the TLS/SSL protocol.
695
696=item B<TLS_CIPHER>
697
698Traces the ciphers used by the TLS/SSL protocol.
699
700=item B<CONF>
701
702Show details about provider and engine configuration.
703
704=item B<ENGINE_TABLE>
705
706The function that is used by RSA, DSA (etc) code to select registered
707ENGINEs, cache defaults and functional references (etc), will generate
708debugging summaries.
709
710=item B<ENGINE_REF_COUNT>
711
712Reference counts in the ENGINE structure will be monitored with a line
713of generated for each change.
714
715=item B<PKCS5V2>
716
717Traces PKCS#5 v2 key generation.
718
719=item B<PKCS12_KEYGEN>
720
721Traces PKCS#12 key generation.
722
723=item B<PKCS12_DECRYPT>
724
725Traces PKCS#12 decryption.
726
727=item B<X509V3_POLICY>
728
729Generates the complete policy tree at various points during X.509 v3
730policy evaluation.
731
732=item B<BN_CTX>
733
734Traces BIGNUM context operations.
735
736=item B<CMP>
737
738Traces CMP client and server activity.
739
740=item B<STORE>
741
742Traces STORE operations.
743
744=item B<DECODER>
745
746Traces decoder operations.
747
748=item B<ENCODER>
749
750Traces encoder operations.
751
752=item B<REF_COUNT>
753
754Traces decrementing certain ASN.1 structure references.
755
756=back
757
758=back
759
760=head1 SEE ALSO
761
762L<openssl-asn1parse(1)>,
763L<openssl-ca(1)>,
764L<openssl-ciphers(1)>,
765L<openssl-cms(1)>,
766L<openssl-crl(1)>,
767L<openssl-crl2pkcs7(1)>,
768L<openssl-dgst(1)>,
769L<openssl-dhparam(1)>,
770L<openssl-dsa(1)>,
771L<openssl-dsaparam(1)>,
772L<openssl-ec(1)>,
773L<openssl-ecparam(1)>,
774L<openssl-enc(1)>,
775L<openssl-engine(1)>,
776L<openssl-errstr(1)>,
777L<openssl-gendsa(1)>,
778L<openssl-genpkey(1)>,
779L<openssl-genrsa(1)>,
780L<openssl-kdf(1)>,
781L<openssl-list(1)>,
782L<openssl-mac(1)>,
783L<openssl-nseq(1)>,
784L<openssl-ocsp(1)>,
785L<openssl-passwd(1)>,
786L<openssl-pkcs12(1)>,
787L<openssl-pkcs7(1)>,
788L<openssl-pkcs8(1)>,
789L<openssl-pkey(1)>,
790L<openssl-pkeyparam(1)>,
791L<openssl-pkeyutl(1)>,
792L<openssl-prime(1)>,
793L<openssl-rand(1)>,
794L<openssl-rehash(1)>,
795L<openssl-req(1)>,
796L<openssl-rsa(1)>,
797L<openssl-rsautl(1)>,
798L<openssl-s_client(1)>,
799L<openssl-s_server(1)>,
800L<openssl-s_time(1)>,
801L<openssl-sess_id(1)>,
802L<openssl-smime(1)>,
803L<openssl-speed(1)>,
804L<openssl-spkac(1)>,
805L<openssl-srp(1)>,
806L<openssl-storeutl(1)>,
807L<openssl-ts(1)>,
808L<openssl-verify(1)>,
809L<openssl-version(1)>,
810L<openssl-x509(1)>,
811L<config(5)>,
812L<crypto(7)>,
813L<openssl-env(7)>.
814L<ssl(7)>,
815L<x509v3_config(5)>
816
817
818=head1 HISTORY
819
820The B<list> -I<XXX>B<-algorithms> options were added in OpenSSL 1.0.0;
821For notes on the availability of other commands, see their individual
822manual pages.
823
824The B<-issuer_checks> option is deprecated as of OpenSSL 1.1.0 and
825is silently ignored.
826
827The B<-xcertform> and B<-xkeyform> options
828are obsolete since OpenSSL 3.0 and have no effect.
829
830The interactive mode, which could be invoked by running C<openssl>
831with no further arguments, was removed in OpenSSL 3.0, and running
832that program with no arguments is now equivalent to C<openssl help>.
833
834=head1 COPYRIGHT
835
836Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved.
837
838Licensed under the Apache License 2.0 (the "License").  You may not use
839this file except in compliance with the License.  You can obtain a copy
840in the file LICENSE in the source distribution or at
841L<https://www.openssl.org/source/license.html>.
842
843=cut
844