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