update libressl to 2.8.2
[unleashed.git] / bin / openssl / openssl.1
blob6bd2ee7d5f2b080706efed1a82850f42b7a0d50e
1 .\" $OpenBSD: openssl.1,v 1.94 2018/08/24 20:12:24 tb Exp $
2 .\" ====================================================================
3 .\" Copyright (c) 1998-2002 The OpenSSL Project.  All rights reserved.
4 .\"
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
7 .\" are met:
8 .\"
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\"    notice, this list of conditions and the following disclaimer.
11 .\"
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\"    notice, this list of conditions and the following disclaimer in
14 .\"    the documentation and/or other materials provided with the
15 .\"    distribution.
16 .\"
17 .\" 3. All advertising materials mentioning features or use of this
18 .\"    software must display the following acknowledgment:
19 .\"    "This product includes software developed by the OpenSSL Project
20 .\"    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
21 .\"
22 .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
23 .\"    endorse or promote products derived from this software without
24 .\"    prior written permission. For written permission, please contact
25 .\"    openssl-core@openssl.org.
26 .\"
27 .\" 5. Products derived from this software may not be called "OpenSSL"
28 .\"    nor may "OpenSSL" appear in their names without prior written
29 .\"    permission of the OpenSSL Project.
30 .\"
31 .\" 6. Redistributions of any form whatsoever must retain the following
32 .\"    acknowledgment:
33 .\"    "This product includes software developed by the OpenSSL Project
34 .\"    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
35 .\"
36 .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
37 .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
38 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
39 .\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
40 .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41 .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
42 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
43 .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
44 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
45 .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
46 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
47 .\" OF THE POSSIBILITY OF SUCH DAMAGE.
48 .\" ====================================================================
49 .\"
50 .\" This product includes cryptographic software written by Eric Young
51 .\" (eay@cryptsoft.com).  This product includes software written by Tim
52 .\" Hudson (tjh@cryptsoft.com).
53 .\"
54 .\"
55 .\" Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
56 .\" All rights reserved.
57 .\"
58 .\" This package is an SSL implementation written
59 .\" by Eric Young (eay@cryptsoft.com).
60 .\" The implementation was written so as to conform with Netscapes SSL.
61 .\"
62 .\" This library is free for commercial and non-commercial use as long as
63 .\" the following conditions are aheared to.  The following conditions
64 .\" apply to all code found in this distribution, be it the RC4, RSA,
65 .\" lhash, DES, etc., code; not just the SSL code.  The SSL documentation
66 .\" included with this distribution is covered by the same copyright terms
67 .\" except that the holder is Tim Hudson (tjh@cryptsoft.com).
68 .\"
69 .\" Copyright remains Eric Young's, and as such any Copyright notices in
70 .\" the code are not to be removed.
71 .\" If this package is used in a product, Eric Young should be given attribution
72 .\" as the author of the parts of the library used.
73 .\" This can be in the form of a textual message at program startup or
74 .\" in documentation (online or textual) provided with the package.
75 .\"
76 .\" Redistribution and use in source and binary forms, with or without
77 .\" modification, are permitted provided that the following conditions
78 .\" are met:
79 .\" 1. Redistributions of source code must retain the copyright
80 .\"    notice, this list of conditions and the following disclaimer.
81 .\" 2. Redistributions in binary form must reproduce the above copyright
82 .\"    notice, this list of conditions and the following disclaimer in the
83 .\"    documentation and/or other materials provided with the distribution.
84 .\" 3. All advertising materials mentioning features or use of this software
85 .\"    must display the following acknowledgement:
86 .\"    "This product includes cryptographic software written by
87 .\"     Eric Young (eay@cryptsoft.com)"
88 .\"    The word 'cryptographic' can be left out if the rouines from the library
89 .\"    being used are not cryptographic related :-).
90 .\" 4. If you include any Windows specific code (or a derivative thereof) from
91 .\"    the apps directory (application code) you must include an
92 .\"    acknowledgement:
93 .\"    "This product includes software written by Tim Hudson
94 .\"     (tjh@cryptsoft.com)"
95 .\"
96 .\" THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
97 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
98 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
99 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
100 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
101 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
102 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
103 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
104 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
105 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
106 .\" SUCH DAMAGE.
108 .\" The licence and distribution terms for any publically available version or
109 .\" derivative of this code cannot be changed.  i.e. this code cannot simply be
110 .\" copied and put under another distribution licence
111 .\" [including the GNU Public Licence.]
113 .Dd $Mdocdate: August 24 2018 $
114 .Dt OPENSSL 1
116 .Sh NAME
117 .Nm openssl
118 .Nd OpenSSL command line tool
119 .Sh SYNOPSIS
121 .Ar command
122 .Op Ar command_opts
123 .Op Ar command_args
126 .Cm list-standard-commands |
127 .Cm list-message-digest-commands |
128 .Cm list-cipher-commands |
129 .Cm list-cipher-algorithms |
130 .Cm list-message-digest-algorithms |
131 .Cm list-public-key-algorithms
134 .Cm no- Ns Ar command
135 .Sh DESCRIPTION
136 .Nm OpenSSL
137 is a cryptography toolkit implementing the
138 Transport Layer Security
139 .Pq TLS v1
140 network protocol,
141 as well as related cryptography standards.
145 program is a command line tool for using the various
146 cryptography functions of
147 .Nm openssl Ns 's
148 crypto library from the shell.
150 The pseudo-commands
151 .Cm list-standard-commands , list-message-digest-commands ,
153 .Cm list-cipher-commands
154 output a list
155 .Pq one entry per line
156 of the names of all standard commands, message digest commands,
157 or cipher commands, respectively, that are available in the present
159 utility.
161 The pseudo-commands
162 .Cm list-cipher-algorithms
164 .Cm list-message-digest-algorithms
165 list all cipher and message digest names,
166 one entry per line.
167 Aliases are listed as:
169 .D1 from => to
171 The pseudo-command
172 .Cm list-public-key-algorithms
173 lists all supported public key algorithms.
175 The pseudo-command
176 .Cm no- Ns Ar command
177 tests whether a command of the
178 specified name is available.
180 .Ar command
181 does not exist,
182 it returns 0
183 and prints
184 .Cm no- Ns Ar command ;
185 otherwise it returns 1 and prints
186 .Ar command .
187 In both cases, the output goes to stdout and nothing is printed to stderr.
188 Additional command line arguments are always ignored.
189 Since for each cipher there is a command of the same name,
190 this provides an easy way for shell scripts to test for the
191 availability of ciphers in the
193 program.
195 .Sy Note :
196 .Cm no- Ns Ar command
197 is not able to detect pseudo-commands such as
198 .Cm quit ,
199 .Cm list- Ns Ar ... Ns Cm -commands ,
201 .Cm no- Ns Ar command
202 itself.
203 .Sh ASN1PARSE
204 .nr nS 1
205 .Nm "openssl asn1parse"
206 .Op Fl i
207 .Op Fl dlimit Ar number
208 .Op Fl dump
209 .Op Fl genconf Ar file
210 .Op Fl genstr Ar str
211 .Op Fl in Ar file
212 .Op Fl inform Cm der | pem | txt
213 .Op Fl length Ar number
214 .Op Fl noout
215 .Op Fl offset Ar number
216 .Op Fl oid Ar file
217 .Op Fl out Ar file
218 .Op Fl strparse Ar offset
219 .nr nS 0
222 .Nm asn1parse
223 command is a diagnostic utility that can parse ASN.1 structures.
224 It can also be used to extract data from ASN.1 formatted data.
226 The options are as follows:
227 .Bl -tag -width Ds
228 .It Fl dlimit Ar number
229 Dump the first
230 .Ar number
231 bytes of unknown data in hex form.
232 .It Fl dump
233 Dump unknown data in hex form.
234 .It Fl genconf Ar file , Fl genstr Ar str
235 Generate encoded data based on string
236 .Ar str ,
237 file
238 .Ar file ,
239 or both, using the format described in
240 .Xr ASN1_generate_nconf 3 .
241 If only
242 .Ar file
243 is present then the string is obtained from the default section
244 using the name
245 .Dq asn1 .
246 The encoded data is passed through the ASN.1 parser and printed out as
247 though it came from a file;
248 the contents can thus be examined and written to a file using the
249 .Fl out
250 option.
251 .It Fl i
252 Indent the output according to the
253 .Qq depth
254 of the structures.
255 .It Fl in Ar file
256 The input file to read from, or standard input if not specified.
257 .It Fl inform Cm der | pem | txt
258 The input format.
259 .It Fl length Ar number
260 Number of bytes to parse; the default is until end of file.
261 .It Fl noout
262 Do not output the parsed version of the input file.
263 .It Fl offset Ar number
264 Starting offset to begin parsing; the default is start of file.
265 .It Fl oid Ar file
266 A file containing additional object identifiers
267 .Pq OIDs .
268 If an OID
269 .Pq object identifier
270 is not part of
271 .Nm openssl Ns 's
272 internal table it will be represented in
273 numerical form
274 .Pq for example 1.2.3.4 .
276 Each line consists of three columns:
277 the first column is the OID in numerical format and should be followed by
278 whitespace.
279 The second column is the
280 .Qq short name ,
281 which is a single word followed by whitespace.
282 The final column is the rest of the line and is the
283 .Qq long name .
284 .Nm asn1parse
285 displays the long name.
286 .It Fl out Ar file
287 The DER-encoded output file; the default is no encoded output
288 (useful when combined with
289 .Fl strparse ) .
290 .It Fl strparse Ar offset
291 Parse the content octets of the ASN.1 object starting at
292 .Ar offset .
293 This option can be used multiple times to
294 .Qq drill down
295 into a nested structure.
297 .Sh CA
298 .nr nS 1
299 .Nm "openssl ca"
300 .Op Fl batch
301 .Op Fl cert Ar file
302 .Op Fl config Ar file
303 .Op Fl create_serial
304 .Op Fl crl_CA_compromise Ar time
305 .Op Fl crl_compromise Ar time
306 .Op Fl crl_hold Ar instruction
307 .Op Fl crl_reason Ar reason
308 .Op Fl crldays Ar days
309 .Op Fl crlexts Ar section
310 .Op Fl crlhours Ar hours
311 .Op Fl days Ar arg
312 .Op Fl enddate Ar date
313 .Op Fl extensions Ar section
314 .Op Fl extfile Ar section
315 .Op Fl gencrl
316 .Op Fl in Ar file
317 .Op Fl infiles
318 .Op Fl key Ar password
319 .Op Fl keyfile Ar arg
320 .Op Fl keyform Cm pem | der
321 .Op Fl md Ar arg
322 .Op Fl msie_hack
323 .Op Fl multivalue\-rdn
324 .Op Fl name Ar section
325 .Op Fl noemailDN
326 .Op Fl notext
327 .Op Fl out Ar file
328 .Op Fl outdir Ar dir
329 .Op Fl passin Ar arg
330 .Op Fl policy Ar arg
331 .Op Fl preserveDN
332 .Op Fl revoke Ar file
333 .Op Fl selfsign
334 .Op Fl spkac Ar file
335 .Op Fl ss_cert Ar file
336 .Op Fl startdate Ar date
337 .Op Fl status Ar serial
338 .Op Fl subj Ar arg
339 .Op Fl updatedb
340 .Op Fl utf8
341 .Op Fl verbose
342 .nr nS 0
345 .Nm ca
346 command is a minimal certificate authority (CA) application.
347 It can be used to sign certificate requests in a variety of forms
348 and generate certificate revocation lists (CRLs).
349 It also maintains a text database of issued certificates and their status.
351 The options relevant to CAs are as follows:
352 .Bl -tag -width "XXXX"
353 .It Fl batch
354 Batch mode.
355 In this mode no questions will be asked
356 and all certificates will be certified automatically.
357 .It Fl cert Ar file
358 The CA certificate file.
359 .It Fl config Ar file
360 Specify an alternative configuration file.
361 .It Fl create_serial
362 If reading the serial from the text file as specified in the
363 configuration fails, create a new random serial to be used as the
364 next serial number.
365 .It Fl days Ar arg
366 The number of days to certify the certificate for.
367 .It Fl enddate Ar date
368 Set the expiry date.
369 The format of the date is [YY]YYMMDDHHMMSSZ,
370 with all four year digits required for dates from 2050 onwards.
371 .It Fl extensions Ar section
372 The section of the configuration file containing certificate extensions
373 to be added when a certificate is issued (defaults to
374 .Cm x509_extensions
375 unless the
376 .Fl extfile
377 option is used).
378 If no extension section is present, a V1 certificate is created.
379 If the extension section is present
380 .Pq even if it is empty ,
381 then a V3 certificate is created.
382 See the
383 .Xr x509v3.cnf 5
384 manual page for details of the extension section format.
385 .It Fl extfile Ar file
386 An additional configuration
387 .Ar file
388 to read certificate extensions from
389 (using the default section unless the
390 .Fl extensions
391 option is also used).
392 .It Fl in Ar file
393 An input
394 .Ar file
395 containing a single certificate request to be signed by the CA.
396 .It Fl infiles
397 If present, this should be the last option; all subsequent arguments
398 are assumed to be the names of files containing certificate requests.
399 .It Fl key Ar password
401 .Fa password
402 used to encrypt the private key.
403 Since on some systems the command line arguments are visible,
404 this option should be used with caution.
405 .It Fl keyfile Ar file
406 The private key to sign requests with.
407 .It Fl keyform Cm pem | der
408 Private key file format.
409 The default is
410 .Cm pem .
411 .It Fl md Ar alg
412 The message digest to use.
413 Possible values include
414 .Ar md5
416 .Ar sha1 .
417 This option also applies to CRLs.
418 .It Fl msie_hack
419 This is a legacy option to make
420 .Nm ca
421 work with very old versions of the IE certificate enrollment control
422 .Qq certenr3 .
423 It used UniversalStrings for almost everything.
424 Since the old control has various security bugs,
425 its use is strongly discouraged.
426 The newer control
427 .Qq Xenroll
428 does not need this option.
429 .It Fl multivalue\-rdn
430 This option causes the
431 .Fl subj
432 argument to be interpreted with full support for multivalued RDNs,
433 for example
434 .Qq "/DC=org/DC=OpenSSL/DC=users/UID=123456+CN=John Doe" .
436 .Fl multivalue\-rdn
437 is not used, the UID value is set to
438 .Qq "123456+CN=John Doe" .
439 .It Fl name Ar section
440 Specifies the configuration file
441 .Ar section
442 to use (overrides
443 .Cm default_ca
444 in the
445 .Cm ca
446 section).
447 .It Fl noemailDN
448 The DN of a certificate can contain the EMAIL field if present in the
449 request DN, however it is good policy just having the email set into
451 .Cm altName
452 extension of the certificate.
453 When this option is set, the EMAIL field is removed from the certificate's
454 subject and set only in the, eventually present, extensions.
456 .Ar email_in_dn
457 keyword can be used in the configuration file to enable this behaviour.
458 .It Fl notext
459 Don't output the text form of a certificate to the output file.
460 .It Fl out Ar file
461 The output file to output certificates to.
462 The default is standard output.
463 The certificate details will also be printed out to this file in
464 PEM format, except that
465 .Fl spkac
466 outputs DER format.
467 .It Fl outdir Ar directory
469 .Ar directory
470 to output certificates to.
471 The certificate will be written to a file consisting of the
472 serial number in hex with
473 .Qq .pem
474 appended.
475 .It Fl passin Ar arg
476 The key password source.
477 .It Fl policy Ar arg
478 Define the CA
479 .Qq policy
480 to use.
481 The policy section in the configuration file
482 consists of a set of variables corresponding to certificate DN fields.
483 The values may be one of
484 .Qq match
485 (the value must match the same field in the CA certificate),
486 .Qq supplied
487 (the value must be present), or
488 .Qq optional
489 (the value may be present).
490 Any fields not mentioned in the policy section
491 are silently deleted, unless the
492 .Fl preserveDN
493 option is set,
494 but this can be regarded more of a quirk than intended behaviour.
495 .It Fl preserveDN
496 Normally, the DN order of a certificate is the same as the order of the
497 fields in the relevant policy section.
498 When this option is set, the order is the same as the request.
499 This is largely for compatibility with the older IE enrollment control
500 which would only accept certificates if their DNs matched the order of the
501 request.
502 This is not needed for Xenroll.
503 .It Fl selfsign
504 Indicates the issued certificates are to be signed with the key the
505 certificate requests were signed with, given with
506 .Fl keyfile .
507 Certificate requests signed with a different key are ignored.
509 .Fl gencrl ,
510 .Fl spkac ,
512 .Fl ss_cert
513 are given,
514 .Fl selfsign
515 is ignored.
517 A consequence of using
518 .Fl selfsign
519 is that the self-signed certificate appears among the entries in
520 the certificate database (see the configuration option
521 .Cm database )
522 and uses the same serial number counter as all other certificates
523 signed with the self-signed certificate.
524 .It Fl spkac Ar file
525 A file containing a single Netscape signed public key and challenge,
526 and additional field values to be signed by the CA.
527 This will usually come from the
528 KEYGEN tag in an HTML form to create a new private key.
529 It is, however, possible to create SPKACs using the
530 .Nm spkac
531 utility.
533 The file should contain the variable SPKAC set to the value of
534 the SPKAC and also the required DN components as name value pairs.
535 If it's necessary to include the same component twice,
536 then it can be preceded by a number and a
537 .Sq \&. .
538 .It Fl ss_cert Ar file
539 A single self-signed certificate to be signed by the CA.
540 .It Fl startdate Ar date
541 Set the start date.
542 The format of the date is [YY]YYMMDDHHMMSSZ,
543 with all four year digits required for dates from 2050 onwards.
544 .It Fl subj Ar arg
545 Supersedes the subject name given in the request.
547 .Ar arg
548 must be formatted as
549 .Sm off
550 .Pf / Ar type0 Ns = Ar value0 Ns / Ar type 1 Ns = Ar value 1 Ns /
551 .Ar type2 Ns = Ar ... ;
552 .Sm on
553 characters may be escaped by
554 .Sq \e
555 .Pq backslash ,
556 no spaces are skipped.
557 .It Fl utf8
558 Interpret field values read from a terminal or obtained from a
559 configuration file as UTF-8 strings.
560 By default, they are interpreted as ASCII.
561 .It Fl verbose
562 Print extra details about the operations being performed.
565 The options relevant to CRLs are as follows:
566 .Bl -tag -width "XXXX"
567 .It Fl crl_CA_compromise Ar time
568 This is the same as
569 .Fl crl_compromise ,
570 except the revocation reason is set to CACompromise.
571 .It Fl crl_compromise Ar time
572 Set the revocation reason to keyCompromise and the compromise time to
573 .Ar time .
574 .Ar time
575 should be in GeneralizedTime format, i.e. YYYYMMDDHHMMSSZ.
576 .It Fl crl_hold Ar instruction
577 Set the CRL revocation reason code to certificateHold and the hold
578 instruction to
579 .Ar instruction
580 which must be an OID.
581 Although any OID can be used, only holdInstructionNone
582 (the use of which is discouraged by RFC 2459), holdInstructionCallIssuer or
583 holdInstructionReject will normally be used.
584 .It Fl crl_reason Ar reason
585 Revocation reason, where
586 .Ar reason
587 is one of:
588 unspecified, keyCompromise, CACompromise, affiliationChanged, superseded,
589 cessationOfOperation, certificateHold or removeFromCRL.
590 The matching of
591 .Ar reason
592 is case insensitive.
593 Setting any revocation reason will make the CRL v2.
594 In practice, removeFromCRL is not particularly useful because it is only used
595 in delta CRLs which are not currently implemented.
596 .It Fl crldays Ar num
597 The number of days before the next CRL is due.
598 This is the days from now to place in the CRL
599 .Cm nextUpdate
600 field.
601 .It Fl crlexts Ar section
603 .Ar section
604 of the configuration file containing CRL extensions to include.
605 If no CRL extension section is present then a V1 CRL is created;
606 if the CRL extension section is present
607 (even if it is empty)
608 then a V2 CRL is created.
609 The CRL extensions specified are CRL extensions and not CRL entry extensions.
610 It should be noted that some software can't handle V2 CRLs.
611 See the
612 .Xr x509v3.cnf 5
613 manual page for details of the extension section format.
614 .It Fl crlhours Ar num
615 The number of hours before the next CRL is due.
616 .It Fl gencrl
617 Generate a CRL based on information in the index file.
618 .It Fl revoke Ar file
620 .Ar file
621 containing a certificate to revoke.
622 .It Fl status Ar serial
623 Show the status of the certificate with serial number
624 .Ar serial .
625 .It Fl updatedb
626 Update the database index to purge expired certificates.
629 Many of the options can be set in the
630 .Cm ca
631 section of the configuration file
632 (or in the default section of the configuration file),
633 specified using
634 .Cm default_ca
636 .Fl name .
637 The options
638 .Cm preserve
640 .Cm msie_hack
641 are read directly from the
642 .Cm ca
643 section.
645 Many of the configuration file options are identical to command line
646 options.
647 Where the option is present in the configuration file and the command line,
648 the command line value is used.
649 Where an option is described as mandatory, then it must be present in
650 the configuration file or the command line equivalent
651 .Pq if any
652 used.
653 .Bl -tag -width "XXXX"
654 .It Cm certificate
655 The same as
656 .Fl cert .
657 It gives the file containing the CA certificate.
658 Mandatory.
659 .It Cm copy_extensions
660 Determines how extensions in certificate requests should be handled.
661 If set to
662 .Cm none
663 or this option is not present, then extensions are
664 ignored and not copied to the certificate.
665 If set to
666 .Cm copy ,
667 then any extensions present in the request that are not already present
668 are copied to the certificate.
669 If set to
670 .Cm copyall ,
671 then all extensions in the request are copied to the certificate:
672 if the extension is already present in the certificate it is deleted first.
675 .Cm copy_extensions
676 option should be used with caution.
677 If care is not taken, it can be a security risk.
678 For example, if a certificate request contains a
679 .Cm basicConstraints
680 extension with CA:TRUE and the
681 .Cm copy_extensions
682 value is set to
683 .Cm copyall
684 and the user does not spot
685 this when the certificate is displayed, then this will hand the requester
686 a valid CA certificate.
688 This situation can be avoided by setting
689 .Cm copy_extensions
691 .Cm copy
692 and including
693 .Cm basicConstraints
694 with CA:FALSE in the configuration file.
695 Then if the request contains a
696 .Cm basicConstraints
697 extension, it will be ignored.
699 The main use of this option is to allow a certificate request to supply
700 values for certain extensions such as
701 .Cm subjectAltName .
702 .It Cm crl_extensions
703 The same as
704 .Fl crlexts .
705 .It Cm crlnumber
706 A text file containing the next CRL number to use in hex.
707 The CRL number will be inserted in the CRLs only if this file exists.
708 If this file is present, it must contain a valid CRL number.
709 .It Cm database
710 The text database file to use.
711 Mandatory.
712 This file must be present, though initially it will be empty.
713 .It Cm default_crl_hours , default_crl_days
714 The same as the
715 .Fl crlhours
717 .Fl crldays
718 options.
719 These will only be used if neither command line option is present.
720 At least one of these must be present to generate a CRL.
721 .It Cm default_days
722 The same as the
723 .Fl days
724 option.
725 The number of days to certify a certificate for.
726 .It Cm default_enddate
727 The same as the
728 .Fl enddate
729 option.
730 Either this option or
731 .Cm default_days
732 .Pq or the command line equivalents
733 must be present.
734 .It Cm default_md
735 The same as the
736 .Fl md
737 option.
738 The message digest to use.
739 Mandatory.
740 .It Cm default_startdate
741 The same as the
742 .Fl startdate
743 option.
744 The start date to certify a certificate for.
745 If not set, the current time is used.
746 .It Cm email_in_dn
747 The same as
748 .Fl noemailDN .
749 If the EMAIL field is to be removed from the DN of the certificate,
750 simply set this to
751 .Qq no .
752 If not present, the default is to allow for the EMAIL field in the
753 certificate's DN.
754 .It Cm msie_hack
755 The same as
756 .Fl msie_hack .
757 .It Cm name_opt , cert_opt
758 These options allow the format used to display the certificate details
759 when asking the user to confirm signing.
760 All the options supported by the
761 .Nm x509
762 utilities'
763 .Fl nameopt
765 .Fl certopt
766 switches can be used here, except that
767 .Cm no_signame
769 .Cm no_sigdump
770 are permanently set and cannot be disabled
771 (this is because the certificate signature cannot be displayed because
772 the certificate has not been signed at this point).
774 For convenience, the value
775 .Cm ca_default
776 is accepted by both to produce a reasonable output.
778 If neither option is present, the format used in earlier versions of
779 .Nm openssl
780 is used.
781 Use of the old format is strongly discouraged
782 because it only displays fields mentioned in the
783 .Cm policy
784 section,
785 mishandles multicharacter string types and does not display extensions.
786 .It Cm new_certs_dir
787 The same as the
788 .Fl outdir
789 command line option.
790 It specifies the directory where new certificates will be placed.
791 Mandatory.
792 .It Cm oid_file
793 This specifies a file containing additional object identifiers.
794 Each line of the file should consist of the numerical form of the
795 object identifier followed by whitespace, then the short name followed
796 by whitespace and finally the long name.
797 .It Cm oid_section
798 This specifies a section in the configuration file containing extra
799 object identifiers.
800 Each line should consist of the short name of the object identifier
801 followed by
802 .Sq =
803 and the numerical form.
804 The short and long names are the same when this option is used.
805 .It Cm policy
806 The same as
807 .Fl policy .
808 Mandatory.
809 .It Cm preserve
810 The same as
811 .Fl preserveDN .
812 .It Cm private_key
813 Same as the
814 .Fl keyfile
815 option.
816 The file containing the CA private key.
817 Mandatory.
818 .It Cm serial
819 A text file containing the next serial number to use in hex.
820 Mandatory.
821 This file must be present and contain a valid serial number.
822 .It Cm unique_subject
823 If the value
824 .Cm yes
825 is given, the valid certificate entries in the
826 database must have unique subjects.
827 If the value
828 .Cm no
829 is given,
830 several valid certificate entries may have the exact same subject.
831 The default value is
832 .Cm yes .
833 .It Cm x509_extensions
834 The same as
835 .Fl extensions .
837 .Sh CIPHERS
838 .Nm openssl ciphers
839 .Op Fl hVv
840 .Op Ar control
843 .Nm ciphers
844 command converts the
845 .Ar control
846 string from the format documented in
847 .Xr SSL_CTX_set_cipher_list 3
848 into an ordered SSL cipher suite preference list.
849 If no
850 .Ar control
851 string is specified, the
852 .Cm DEFAULT
853 list is printed.
855 The options are as follows:
856 .Bl -tag -width Ds
857 .It Fl h , \&?
858 Print a brief usage message.
859 .It Fl V
860 Verbose.
861 List ciphers with cipher suite code in hex format,
862 cipher name, and a complete description of protocol version,
863 key exchange, authentication, encryption, and mac algorithms.
864 .It Fl v
865 Like
866 .Fl V ,
867 but without cipher suite codes.
869 .Sh CRL
870 .nr nS 1
871 .Nm "openssl crl"
872 .Op Fl CAfile Ar file
873 .Op Fl CApath Ar dir
874 .Op Fl fingerprint
875 .Op Fl hash
876 .Op Fl in Ar file
877 .Op Fl inform Cm der | pem
878 .Op Fl issuer
879 .Op Fl lastupdate
880 .Op Fl nextupdate
881 .Op Fl noout
882 .Op Fl out Ar file
883 .Op Fl outform Cm der | pem
884 .Op Fl text
885 .nr nS 0
888 .Nm crl
889 command processes CRL files in DER or PEM format.
891 The options are as follows:
892 .Bl -tag -width Ds
893 .It Fl CAfile Ar file
894 Verify the signature on a CRL by looking up the issuing certificate in
895 .Ar file .
896 .It Fl CApath Ar directory
897 Verify the signature on a CRL by looking up the issuing certificate in
898 .Ar dir .
899 This directory must be a standard certificate directory,
900 i.e. a hash of each subject name (using
901 .Cm x509 Fl hash )
902 should be linked to each certificate.
903 .It Fl fingerprint
904 Print the CRL fingerprint.
905 .It Fl hash
906 Output a hash of the issuer name.
907 This can be used to look up CRLs in a directory by issuer name.
908 .It Fl in Ar file
909 The input file to read from, or standard input if not specified.
910 .It Fl inform Cm der | pem
911 The input format.
912 .It Fl issuer
913 Output the issuer name.
914 .It Fl lastupdate
915 Output the
916 .Cm lastUpdate
917 field.
918 .It Fl nextupdate
919 Output the
920 .Cm nextUpdate
921 field.
922 .It Fl noout
923 Do not output the encoded version of the CRL.
924 .It Fl out Ar file
925 The output file to write to, or standard output if not specified.
926 .It Fl outform Cm der | pem
927 The output format.
928 .It Fl text
929 Print the CRL in plain text.
931 .Sh CRL2PKCS7
932 .nr nS 1
933 .Nm "openssl crl2pkcs7"
934 .Op Fl certfile Ar file
935 .Op Fl in Ar file
936 .Op Fl inform Cm der | pem
937 .Op Fl nocrl
938 .Op Fl out Ar file
939 .Op Fl outform Cm der | pem
940 .nr nS 0
943 .Nm crl2pkcs7
944 command takes an optional CRL and one or more
945 certificates and converts them into a PKCS#7 degenerate
946 .Qq certificates only
947 structure.
949 The options are as follows:
950 .Bl -tag -width Ds
951 .It Fl certfile Ar file
952 Add the certificates in PEM
953 .Ar file
954 to the PKCS#7 structure.
955 This option can be used more than once
956 to read certificates from multiple files.
957 .It Fl in Ar file
958 Read the CRL from
959 .Ar file ,
960 or standard input if not specified.
961 .It Fl inform Cm der | pem
962 The input format.
963 .It Fl nocrl
964 Normally, a CRL is included in the output file.
965 With this option, no CRL is
966 included in the output file and a CRL is not read from the input file.
967 .It Fl out Ar file
968 Write the PKCS#7 structure to
969 .Ar file ,
970 or standard output if not specified.
971 .It Fl outform Cm der | pem
972 The output format.
974 .Sh DGST
975 .nr nS 1
976 .Nm "openssl dgst"
977 .Op Fl cd
978 .Op Fl binary
979 .Op Fl Ar digest
980 .Op Fl hex
981 .Op Fl hmac Ar key
982 .Op Fl keyform Cm pem
983 .Op Fl mac Ar algorithm
984 .Op Fl macopt Ar nm : Ns Ar v
985 .Op Fl out Ar file
986 .Op Fl passin Ar arg
987 .Op Fl prverify Ar file
988 .Op Fl sign Ar file
989 .Op Fl signature Ar file
990 .Op Fl sigopt Ar nm : Ns Ar v
991 .Op Fl verify Ar file
992 .Op Ar
993 .nr nS 0
995 The digest functions output the message digest of a supplied
996 .Ar file
998 .Ar files
999 in hexadecimal form.
1000 They can also be used for digital signing and verification.
1002 The options are as follows:
1003 .Bl -tag -width Ds
1004 .It Fl binary
1005 Output the digest or signature in binary form.
1006 .It Fl c
1007 Print the digest in two-digit groups separated by colons.
1008 .It Fl d
1009 Print BIO debugging information.
1010 .It Fl Ar digest
1011 Use the specified message
1012 .Ar digest .
1013 The default is MD5.
1014 The available digests can be displayed using
1015 .Nm openssl
1016 .Cm list-message-digest-commands .
1017 The following are equivalent:
1018 .Nm openssl dgst
1019 .Fl md5
1021 .Nm openssl
1022 .Cm md5 .
1023 .It Fl hex
1024 Digest is to be output as a hex dump.
1025 This is the default case for a
1026 .Qq normal
1027 digest as opposed to a digital signature.
1028 .It Fl hmac Ar key
1029 Create a hashed MAC using
1030 .Ar key .
1031 .It Fl keyform Cm pem
1032 Specifies the key format to sign the digest with.
1033 .It Fl mac Ar algorithm
1034 Create a keyed Message Authentication Code (MAC).
1035 The most popular MAC algorithm is HMAC (hash-based MAC),
1036 but there are other MAC algorithms which are not based on hash.
1037 MAC keys and other options should be set via the
1038 .Fl macopt
1039 parameter.
1040 .It Fl macopt Ar nm : Ns Ar v
1041 Passes options to the MAC algorithm, specified by
1042 .Fl mac .
1043 The following options are supported by HMAC:
1044 .Bl -tag -width Ds
1045 .It Cm key : Ns Ar string
1046 Specifies the MAC key as an alphanumeric string
1047 (use if the key contain printable characters only).
1048 String length must conform to any restrictions of the MAC algorithm.
1049 .It Cm hexkey : Ns Ar string
1050 Specifies the MAC key in hexadecimal form (two hex digits per byte).
1051 Key length must conform to any restrictions of the MAC algorithm.
1053 .It Fl out Ar file
1054 The output file to write to,
1055 or standard output if not specified.
1056 .It Fl passin Ar arg
1057 The key password source.
1058 .It Fl prverify Ar file
1059 Verify the signature using the private key in
1060 .Ar file .
1061 The output is either
1062 .Qq Verification OK
1064 .Qq Verification Failure .
1065 .It Fl sign Ar file
1066 Digitally sign the digest using the private key in
1067 .Ar file .
1068 .It Fl signature Ar file
1069 The actual signature to verify.
1070 .It Fl sigopt Ar nm : Ns Ar v
1071 Pass options to the signature algorithm during sign or verify operations.
1072 The names and values of these options are algorithm-specific.
1073 .It Fl verify Ar file
1074 Verify the signature using the public key in
1075 .Ar file .
1076 The output is either
1077 .Qq Verification OK
1079 .Qq Verification Failure .
1080 .It Ar
1081 File or files to digest.
1082 If no files are specified then standard input is used.
1084 .Sh DHPARAM
1085 .nr nS 1
1086 .Nm "openssl dhparam"
1087 .Op Fl 2 | 5
1088 .Op Fl C
1089 .Op Fl check
1090 .Op Fl dsaparam
1091 .Op Fl in Ar file
1092 .Op Fl inform Cm der | pem
1093 .Op Fl noout
1094 .Op Fl out Ar file
1095 .Op Fl outform Cm der | pem
1096 .Op Fl text
1097 .Op Ar numbits
1098 .nr nS 0
1101 .Nm dhparam
1102 command is used to manipulate DH parameter files.
1103 Only the older PKCS#3 DH is supported,
1104 not the newer X9.42 DH.
1106 The options are as follows:
1107 .Bl -tag -width Ds
1108 .It Fl 2 , 5
1109 The generator to use;
1110 2 is the default.
1111 If present, the input file is ignored and parameters are generated instead.
1112 .It Fl C
1113 Convert the parameters into C code.
1114 The parameters can then be loaded by calling the
1115 .No get_dh Ns Ar numbits
1116 function.
1117 .It Fl check
1118 Check the DH parameters.
1119 .It Fl dsaparam
1120 Read or create DSA parameters,
1121 converted to DH format on output.
1122 Otherwise,
1123 .Qq strong
1124 primes
1125 .Pq such that (p-1)/2 is also prime
1126 will be used for DH parameter generation.
1128 DH parameter generation with the
1129 .Fl dsaparam
1130 option is much faster,
1131 and the recommended exponent length is shorter,
1132 which makes DH key exchange more efficient.
1133 Beware that with such DSA-style DH parameters,
1134 a fresh DH key should be created for each use to
1135 avoid small-subgroup attacks that may be possible otherwise.
1136 .It Fl in Ar file
1137 The input file to read from,
1138 or standard input if not specified.
1139 .It Fl inform Cm der | pem
1140 The input format.
1141 .It Fl noout
1142 Do not output the encoded version of the parameters.
1143 .It Fl out Ar file
1144 The output file to write to,
1145 or standard output if not specified.
1146 .It Fl outform Cm der | pem
1147 The output format.
1148 .It Fl text
1149 Print the DH parameters in plain text.
1150 .It Ar numbits
1151 Generate a parameter set of size
1152 .Ar numbits .
1153 It must be the last option.
1154 If not present, a value of 2048 is used.
1155 If this value is present, the input file is ignored and
1156 parameters are generated instead.
1158 .Sh DSA
1159 .nr nS 1
1160 .Nm "openssl dsa"
1162 .Fl aes128 | aes192 | aes256 |
1163 .Fl des | des3
1165 .Op Fl in Ar file
1166 .Op Fl inform Cm der | pem
1167 .Op Fl modulus
1168 .Op Fl noout
1169 .Op Fl out Ar file
1170 .Op Fl outform Cm der | pem
1171 .Op Fl passin Ar arg
1172 .Op Fl passout Ar arg
1173 .Op Fl pubin
1174 .Op Fl pubout
1175 .Op Fl text
1176 .nr nS 0
1179 .Nm dsa
1180 command processes DSA keys.
1181 They can be converted between various forms and their components printed out.
1183 .Sy Note :
1184 This command uses the traditional
1185 .Nm SSLeay
1186 compatible format for private key encryption:
1187 newer applications should use the more secure PKCS#8 format using the
1188 .Nm pkcs8
1189 command.
1191 The options are as follows:
1192 .Bl -tag -width Ds
1193 .It Xo
1194 .Fl aes128 | aes192 | aes256 |
1195 .Fl des | des3
1197 Encrypt the private key with the AES, DES, or the triple DES
1198 ciphers, respectively, before outputting it.
1199 A pass phrase is prompted for.
1200 If none of these options are specified, the key is written in plain text.
1201 This means that using the
1202 .Nm dsa
1203 utility to read an encrypted key with no encryption option can be used to
1204 remove the pass phrase from a key,
1205 or by setting the encryption options it can be used to add or change
1206 the pass phrase.
1207 These options can only be used with PEM format output files.
1208 .It Fl in Ar file
1209 The input file to read from,
1210 or standard input if not specified.
1211 If the key is encrypted, a pass phrase will be prompted for.
1212 .It Fl inform Cm der | pem
1213 The input format.
1214 .It Fl modulus
1215 Print the value of the public key component of the key.
1216 .It Fl noout
1217 Do not output the encoded version of the key.
1218 .It Fl out Ar file
1219 The output file to write to,
1220 or standard output if not specified.
1221 If any encryption options are set then a pass phrase will be
1222 prompted for.
1223 .It Fl outform Cm der | pem
1224 The output format.
1225 .It Fl passin Ar arg
1226 The key password source.
1227 .It Fl passout Ar arg
1228 The output file password source.
1229 .It Fl pubin
1230 Read in a public key, not a private key.
1231 .It Fl pubout
1232 Output a public key, not a private key.
1233 Automatically set if the input is a public key.
1234 .It Fl text
1235 Print the public/private key in plain text.
1237 .Sh DSAPARAM
1238 .nr nS 1
1239 .Nm "openssl dsaparam"
1240 .Op Fl C
1241 .Op Fl genkey
1242 .Op Fl in Ar file
1243 .Op Fl inform Cm der | pem
1244 .Op Fl noout
1245 .Op Fl out Ar file
1246 .Op Fl outform Cm der | pem
1247 .Op Fl text
1248 .Op Ar numbits
1249 .nr nS 0
1252 .Nm dsaparam
1253 command is used to manipulate or generate DSA parameter files.
1255 The options are as follows:
1256 .Bl -tag -width Ds
1257 .It Fl C
1258 Convert the parameters into C code.
1259 The parameters can then be loaded by calling the
1260 .No get_dsa Ns Ar XXX
1261 function.
1262 .It Fl genkey
1263 Generate a DSA key either using the specified or generated
1264 parameters.
1265 .It Fl in Ar file
1266 The input file to read from,
1267 or standard input if not specified.
1268 If the
1269 .Ar numbits
1270 parameter is included, then this option is ignored.
1271 .It Fl inform Cm der | pem
1272 The input format.
1273 .It Fl noout
1274 Do not output the encoded version of the parameters.
1275 .It Fl out Ar file
1276 The output file to write to,
1277 or standard output if not specified.
1278 .It Fl outform Cm der | pem
1279 The output format.
1280 .It Fl text
1281 Print the DSA parameters in plain text.
1282 .It Ar numbits
1283 Generate a parameter set of size
1284 .Ar numbits .
1285 If this option is included, the input file is ignored.
1287 .Sh EC
1288 .nr nS 1
1289 .Nm "openssl ec"
1290 .Op Fl conv_form Ar arg
1291 .Op Fl des
1292 .Op Fl des3
1293 .Op Fl in Ar file
1294 .Op Fl inform Cm der | pem
1295 .Op Fl noout
1296 .Op Fl out Ar file
1297 .Op Fl outform Cm der | pem
1298 .Op Fl param_enc Ar arg
1299 .Op Fl param_out
1300 .Op Fl passin Ar arg
1301 .Op Fl passout Ar arg
1302 .Op Fl pubin
1303 .Op Fl pubout
1304 .Op Fl text
1305 .nr nS 0
1308 .Nm ec
1309 command processes EC keys.
1310 They can be converted between various
1311 forms and their components printed out.
1312 .Nm openssl
1313 uses the private key format specified in
1314 .Dq SEC 1: Elliptic Curve Cryptography
1315 .Pq Lk http://www.secg.org/ .
1316 To convert an
1317 EC private key into the PKCS#8 private key format use the
1318 .Nm pkcs8
1319 command.
1321 The options are as follows:
1322 .Bl -tag -width Ds
1323 .It Fl conv_form Ar arg
1324 Specify how the points on the elliptic curve are converted
1325 into octet strings.
1326 Possible values are:
1327 .Cm compressed
1328 (the default),
1329 .Cm uncompressed ,
1331 .Cm hybrid .
1332 For more information regarding
1333 the point conversion forms see the X9.62 standard.
1334 Note:
1335 Due to patent issues the
1336 .Cm compressed
1337 option is disabled by default for binary curves
1338 and can be enabled by defining the preprocessor macro
1339 .Dv OPENSSL_EC_BIN_PT_COMP
1340 at compile time.
1341 .It Fl des | des3
1342 Encrypt the private key with DES, triple DES, or
1343 any other cipher supported by
1344 .Nm openssl .
1345 A pass phrase is prompted for.
1346 If none of these options is specified the key is written in plain text.
1347 This means that using the
1348 .Nm ec
1349 utility to read in an encrypted key with no
1350 encryption option can be used to remove the pass phrase from a key,
1351 or by setting the encryption options
1352 it can be used to add or change the pass phrase.
1353 These options can only be used with PEM format output files.
1354 .It Fl in Ar file
1355 The input file to read a key from,
1356 or standard input if not specified.
1357 If the key is encrypted a pass phrase will be prompted for.
1358 .It Fl inform Cm der | pem
1359 The input format.
1360 .It Fl noout
1361 Do not output the encoded version of the key.
1362 .It Fl out Ar file
1363 The output filename to write to,
1364 or standard output if not specified.
1365 If any encryption options are set then a pass phrase will be prompted for.
1366 .It Fl outform Cm der | pem
1367 The output format.
1368 .It Fl param_enc Ar arg
1369 Specify how the elliptic curve parameters are encoded.
1370 Possible value are:
1371 .Cm named_curve ,
1372 i.e. the EC parameters are specified by an OID; or
1373 .Cm explicit ,
1374 where the EC parameters are explicitly given
1375 (see RFC 3279 for the definition of the EC parameter structures).
1376 The default value is
1377 .Cm named_curve .
1378 Note: the
1379 .Cm implicitlyCA
1380 alternative,
1381 as specified in RFC 3279,
1382 is currently not implemented.
1383 .It Fl passin Ar arg
1384 The key password source.
1385 .It Fl passout Ar arg
1386 The output file password source.
1387 .It Fl pubin
1388 Read in a public key, not a private key.
1389 .It Fl pubout
1390 Output a public key, not a private key.
1391 Automatically set if the input is a public key.
1392 .It Fl text
1393 Print the public/private key in plain text.
1395 .Sh ECPARAM
1396 .nr nS 1
1397 .Nm "openssl ecparam"
1398 .Op Fl C
1399 .Op Fl check
1400 .Op Fl conv_form Ar arg
1401 .Op Fl genkey
1402 .Op Fl in Ar file
1403 .Op Fl inform Cm der | pem
1404 .Op Fl list_curves
1405 .Op Fl name Ar arg
1406 .Op Fl no_seed
1407 .Op Fl noout
1408 .Op Fl out Ar file
1409 .Op Fl outform Cm der | pem
1410 .Op Fl param_enc Ar arg
1411 .Op Fl text
1412 .nr nS 0
1415 .Nm ecparam
1416 command is used to manipulate or generate EC parameter files.
1417 .Nm openssl
1418 is not able to generate new groups so
1419 .Nm ecparam
1420 can only create EC parameters from known (named) curves.
1422 The options are as follows:
1423 .Bl -tag -width Ds
1424 .It Fl C
1425 Convert the EC parameters into C code.
1426 The parameters can then be loaded by calling the
1427 .No get_ec_group_ Ns Ar XXX
1428 function.
1429 .It Fl check
1430 Validate the elliptic curve parameters.
1431 .It Fl conv_form Ar arg
1432 Specify how the points on the elliptic curve are converted
1433 into octet strings.
1434 Possible values are:
1435 .Cm compressed
1436 (the default),
1437 .Cm uncompressed ,
1439 .Cm hybrid .
1440 For more information regarding
1441 the point conversion forms see the X9.62 standard.
1442 Note:
1443 Due to patent issues the
1444 .Cm compressed
1445 option is disabled by default for binary curves
1446 and can be enabled by defining the preprocessor macro
1447 .Dv OPENSSL_EC_BIN_PT_COMP
1448 at compile time.
1449 .It Fl genkey
1450 Generate an EC private key using the specified parameters.
1451 .It Fl in Ar file
1452 The input file to read from,
1453 or standard input if not specified.
1454 .It Fl inform Cm der | pem
1455 The input format.
1456 .It Fl list_curves
1457 Print a list of all
1458 currently implemented EC parameter names and exit.
1459 .It Fl name Ar arg
1460 Use the EC parameters with the specified "short" name.
1461 .It Fl no_seed
1462 Do not include the seed for the parameter generation
1463 in the ECParameters structure (see RFC 3279).
1464 .It Fl noout
1465 Do not output the encoded version of the parameters.
1466 .It Fl out Ar file
1467 The output file to write to,
1468 or standard output if not specified.
1469 .It Fl outform Cm der | pem
1470 The output format.
1471 .It Fl param_enc Ar arg
1472 Specify how the elliptic curve parameters are encoded.
1473 Possible value are:
1474 .Cm named_curve ,
1475 i.e. the EC parameters are specified by an OID, or
1476 .Cm explicit ,
1477 where the EC parameters are explicitly given
1478 (see RFC 3279 for the definition of the EC parameter structures).
1479 The default value is
1480 .Cm named_curve .
1481 Note: the
1482 .Cm implicitlyCA
1483 alternative, as specified in RFC 3279,
1484 is currently not implemented.
1485 .It Fl text
1486 Print the EC parameters in plain text.
1488 .Sh ENC
1489 .nr nS 1
1490 .Nm "openssl enc"
1491 .Fl ciphername
1492 .Op Fl AadePp
1493 .Op Fl base64
1494 .Op Fl bufsize Ar number
1495 .Op Fl debug
1496 .Op Fl in Ar file
1497 .Op Fl iv Ar IV
1498 .Op Fl K Ar key
1499 .Op Fl k Ar password
1500 .Op Fl kfile Ar file
1501 .Op Fl md Ar digest
1502 .Op Fl none
1503 .Op Fl nopad
1504 .Op Fl nosalt
1505 .Op Fl out Ar file
1506 .Op Fl pass Ar arg
1507 .Op Fl S Ar salt
1508 .Op Fl salt
1509 .nr nS 0
1511 The symmetric cipher commands allow data to be encrypted or decrypted
1512 using various block and stream ciphers using keys based on passwords
1513 or explicitly provided.
1514 Base64 encoding or decoding can also be performed either by itself
1515 or in addition to the encryption or decryption.
1516 The program can be called either as
1517 .Nm openssl Ar ciphername
1519 .Nm openssl enc - Ns Ar ciphername .
1521 Some of the ciphers do not have large keys and others have security
1522 implications if not used correctly.
1523 All the block ciphers normally use PKCS#5 padding,
1524 also known as standard block padding.
1525 If padding is disabled, the input data must be a multiple of the cipher
1526 block length.
1528 The options are as follows:
1529 .Bl -tag -width Ds
1530 .It Fl A
1531 If the
1532 .Fl a
1533 option is set, then base64 process the data on one line.
1534 .It Fl a , base64
1535 Base64 process the data.
1536 This means that if encryption is taking place, the data is base64-encoded
1537 after encryption.
1538 If decryption is set, the input data is base64-decoded before
1539 being decrypted.
1540 .It Fl bufsize Ar number
1541 Set the buffer size for I/O.
1542 .It Fl d
1543 Decrypt the input data.
1544 .It Fl debug
1545 Debug the BIOs used for I/O.
1546 .It Fl e
1547 Encrypt the input data.
1548 This is the default.
1549 .It Fl in Ar file
1550 The input file to read from,
1551 or standard input if not specified.
1552 .It Fl iv Ar IV
1553 The actual
1554 .Ar IV
1555 .Pq initialisation vector
1556 to use:
1557 this must be represented as a string comprised only of hex digits.
1558 When only the
1559 .Ar key
1560 is specified using the
1561 .Fl K
1562 option,
1563 the IV must explicitly be defined.
1564 When a password is being specified using one of the other options,
1565 the IV is generated from this password.
1566 .It Fl K Ar key
1567 The actual
1568 .Ar key
1569 to use:
1570 this must be represented as a string comprised only of hex digits.
1571 If only the key is specified,
1572 the IV must also be specified using the
1573 .Fl iv
1574 option.
1575 When both a
1576 .Ar key
1577 and a
1578 .Ar password
1579 are specified, the
1580 .Ar key
1581 given with the
1582 .Fl K
1583 option will be used and the IV generated from the password will be taken.
1584 It probably does not make much sense to specify both
1585 .Ar key
1587 .Ar password .
1588 .It Fl k Ar password
1590 .Ar password
1591 to derive the key from.
1592 Superseded by the
1593 .Fl pass
1594 option.
1595 .It Fl kfile Ar file
1596 Read the password to derive the key from the first line of
1597 .Ar file .
1598 Superseded by the
1599 .Fl pass
1600 option.
1601 .It Fl md Ar digest
1603 .Ar digest
1604 to create a key from a pass phrase.
1605 .Ar digest
1606 may be one of
1607 .Cm md5
1609 .Cm sha1 .
1610 .It Fl none
1611 Use NULL cipher (no encryption or decryption of input).
1612 .It Fl nopad
1613 Disable standard block padding.
1614 .It Fl nosalt
1615 Don't use a salt in the key derivation routines.
1616 This option should never be used
1617 since it makes it possible to perform efficient dictionary
1618 attacks on the password and to attack stream cipher encrypted data.
1619 .It Fl out Ar file
1620 The output file to write to,
1621 or standard output if not specified.
1622 .It Fl P
1623 Print out the salt, key, and IV used, then immediately exit;
1624 don't do any encryption or decryption.
1625 .It Fl p
1626 Print out the salt, key, and IV used.
1627 .It Fl pass Ar arg
1628 The password source.
1629 .It Fl S Ar salt
1630 The actual
1631 .Ar salt
1632 to use:
1633 this must be represented as a string comprised only of hex digits.
1634 .It Fl salt
1635 Use a salt in the key derivation routines (the default).
1636 When the salt is being used
1637 the first eight bytes of the encrypted data are reserved for the salt:
1638 it is randomly generated when encrypting a file and read from the
1639 encrypted file when it is decrypted.
1641 .Sh ERRSTR
1642 .Nm openssl errstr
1643 .Op Fl stats
1644 .Ar errno ...
1647 .Nm errstr
1648 command performs error number to error string conversion,
1649 generating a human-readable string representing the error code
1650 .Ar errno .
1651 The string is obtained through the
1652 .Xr ERR_error_string_n 3
1653 function and has the following format:
1655 .Dl error:[error code]:[library name]:[function name]:[reason string]
1657 .Bq error code
1658 is an 8-digit hexadecimal number.
1659 The remaining fields
1660 .Bq library name ,
1661 .Bq function name ,
1663 .Bq reason string
1664 are all ASCII text.
1666 The options are as follows:
1667 .Bl -tag -width Ds
1668 .It Fl stats
1669 Print debugging statistics about various aspects of the hash table.
1671 .Sh GENDSA
1672 .nr nS 1
1673 .Nm "openssl gendsa"
1675 .Fl aes128 | aes192 | aes256 |
1676 .Fl des | des3
1678 .Op Fl out Ar file
1679 .Op Ar paramfile
1680 .nr nS 0
1683 .Nm gendsa
1684 command generates a DSA private key from a DSA parameter file
1685 (typically generated by the
1686 .Nm openssl dsaparam
1687 command).
1688 DSA key generation is little more than random number generation so it is
1689 much quicker than,
1690 for example,
1691 RSA key generation.
1693 The options are as follows:
1694 .Bl -tag -width Ds
1695 .It Xo
1696 .Fl aes128 | aes192 | aes256 |
1697 .Fl des | des3
1699 Encrypt the private key with the AES, DES,
1700 or the triple DES ciphers, respectively, before outputting it.
1701 A pass phrase is prompted for.
1702 If none of these options are specified, no encryption is used.
1703 .It Fl out Ar file
1704 The output file to write to,
1705 or standard output if not specified.
1706 .It Ar paramfile
1707 Specify the DSA parameter file to use.
1708 The parameters in this file determine the size of the private key.
1710 .Sh GENPKEY
1711 .nr nS 1
1712 .Nm "openssl genpkey"
1713 .Op Fl algorithm Ar alg
1714 .Op Ar cipher
1715 .Op Fl genparam
1716 .Op Fl out Ar file
1717 .Op Fl outform Cm der | pem
1718 .Op Fl paramfile Ar file
1719 .Op Fl pass Ar arg
1720 .Op Fl pkeyopt Ar opt : Ns Ar value
1721 .Op Fl text
1722 .nr nS 0
1725 .Nm genpkey
1726 command generates private keys.
1727 The use of this
1728 program is encouraged over the algorithm specific utilities
1729 because additional algorithm options can be used.
1731 The options are as follows:
1732 .Bl -tag -width Ds
1733 .It Fl algorithm Ar alg
1734 The public key algorithm to use,
1735 such as RSA, DSA, or DH.
1736 This option must precede any
1737 .Fl pkeyopt
1738 options.
1739 The options
1740 .Fl paramfile
1742 .Fl algorithm
1743 are mutually exclusive.
1744 .It Ar cipher
1745 Encrypt the private key with the supplied cipher.
1746 Any algorithm name accepted by
1747 .Xr EVP_get_cipherbyname 3
1748 is acceptable.
1749 .It Fl genparam
1750 Generate a set of parameters instead of a private key.
1751 This option must precede any
1752 .Fl algorithm ,
1753 .Fl paramfile ,
1755 .Fl pkeyopt
1756 options.
1757 .It Fl out Ar file
1758 The output file to write to,
1759 or standard output if not specified.
1760 .It Fl outform Cm der | pem
1761 The output format.
1762 .It Fl paramfile Ar file
1763 Some public key algorithms generate a private key based on a set of parameters,
1764 which can be supplied using this option.
1765 If this option is used the public key
1766 algorithm used is determined by the parameters.
1767 This option must precede any
1768 .Fl pkeyopt
1769 options.
1770 The options
1771 .Fl paramfile
1773 .Fl algorithm
1774 are mutually exclusive.
1775 .It Fl pass Ar arg
1776 The output file password source.
1777 .It Fl pkeyopt Ar opt : Ns Ar value
1778 Set the public key algorithm option
1779 .Ar opt
1781 .Ar value ,
1782 as follows:
1783 .Bl -tag -width Ds -offset indent
1784 .It rsa_keygen_bits : Ns Ar numbits
1785 (RSA)
1786 The number of bits in the generated key.
1787 The default is 2048.
1788 .It rsa_keygen_pubexp : Ns Ar value
1789 (RSA)
1790 The RSA public exponent value.
1791 This can be a large decimal or hexadecimal value if preceded by 0x.
1792 The default is 65537.
1793 .It dsa_paramgen_bits : Ns Ar numbits
1794 (DSA)
1795 The number of bits in the generated parameters.
1796 The default is 1024.
1797 .It dh_paramgen_prime_len : Ns Ar numbits
1798 (DH)
1799 The number of bits in the prime parameter
1800 .Ar p .
1801 .It dh_paramgen_generator : Ns Ar value
1802 (DH)
1803 The value to use for the generator
1804 .Ar g .
1805 .It ec_paramgen_curve : Ns Ar curve
1806 (EC)
1807 The EC curve to use.
1809 .It Fl text
1810 Print the private/public key in plain text.
1812 .Sh GENRSA
1813 .nr nS 1
1814 .Nm "openssl genrsa"
1815 .Op Fl 3 | f4
1816 .Op Fl aes128 | aes192 | aes256 | des | des3
1817 .Op Fl out Ar file
1818 .Op Fl passout Ar arg
1819 .Op Ar numbits
1820 .nr nS 0
1823 .Nm genrsa
1824 command generates an RSA private key,
1825 which essentially involves the generation of two prime numbers.
1826 When generating the key,
1827 various symbols will be output to indicate the progress of the generation.
1829 .Sq \&.
1830 represents each number which has passed an initial sieve test;
1831 .Sq +
1832 means a number has passed a single round of the Miller-Rabin primality test.
1833 A newline means that the number has passed all the prime tests
1834 (the actual number depends on the key size).
1836 The options are as follows:
1837 .Bl -tag -width Ds
1838 .It Fl 3 | f4
1839 The public exponent to use, either 3 or 65537.
1840 The default is 65537.
1841 .It Fl aes128 | aes192 | aes256 | des | des3
1842 Encrypt the private key with the AES, DES,
1843 or the triple DES ciphers, respectively, before outputting it.
1844 If none of these options are specified, no encryption is used.
1845 If encryption is used, a pass phrase is prompted for,
1846 if it is not supplied via the
1847 .Fl passout
1848 option.
1849 .It Fl out Ar file
1850 The output file to write to,
1851 or standard output if not specified.
1852 .It Fl passout Ar arg
1853 The output file password source.
1854 .It Ar numbits
1855 The size of the private key to generate in bits.
1856 This must be the last option specified.
1857 The default is 2048.
1859 .Sh NSEQ
1860 .Nm openssl nseq
1861 .Op Fl in Ar file
1862 .Op Fl out Ar file
1863 .Op Fl toseq
1866 .Nm nseq
1867 command takes a file containing a Netscape certificate sequence
1868 (an alternative to the standard PKCS#7 format)
1869 and prints out the certificates contained in it,
1870 or takes a file of certificates
1871 and converts it into a Netscape certificate sequence.
1873 The options are as follows:
1874 .Bl -tag -width Ds
1875 .It Fl in Ar file
1876 The input file to read from,
1877 or standard input if not specified.
1878 .It Fl out Ar file
1879 The output file to write to,
1880 or standard output if not specified.
1881 .It Fl toseq
1882 Normally, a Netscape certificate sequence will be input and the output
1883 is the certificates contained in it.
1884 With the
1885 .Fl toseq
1886 option the situation is reversed:
1887 a Netscape certificate sequence is created from a file of certificates.
1889 .Sh OCSP
1890 .nr nS 1
1891 .Nm "openssl ocsp"
1892 .Op Fl CA Ar file
1893 .Op Fl CAfile Ar file
1894 .Op Fl CApath Ar directory
1895 .Op Fl cert Ar file
1896 .Op Fl dgst Ar alg
1897 .Op Fl host Ar hostname : Ns Ar port
1898 .Op Fl index Ar indexfile
1899 .Op Fl issuer Ar file
1900 .Op Fl ndays Ar days
1901 .Op Fl nmin Ar minutes
1902 .Op Fl no_cert_checks
1903 .Op Fl no_cert_verify
1904 .Op Fl no_certs
1905 .Op Fl no_chain
1906 .Op Fl no_intern
1907 .Op Fl no_nonce
1908 .Op Fl no_signature_verify
1909 .Op Fl nonce
1910 .Op Fl noverify
1911 .Op Fl nrequest Ar number
1912 .Op Fl out Ar file
1913 .Op Fl path Ar path
1914 .Op Fl port Ar portnum
1915 .Op Fl req_text
1916 .Op Fl reqin Ar file
1917 .Op Fl reqout Ar file
1918 .Op Fl resp_key_id
1919 .Op Fl resp_no_certs
1920 .Op Fl resp_text
1921 .Op Fl respin Ar file
1922 .Op Fl respout Ar file
1923 .Op Fl rkey Ar file
1924 .Op Fl rother Ar file
1925 .Op Fl rsigner Ar file
1926 .Op Fl serial Ar number
1927 .Op Fl sign_other Ar file
1928 .Op Fl signer Ar file
1929 .Op Fl signkey Ar file
1930 .Op Fl status_age Ar age
1931 .Op Fl text
1932 .Op Fl trust_other
1933 .Op Fl url Ar responder_url
1934 .Op Fl VAfile Ar file
1935 .Op Fl validity_period Ar nsec
1936 .Op Fl verify_other Ar file
1937 .nr nS 0
1939 The Online Certificate Status Protocol (OCSP)
1940 enables applications to determine the (revocation) state
1941 of an identified certificate (RFC 2560).
1944 .Nm ocsp
1945 command performs many common OCSP tasks.
1946 It can be used to print out requests and responses,
1947 create requests and send queries to an OCSP responder,
1948 and behave like a mini OCSP server itself.
1950 The options are as follows:
1951 .Bl -tag -width Ds
1952 .It Fl CAfile Ar file , Fl CApath Ar directory
1953 A file or path containing trusted CA certificates,
1954 used to verify the signature on the OCSP response.
1955 .It Fl cert Ar file
1956 Add the certificate
1957 .Ar file
1958 to the request.
1959 The issuer certificate is taken from the previous
1960 .Fl issuer
1961 option, or an error occurs if no issuer certificate is specified.
1962 .It Fl dgst Ar alg
1963 Use the digest algorithm
1964 .Ar alg
1965 for certificate identification in the OCSP request.
1966 By default SHA-1 is used.
1967 .It Xo
1968 .Fl host Ar hostname : Ns Ar port ,
1969 .Fl path Ar path
1971 Send
1972 the OCSP request to
1973 .Ar hostname
1975 .Ar port .
1976 .Fl path
1977 specifies the HTTP path name to use, or
1978 .Pa /
1979 by default.
1980 .It Fl issuer Ar file
1981 The current issuer certificate, in PEM format.
1982 Can be used multiple times and must come before any
1983 .Fl cert
1984 options.
1985 .It Fl no_cert_checks
1986 Don't perform any additional checks on the OCSP response signer's certificate.
1987 That is, do not make any checks to see if the signer's certificate is
1988 authorised to provide the necessary status information:
1989 as a result this option should only be used for testing purposes.
1990 .It Fl no_cert_verify
1991 Don't verify the OCSP response signer's certificate at all.
1992 Since this option allows the OCSP response to be signed by any certificate,
1993 it should only be used for testing purposes.
1994 .It Fl no_certs
1995 Don't include any certificates in the signed request.
1996 .It Fl no_chain
1997 Do not use certificates in the response as additional untrusted CA
1998 certificates.
1999 .It Fl no_intern
2000 Ignore certificates contained in the OCSP response
2001 when searching for the signer's certificate.
2002 The signer's certificate must be specified with either the
2003 .Fl verify_other
2005 .Fl VAfile
2006 options.
2007 .It Fl no_signature_verify
2008 Don't check the signature on the OCSP response.
2009 Since this option tolerates invalid signatures on OCSP responses,
2010 it will normally only be used for testing purposes.
2011 .It Fl nonce , no_nonce
2012 Add an OCSP nonce extension to a request,
2013 or disable an OCSP nonce addition.
2014 Normally, if an OCSP request is input using the
2015 .Fl respin
2016 option no nonce is added:
2017 using the
2018 .Fl nonce
2019 option will force the addition of a nonce.
2020 If an OCSP request is being created (using the
2021 .Fl cert
2023 .Fl serial
2024 options)
2025 a nonce is automatically added; specifying
2026 .Fl no_nonce
2027 overrides this.
2028 .It Fl noverify
2029 Don't attempt to verify the OCSP response signature or the nonce values.
2030 This is normally only be used for debugging
2031 since it disables all verification of the responder's certificate.
2032 .It Fl out Ar file
2033 Specify the output file to write to,
2034 or standard output if not specified.
2035 .It Fl req_text , resp_text , text
2036 Print out the text form of the OCSP request, response, or both, respectively.
2037 .It Fl reqin Ar file , Fl respin Ar file
2038 Read an OCSP request or response file from
2039 .Ar file .
2040 These options are ignored
2041 if an OCSP request or response creation is implied by other options
2042 (for example with the
2043 .Fl serial , cert ,
2045 .Fl host
2046 options).
2047 .It Fl reqout Ar file , Fl respout Ar file
2048 Write out the DER-encoded certificate request or response to
2049 .Ar file .
2050 .It Fl serial Ar num
2051 Same as the
2052 .Fl cert
2053 option except the certificate with serial number
2054 .Ar num
2055 is added to the request.
2056 The serial number is interpreted as a decimal integer unless preceded by
2057 .Sq 0x .
2058 Negative integers can also be specified
2059 by preceding the value with a minus sign.
2060 .It Fl sign_other Ar file
2061 Additional certificates to include in the signed request.
2062 .It Fl signer Ar file , Fl signkey Ar file
2063 Sign the OCSP request using the certificate specified in the
2064 .Fl signer
2065 option and the private key specified by the
2066 .Fl signkey
2067 option.
2068 If the
2069 .Fl signkey
2070 option is not present, then the private key is read from the same file
2071 as the certificate.
2072 If neither option is specified, the OCSP request is not signed.
2073 .It Fl trust_other
2074 The certificates specified by the
2075 .Fl verify_other
2076 option should be explicitly trusted and no additional checks will be
2077 performed on them.
2078 This is useful when the complete responder certificate chain is not available
2079 or trusting a root CA is not appropriate.
2080 .It Fl url Ar responder_url
2081 Specify the responder URL.
2082 Both HTTP and HTTPS
2083 .Pq SSL/TLS
2084 URLs can be specified.
2085 .It Fl VAfile Ar file
2086 A file containing explicitly trusted responder certificates.
2087 Equivalent to the
2088 .Fl verify_other
2090 .Fl trust_other
2091 options.
2092 .It Fl validity_period Ar nsec , Fl status_age Ar age
2093 The range of times, in seconds, which will be tolerated in an OCSP response.
2094 Each certificate status response includes a notBefore time
2095 and an optional notAfter time.
2096 The current time should fall between these two values,
2097 but the interval between the two times may be only a few seconds.
2098 In practice the OCSP responder and clients' clocks may not be precisely
2099 synchronised and so such a check may fail.
2100 To avoid this the
2101 .Fl validity_period
2102 option can be used to specify an acceptable error range in seconds,
2103 the default value being 5 minutes.
2105 If the notAfter time is omitted from a response,
2106 it means that new status information is immediately available.
2107 In this case the age of the notBefore field is checked
2108 to see it is not older than
2109 .Ar age
2110 seconds old.
2111 By default, this additional check is not performed.
2112 .It Fl verify_other Ar file
2113 A file containing additional certificates to search
2114 when attempting to locate the OCSP response signing certificate.
2115 Some responders omit the actual signer's certificate from the response,
2116 so this can be used to supply the necessary certificate.
2119 The options for the OCSP server are as follows:
2120 .Bl -tag -width "XXXX"
2121 .It Fl CA Ar file
2122 CA certificate corresponding to the revocation information in
2123 .Ar indexfile .
2124 .It Fl index Ar indexfile
2125 .Ar indexfile
2126 is a text index file in ca format
2127 containing certificate revocation information.
2129 If this option is specified,
2130 .Nm ocsp
2131 is in responder mode, otherwise it is in client mode.
2132 The requests the responder processes can be either specified on
2133 the command line (using the
2134 .Fl issuer
2136 .Fl serial
2137 options), supplied in a file (using the
2138 .Fl respin
2139 option), or via external OCSP clients (if
2140 .Ar port
2142 .Ar url
2143 is specified).
2145 If this option is present, then the
2146 .Fl CA
2148 .Fl rsigner
2149 options must also be present.
2150 .It Fl nmin Ar minutes , Fl ndays Ar days
2151 Number of
2152 .Ar minutes
2154 .Ar days
2155 when fresh revocation information is available:
2156 used in the nextUpdate field.
2157 If neither option is present,
2158 the nextUpdate field is omitted,
2159 meaning fresh revocation information is immediately available.
2160 .It Fl nrequest Ar number
2161 Exit after receiving
2162 .Ar number
2163 requests (the default is unlimited).
2164 .It Fl port Ar portnum
2165 Port to listen for OCSP requests on.
2166 May also be specified using the
2167 .Fl url
2168 option.
2169 .It Fl resp_key_id
2170 Identify the signer certificate using the key ID;
2171 the default is to use the subject name.
2172 .It Fl resp_no_certs
2173 Don't include any certificates in the OCSP response.
2174 .It Fl rkey Ar file
2175 The private key to sign OCSP responses with;
2176 if not present, the file specified in the
2177 .Fl rsigner
2178 option is used.
2179 .It Fl rother Ar file
2180 Additional certificates to include in the OCSP response.
2181 .It Fl rsigner Ar file
2182 The certificate to sign OCSP responses with.
2185 Initially the OCSP responder certificate is located and the signature on
2186 the OCSP request checked using the responder certificate's public key.
2187 Then a normal certificate verify is performed on the OCSP responder certificate
2188 building up a certificate chain in the process.
2189 The locations of the trusted certificates used to build the chain can be
2190 specified by the
2191 .Fl CAfile
2193 .Fl CApath
2194 options or they will be looked for in the standard
2195 .Nm openssl
2196 certificates directory.
2198 If the initial verify fails, the OCSP verify process halts with an error.
2199 Otherwise the issuing CA certificate in the request is compared to the OCSP
2200 responder certificate: if there is a match then the OCSP verify succeeds.
2202 Otherwise the OCSP responder certificate's CA is checked against the issuing
2203 CA certificate in the request.
2204 If there is a match and the OCSPSigning extended key usage is present
2205 in the OCSP responder certificate, then the OCSP verify succeeds.
2207 Otherwise the root CA of the OCSP responder's CA is checked to see if it
2208 is trusted for OCSP signing.
2209 If it is, the OCSP verify succeeds.
2211 If none of these checks is successful, the OCSP verify fails.
2212 What this effectively means is that if the OCSP responder certificate is
2213 authorised directly by the CA it is issuing revocation information about
2214 (and it is correctly configured),
2215 then verification will succeed.
2217 If the OCSP responder is a global responder,
2218 which can give details about multiple CAs
2219 and has its own separate certificate chain,
2220 then its root CA can be trusted for OCSP signing.
2221 Alternatively, the responder certificate itself can be explicitly trusted
2222 with the
2223 .Fl VAfile
2224 option.
2225 .Sh PASSWD
2226 .nr nS 1
2227 .Nm "openssl passwd"
2228 .Op Fl 1 | apr1 | crypt
2229 .Op Fl in Ar file
2230 .Op Fl noverify
2231 .Op Fl quiet
2232 .Op Fl reverse
2233 .Op Fl salt Ar string
2234 .Op Fl stdin
2235 .Op Fl table
2236 .Op Ar password
2237 .nr nS 0
2240 .Nm passwd
2241 command computes the hash of a password.
2243 The options are as follows:
2244 .Bl -tag -width Ds
2245 .It Fl 1
2246 Use the MD5 based
2248 password algorithm
2249 .Qq 1 .
2250 .It Fl apr1
2251 Use the
2252 .Qq apr1
2253 algorithm
2255 Apache variant of the
2257 algorithm
2258 .Pc .
2259 .It Fl crypt
2260 Use the
2261 .Qq crypt
2262 algorithm (the default).
2263 .It Fl in Ar file
2264 Read passwords from
2265 .Ar file .
2266 .It Fl noverify
2267 Don't verify when reading a password from the terminal.
2268 .It Fl quiet
2269 Don't output warnings when passwords given on the command line are truncated.
2270 .It Fl reverse
2271 Switch table columns.
2272 This only makes sense in conjunction with the
2273 .Fl table
2274 option.
2275 .It Fl salt Ar string
2276 Use the salt specified by
2277 .Ar string .
2278 When reading a password from the terminal, this implies
2279 .Fl noverify .
2280 .It Fl stdin
2281 Read passwords from standard input.
2282 .It Fl table
2283 In the output list, prepend the cleartext password and a TAB character
2284 to each password hash.
2286 .Sh PKCS7
2287 .nr nS 1
2288 .Nm "openssl pkcs7"
2289 .Op Fl in Ar file
2290 .Op Fl inform Cm der | pem
2291 .Op Fl noout
2292 .Op Fl out Ar file
2293 .Op Fl outform Cm der | pem
2294 .Op Fl print_certs
2295 .Op Fl text
2296 .nr nS 0
2299 .Nm pkcs7
2300 command processes PKCS#7 files in DER or PEM format.
2301 The PKCS#7 routines only understand PKCS#7 v 1.5 as specified in RFC 2315.
2303 The options are as follows:
2304 .Bl -tag -width Ds
2305 .It Fl in Ar file
2306 The input file to read from,
2307 or standard input if not specified.
2308 .It Fl inform Cm der | pem
2309 The input format.
2310 .It Fl noout
2311 Don't output the encoded version of the PKCS#7 structure
2312 (or certificates if
2313 .Fl print_certs
2314 is set).
2315 .It Fl out Ar file
2316 The output to write to,
2317 or standard output if not specified.
2318 .It Fl outform Cm der | pem
2319 The output format.
2320 .It Fl print_certs
2321 Print any certificates or CRLs contained in the file,
2322 preceded by their subject and issuer names in a one-line format.
2323 .It Fl text
2324 Print certificate details in full rather than just subject and issuer names.
2326 .Sh PKCS8
2327 .nr nS 1
2328 .Nm "openssl pkcs8"
2329 .Op Fl in Ar file
2330 .Op Fl inform Cm der | pem
2331 .Op Fl nocrypt
2332 .Op Fl noiter
2333 .Op Fl out Ar file
2334 .Op Fl outform Cm der | pem
2335 .Op Fl passin Ar arg
2336 .Op Fl passout Ar arg
2337 .Op Fl topk8
2338 .Op Fl v1 Ar alg
2339 .Op Fl v2 Ar alg
2340 .nr nS 0
2343 .Nm pkcs8
2344 command processes private keys
2345 (both encrypted and unencrypted)
2346 in PKCS#8 format
2347 with a variety of PKCS#5 (v1.5 and v2.0) and PKCS#12 algorithms.
2348 The default encryption is only 56 bits;
2349 keys encrypted using PKCS#5 v2.0 algorithms and high iteration counts
2350 are more secure.
2352 The options are as follows:
2353 .Bl -tag -width Ds
2354 .It Fl in Ar file
2355 The input file to read from,
2356 or standard input if not specified.
2357 If the key is encrypted, a pass phrase will be prompted for.
2358 .It Fl inform Cm der | pem
2359 The input format.
2360 .It Fl nocrypt
2361 Generate an unencrypted PrivateKeyInfo structure.
2362 This option does not encrypt private keys at all
2363 and should only be used when absolutely necessary.
2364 .It Fl noiter
2365 Use an iteration count of 1.
2366 See the
2367 .Sx PKCS12
2368 section below for a detailed explanation of this option.
2369 .It Fl out Ar file
2370 The output file to write to,
2371 or standard output if none is specified.
2372 If any encryption options are set, a pass phrase will be prompted for.
2373 .It Fl outform Cm der | pem
2374 The output format.
2375 .It Fl passin Ar arg
2376 The key password source.
2377 .It Fl passout Ar arg
2378 The output file password source.
2379 .It Fl topk8
2380 Read a traditional format private key and write a PKCS#8 format key.
2381 .It Fl v1 Ar alg
2382 Specify a PKCS#5 v1.5 or PKCS#12 algorithm to use.
2384 .Bl -tag -width "XXXX" -compact
2385 .It PBE-MD5-DES
2386 56-bit DES.
2387 .It PBE-SHA1-RC2-64 | PBE-MD5-RC2-64 | PBE-SHA1-DES
2388 64-bit RC2 or 56-bit DES.
2389 .It PBE-SHA1-RC4-128 | PBE-SHA1-RC4-40 | PBE-SHA1-3DES
2390 .It PBE-SHA1-2DES | PBE-SHA1-RC2-128 | PBE-SHA1-RC2-40
2391 PKCS#12 password-based encryption algorithm,
2392 which allow strong encryption algorithms like triple DES or 128-bit RC2.
2394 .It Fl v2 Ar alg
2395 Use PKCS#5 v2.0 algorithms.
2396 Supports algorithms such as 168-bit triple DES or 128-bit RC2,
2397 however not many implementations support PKCS#5 v2.0 yet
2398 (if using private keys with
2399 .Nm openssl
2400 this doesn't matter).
2402 .Ar alg
2403 is the encryption algorithm to use;
2404 valid values include des, des3, and rc2.
2405 It is recommended that des3 is used.
2407 .Sh PKCS12
2408 .nr nS 1
2409 .Nm "openssl pkcs12"
2410 .Op Fl aes128 | aes192 | aes256 | des | des3
2411 .Op Fl cacerts
2412 .Op Fl CAfile Ar file
2413 .Op Fl caname Ar name
2414 .Op Fl CApath Ar directory
2415 .Op Fl certfile Ar file
2416 .Op Fl certpbe Ar alg
2417 .Op Fl chain
2418 .Op Fl clcerts
2419 .Op Fl CSP Ar name
2420 .Op Fl descert
2421 .Op Fl export
2422 .Op Fl in Ar file
2423 .Op Fl info
2424 .Op Fl inkey Ar file
2425 .Op Fl keyex
2426 .Op Fl keypbe Ar alg
2427 .Op Fl keysig
2428 .Op Fl macalg Ar alg
2429 .Op Fl maciter
2430 .Op Fl name Ar name
2431 .Op Fl nocerts
2432 .Op Fl nodes
2433 .Op Fl noiter
2434 .Op Fl nokeys
2435 .Op Fl nomac
2436 .Op Fl nomaciter
2437 .Op Fl nomacver
2438 .Op Fl noout
2439 .Op Fl out Ar file
2440 .Op Fl passin Ar arg
2441 .Op Fl passout Ar arg
2442 .Op Fl twopass
2443 .nr nS 0
2446 .Nm pkcs12
2447 command allows PKCS#12 files
2448 .Pq sometimes referred to as PFX files
2449 to be created and parsed.
2450 By default, a PKCS#12 file is parsed;
2451 a PKCS#12 file can be created by using the
2452 .Fl export
2453 option.
2455 The options for parsing a PKCS12 file are as follows:
2456 .Bl -tag -width "XXXX"
2457 .It Fl aes128 | aes192 | aes256 | des | des3
2458 Encrypt private keys
2459 using AES, DES, or triple DES, respectively.
2460 The default is triple DES.
2461 .It Fl cacerts
2462 Only output CA certificates
2463 .Pq not client certificates .
2464 .It Fl clcerts
2465 Only output client certificates
2466 .Pq not CA certificates .
2467 .It Fl in Ar file
2468 The input file to read from,
2469 or standard input if not specified.
2470 .It Fl info
2471 Output additional information about the PKCS#12 file structure,
2472 algorithms used, and iteration counts.
2473 .It Fl nocerts
2474 Do not output certificates.
2475 .It Fl nodes
2476 Do not encrypt private keys.
2477 .It Fl nokeys
2478 Do not output private keys.
2479 .It Fl nomacver
2480 Do not attempt to verify the integrity MAC before reading the file.
2481 .It Fl noout
2482 Do not output the keys and certificates to the output file
2483 version of the PKCS#12 file.
2484 .It Fl out Ar file
2485 The output file to write to,
2486 or standard output if not specified.
2487 .It Fl passin Ar arg
2488 The key password source.
2489 .It Fl passout Ar arg
2490 The output file password source.
2491 .It Fl twopass
2492 Prompt for separate integrity and encryption passwords: most software
2493 always assumes these are the same so this option will render such
2494 PKCS#12 files unreadable.
2497 The options for PKCS12 file creation are as follows:
2498 .Bl -tag -width "XXXX"
2499 .It Fl CAfile Ar file
2500 CA storage as a file.
2501 .It Fl CApath Ar directory
2502 CA storage as a directory.
2503 The directory must be a standard certificate directory:
2504 that is, a hash of each subject name (using
2505 .Nm x509 Fl hash )
2506 should be linked to each certificate.
2507 .It Fl caname Ar name
2508 Specify the
2509 .Qq friendly name
2510 for other certificates.
2511 May be used multiple times to specify names for all certificates
2512 in the order they appear.
2513 .It Fl certfile Ar file
2514 A file to read additional certificates from.
2515 .It Fl certpbe Ar alg , Fl keypbe Ar alg
2516 Specify the algorithm used to encrypt the private key and
2517 certificates to be selected.
2518 Any PKCS#5 v1.5 or PKCS#12 PBE algorithm name can be used.
2519 If a cipher name
2520 (as output by the
2521 .Cm list-cipher-algorithms
2522 command) is specified then it
2523 is used with PKCS#5 v2.0.
2524 For interoperability reasons it is advisable to only use PKCS#12 algorithms.
2525 .It Fl chain
2526 Include the entire certificate chain of the user certificate.
2527 The standard CA store is used for this search.
2528 If the search fails, it is considered a fatal error.
2529 .It Fl CSP Ar name
2530 Write
2531 .Ar name
2532 as a Microsoft CSP name.
2533 .It Fl descert
2534 Encrypt the certificate using triple DES; this may render the PKCS#12
2535 file unreadable by some
2536 .Qq export grade
2537 software.
2538 By default, the private key is encrypted using triple DES and the
2539 certificate using 40-bit RC2.
2540 .It Fl export
2541 Create a PKCS#12 file (rather than parsing one).
2542 .It Fl in Ar file
2543 The input file to read from,
2544 or standard input if not specified.
2545 The order doesn't matter but one private key and its corresponding
2546 certificate should be present.
2547 If additional certificates are present, they will also be included
2548 in the PKCS#12 file.
2549 .It Fl inkey Ar file
2550 File to read a private key from.
2551 If not present, a private key must be present in the input file.
2552 .It Fl keyex | keysig
2553 Specify whether the private key is to be used for key exchange or just signing.
2554 Normally,
2555 .Qq export grade
2556 software will only allow 512-bit RSA keys to be
2557 used for encryption purposes, but arbitrary length keys for signing.
2559 .Fl keysig
2560 option marks the key for signing only.
2561 Signing only keys can be used for S/MIME signing, authenticode
2562 (ActiveX control signing)
2563 and SSL client authentication.
2564 .It Fl macalg Ar alg
2565 Specify the MAC digest algorithm.
2566 The default is SHA1.
2567 .It Fl maciter
2568 Included for compatibility only:
2569 it used to be needed to use MAC iterations counts
2570 but they are now used by default.
2571 .It Fl name Ar name
2572 Specify the
2573 .Qq friendly name
2574 for the certificate and private key.
2575 This name is typically displayed in list boxes by software importing the file.
2576 .It Fl nomac
2577 Don't attempt to provide the MAC integrity.
2578 .It Fl nomaciter , noiter
2579 Affect the iteration counts on the MAC and key algorithms.
2581 To discourage attacks by using large dictionaries of common passwords,
2582 the algorithm that derives keys from passwords can have an iteration count
2583 applied to it: this causes a certain part of the algorithm to be repeated
2584 and slows it down.
2585 The MAC is used to check the file integrity but since it will normally
2586 have the same password as the keys and certificates it could also be attacked.
2587 By default, both MAC and encryption iteration counts are set to 2048;
2588 using these options the MAC and encryption iteration counts can be set to 1.
2589 Since this reduces the file security you should not use these options
2590 unless you really have to.
2591 Most software supports both MAC and key iteration counts.
2592 .It Fl out Ar file
2593 The output file to write to,
2594 or standard output if not specified.
2595 .It Fl passin Ar arg
2596 The key password source.
2597 .It Fl passout Ar arg
2598 The output file password source.
2600 .Sh PKEY
2601 .nr nS 1
2602 .Nm "openssl pkey"
2603 .Op Ar cipher
2604 .Op Fl in Ar file
2605 .Op Fl inform Cm der | pem
2606 .Op Fl noout
2607 .Op Fl out Ar file
2608 .Op Fl outform Cm der | pem
2609 .Op Fl passin Ar arg
2610 .Op Fl passout Ar arg
2611 .Op Fl pubin
2612 .Op Fl pubout
2613 .Op Fl text
2614 .Op Fl text_pub
2615 .nr nS 0
2618 .Nm pkey
2619 command processes public or private keys.
2620 They can be converted between various forms
2621 and their components printed out.
2623 The options are as follows:
2624 .Bl -tag -width Ds
2625 .It Ar cipher
2626 Encrypt the private key with the specified cipher.
2627 Any algorithm name accepted by
2628 .Xr EVP_get_cipherbyname 3
2629 is acceptable, such as
2630 .Cm des3 .
2631 .It Fl in Ar file
2632 The input file to read from,
2633 or standard input if not specified.
2634 If the key is encrypted a pass phrase will be prompted for.
2635 .It Fl inform Cm der | pem
2636 The input format.
2637 .It Fl noout
2638 Do not output the encoded version of the key.
2639 .It Fl out Ar file
2640 The output file to write to,
2641 or standard output if not specified.
2642 If any encryption options are set then a pass phrase
2643 will be prompted for.
2644 .It Fl outform Cm der | pem
2645 The output format.
2646 .It Fl passin Ar arg
2647 The key password source.
2648 .It Fl passout Ar arg
2649 The output file password source.
2650 .It Fl pubin
2651 Read in a public key, not a private key.
2652 .It Fl pubout
2653 Output a public key, not a private key.
2654 Automatically set if the input is a public key.
2655 .It Fl text
2656 Print the public/private key in plain text.
2657 .It Fl text_pub
2658 Print out only public key components
2659 even if a private key is being processed.
2661 .Sh PKEYPARAM
2662 .Cm openssl pkeyparam
2663 .Op Fl in Ar file
2664 .Op Fl noout
2665 .Op Fl out Ar file
2666 .Op Fl text
2669 .Nm pkeyparam
2670 command processes public or private keys.
2671 The key type is determined by the PEM headers.
2673 The options are as follows:
2674 .Bl -tag -width Ds
2675 .It Fl in Ar file
2676 The input file to read from,
2677 or standard input if not specified.
2678 .It Fl noout
2679 Do not output the encoded version of the parameters.
2680 .It Fl out Ar file
2681 The output file to write to,
2682 or standard output if not specified.
2683 .It Fl text
2684 Print the parameters in plain text.
2686 .Sh PKEYUTL
2687 .nr nS 1
2688 .Nm "openssl pkeyutl"
2689 .Op Fl asn1parse
2690 .Op Fl certin
2691 .Op Fl decrypt
2692 .Op Fl derive
2693 .Op Fl encrypt
2694 .Op Fl hexdump
2695 .Op Fl in Ar file
2696 .Op Fl inkey Ar file
2697 .Op Fl keyform Cm der | pem
2698 .Op Fl out Ar file
2699 .Op Fl passin Ar arg
2700 .Op Fl peerform Cm der | pem
2701 .Op Fl peerkey Ar file
2702 .Op Fl pkeyopt Ar opt : Ns Ar value
2703 .Op Fl pubin
2704 .Op Fl rev
2705 .Op Fl sigfile Ar file
2706 .Op Fl sign
2707 .Op Fl verify
2708 .Op Fl verifyrecover
2709 .nr nS 0
2712 .Nm pkeyutl
2713 command can be used to perform public key operations using
2714 any supported algorithm.
2716 The options are as follows:
2717 .Bl -tag -width Ds
2718 .It Fl asn1parse
2719 ASN.1 parse the output data.
2720 This is useful when combined with the
2721 .Fl verifyrecover
2722 option when an ASN.1 structure is signed.
2723 .It Fl certin
2724 The input is a certificate containing a public key.
2725 .It Fl decrypt
2726 Decrypt the input data using a private key.
2727 .It Fl derive
2728 Derive a shared secret using the peer key.
2729 .It Fl encrypt
2730 Encrypt the input data using a public key.
2731 .It Fl hexdump
2732 Hex dump the output data.
2733 .It Fl in Ar file
2734 The input file to read from,
2735 or standard input if not specified.
2736 .It Fl inkey Ar file
2737 The input key file.
2738 By default it should be a private key.
2739 .It Fl keyform Cm der | pem
2740 The key format.
2741 .It Fl out Ar file
2742 The output file to write to,
2743 or standard output if not specified.
2744 .It Fl passin Ar arg
2745 The key password source.
2746 .It Fl peerform Cm der | pem
2747 The peer key format.
2748 .It Fl peerkey Ar file
2749 The peer key file, used by key derivation (agreement) operations.
2750 .It Fl pkeyopt Ar opt : Ns Ar value
2751 Set the public key algorithm option
2752 .Ar opt
2754 .Ar value .
2755 Unless otherwise mentioned, all algorithms support the format
2756 .Ar digest : Ns Ar alg ,
2757 which specifies the digest to use
2758 for sign, verify, and verifyrecover operations.
2759 The value
2760 .Ar alg
2761 should represent a digest name as used in the
2762 .Xr EVP_get_digestbyname 3
2763 function.
2765 The RSA algorithm supports the
2766 encrypt, decrypt, sign, verify, and verifyrecover operations in general.
2767 Some padding modes only support some of these
2768 operations however.
2769 .Bl -tag -width Ds
2770 .It rsa_padding_mode : Ns Ar mode
2771 This sets the RSA padding mode.
2772 Acceptable values for
2773 .Ar mode
2775 .Cm pkcs1
2776 for PKCS#1 padding;
2777 .Cm none
2778 for no padding;
2779 .Cm oaep
2780 for OAEP mode;
2781 .Cm x931
2782 for X9.31 mode;
2784 .Cm pss
2785 for PSS.
2787 In PKCS#1 padding if the message digest is not set then the supplied data is
2788 signed or verified directly instead of using a DigestInfo structure.
2789 If a digest is set then a DigestInfo
2790 structure is used and its length
2791 must correspond to the digest type.
2792 For oeap mode only encryption and decryption is supported.
2793 For x931 if the digest type is set it is used to format the block data;
2794 otherwise the first byte is used to specify the X9.31 digest ID.
2795 Sign, verify, and verifyrecover can be performed in this mode.
2796 For pss mode only sign and verify are supported and the digest type must be
2797 specified.
2798 .It rsa_pss_saltlen : Ns Ar len
2799 For pss
2800 mode only this option specifies the salt length.
2801 Two special values are supported:
2802 -1 sets the salt length to the digest length.
2803 When signing -2 sets the salt length to the maximum permissible value.
2804 When verifying -2 causes the salt length to be automatically determined
2805 based on the PSS block structure.
2808 The DSA algorithm supports the sign and verify operations.
2809 Currently there are no additional options other than
2810 .Ar digest .
2811 Only the SHA1 digest can be used and this digest is assumed by default.
2813 The DH algorithm supports the derive operation
2814 and no additional options.
2816 The EC algorithm supports the sign, verify, and derive operations.
2817 The sign and verify operations use ECDSA and derive uses ECDH.
2818 Currently there are no additional options other than
2819 .Ar digest .
2820 Only the SHA1 digest can be used and this digest is assumed by default.
2821 .It Fl pubin
2822 The input file is a public key.
2823 .It Fl rev
2824 Reverse the order of the input buffer.
2825 .It Fl sigfile Ar file
2826 Signature file (verify operation only).
2827 .It Fl sign
2828 Sign the input data and output the signed result.
2829 This requires a private key.
2830 .It Fl verify
2831 Verify the input data against the signature file and indicate if the
2832 verification succeeded or failed.
2833 .It Fl verifyrecover
2834 Verify the input data and output the recovered data.
2836 .Sh PRIME
2837 .Cm openssl prime
2838 .Op Fl bits Ar n
2839 .Op Fl checks Ar n
2840 .Op Fl generate
2841 .Op Fl hex
2842 .Op Fl safe
2843 .Ar p
2846 .Nm prime
2847 command is used to generate prime numbers,
2848 or to check numbers for primality.
2849 Results are probabilistic:
2850 they have an exceedingly high likelihood of being correct,
2851 but are not guaranteed.
2853 The options are as follows:
2854 .Bl -tag -width Ds
2855 .It Fl bits Ar n
2856 Specify the number of bits in the generated prime number.
2857 Must be used in conjunction with
2858 .Fl generate .
2859 .It Fl checks Ar n
2860 Perform a Miller-Rabin probabilistic primality test with
2861 .Ar n
2862 iterations.
2863 The default is 20.
2864 .It Fl generate
2865 Generate a pseudo-random prime number.
2866 Must be used in conjunction with
2867 .Fl bits .
2868 .It Fl hex
2869 Output in hex format.
2870 .It Fl safe
2871 Generate only
2872 .Qq safe
2873 prime numbers
2874 (i.e. a prime p so that (p-1)/2 is also prime).
2875 .It Ar p
2876 Test if number
2877 .Ar p
2878 is prime.
2880 .Sh RAND
2881 .nr nS 1
2882 .Nm "openssl rand"
2883 .Op Fl base64
2884 .Op Fl hex
2885 .Op Fl out Ar file
2886 .Ar num
2887 .nr nS 0
2890 .Nm rand
2891 command outputs
2892 .Ar num
2893 pseudo-random bytes.
2895 The options are as follows:
2896 .Bl -tag -width Ds
2897 .It Fl base64
2898 Perform base64 encoding on the output.
2899 .It Fl hex
2900 Specify hexadecimal output.
2901 .It Fl out Ar file
2902 The output file to write to,
2903 or standard output if not specified.
2905 .Sh REQ
2906 .nr nS 1
2907 .Nm "openssl req"
2908 .Op Fl asn1-kludge
2909 .Op Fl batch
2910 .Op Fl config Ar file
2911 .Op Fl days Ar n
2912 .Op Fl extensions Ar section
2913 .Op Fl in Ar file
2914 .Op Fl inform Cm der | pem
2915 .Op Fl key Ar keyfile
2916 .Op Fl keyform Cm der | pem
2917 .Op Fl keyout Ar file
2918 .Op Fl md4 | md5 | sha1
2919 .Op Fl modulus
2920 .Op Fl nameopt Ar option
2921 .Op Fl new
2922 .Op Fl newhdr
2923 .Op Fl newkey Ar arg
2924 .Op Fl no-asn1-kludge
2925 .Op Fl nodes
2926 .Op Fl noout
2927 .Op Fl out Ar file
2928 .Op Fl outform Cm der | pem
2929 .Op Fl passin Ar arg
2930 .Op Fl passout Ar arg
2931 .Op Fl pubkey
2932 .Op Fl reqexts Ar section
2933 .Op Fl reqopt Ar option
2934 .Op Fl set_serial Ar n
2935 .Op Fl subj Ar arg
2936 .Op Fl subject
2937 .Op Fl text
2938 .Op Fl utf8
2939 .Op Fl verbose
2940 .Op Fl verify
2941 .Op Fl x509
2942 .nr nS 0
2945 .Nm req
2946 command primarily creates and processes certificate requests
2947 in PKCS#10 format.
2948 It can additionally create self-signed certificates,
2949 for use as root CAs, for example.
2951 The options are as follows:
2952 .Bl -tag -width Ds
2953 .It Fl asn1-kludge
2954 Produce requests in an invalid format for certain picky CAs.
2955 Very few CAs still require the use of this option.
2956 .It Fl batch
2957 Non-interactive mode.
2958 .It Fl config Ar file
2959 Specify an alternative configuration file.
2960 .It Fl days Ar n
2961 Specify the number of days to certify the certificate for.
2962 The default is 30 days.
2963 Used with the
2964 .Fl x509
2965 option.
2966 .It Fl extensions Ar section , Fl reqexts Ar section
2967 Specify alternative sections to include certificate
2968 extensions (with
2969 .Fl x509 )
2970 or certificate request extensions,
2971 allowing several different sections to be used in the same configuration file.
2972 .It Fl in Ar file
2973 The input file to read a request from,
2974 or standard input if not specified.
2975 A request is only read if the creation options
2976 .Fl new
2978 .Fl newkey
2979 are not specified.
2980 .It Fl inform Cm der | pem
2981 The input format.
2982 .It Fl key Ar keyfile
2983 The file to read the private key from.
2984 It also accepts PKCS#8 format private keys for PEM format files.
2985 .It Fl keyform Cm der | pem
2986 The format of the private key file specified in the
2987 .Fl key
2988 argument.
2989 The default is
2990 .Cm pem .
2991 .It Fl keyout Ar file
2992 The file to write the newly created private key to.
2993 If this option is not specified,
2994 the filename present in the configuration file is used.
2995 .It Fl md5 | sha1 | sha256
2996 The message digest to sign the request with.
2997 This overrides the digest algorithm specified in the configuration file.
2999 Some public key algorithms may override this choice.
3000 For instance, DSA signatures always use SHA1.
3001 .It Fl modulus
3002 Print the value of the modulus of the public key contained in the request.
3003 .It Fl nameopt Ar option , Fl reqopt Ar option
3004 Determine how the subject or issuer names are displayed.
3005 .Ar option
3006 can be a single option or multiple options separated by commas.
3007 Alternatively, these options may be used more than once to set multiple options.
3008 See the
3009 .Sx X509
3010 section below for details.
3011 .It Fl new
3012 Generate a new certificate request.
3013 The user is prompted for the relevant field values.
3014 The actual fields prompted for and their maximum and minimum sizes
3015 are specified in the configuration file and any requested extensions.
3017 If the
3018 .Fl key
3019 option is not used, it will generate a new RSA private
3020 key using information specified in the configuration file.
3021 .It Fl newhdr
3022 Add the word NEW to the PEM file header and footer lines
3023 on the outputed request.
3024 Some software and CAs need this.
3025 .It Fl newkey Ar arg
3026 Create a new certificate request and a new private key.
3027 The argument takes one of several forms.
3029 .No rsa : Ns Ar nbits
3030 generates an RSA key
3031 .Ar nbits
3032 in size.
3034 .Ar nbits
3035 is omitted
3036 the default key size is used.
3038 .No dsa : Ns Ar file
3039 generates a DSA key using the parameters in
3040 .Ar file .
3042 .No param : Ns Ar file
3043 generates a key using the parameters or certificate in
3044 .Ar file .
3046 All other algorithms support the form
3047 .Ar algorithm : Ns Ar file ,
3048 where file may be an algorithm parameter file,
3049 created by the
3050 .Cm genpkey -genparam
3051 command or an X.509 certificate for a key with appropriate algorithm.
3052 .Ar file
3053 can be omitted,
3054 in which case any parameters can be specified via the
3055 .Fl pkeyopt
3056 option.
3057 .It Fl no-asn1-kludge
3058 Reverse the effect of
3059 .Fl asn1-kludge .
3060 .It Fl nodes
3061 Do not encrypt the private key.
3062 .It Fl noout
3063 Do not output the encoded version of the request.
3064 .It Fl out Ar file
3065 The output file to write to,
3066 or standard output if not spceified.
3067 .It Fl outform Cm der | pem
3068 The output format.
3069 .It Fl passin Ar arg
3070 The key password source.
3071 .It Fl passout Ar arg
3072 The output file password source.
3073 .It Fl pubkey
3074 Output the public key.
3075 .It Fl reqopt Ar option
3076 Customise the output format used with
3077 .Fl text .
3079 .Ar option
3080 argument can be a single option or multiple options separated by commas.
3081 See also the discussion of
3082 .Fl certopt
3083 in the
3084 .Nm x509
3085 command.
3086 .It Fl set_serial Ar n
3087 Serial number to use when outputting a self-signed certificate.
3088 This may be specified as a decimal value or a hex value if preceded by
3089 .Sq 0x .
3090 It is possible to use negative serial numbers but this is not recommended.
3091 .It Fl subj Ar arg
3092 Replaces the subject field of an input request
3093 with the specified data and output the modified request.
3094 .Ar arg
3095 must be formatted as /type0=value0/type1=value1/type2=...;
3096 characters may be escaped by
3097 .Sq \e
3098 (backslash);
3099 no spaces are skipped.
3100 .It Fl subject
3101 Print the request subject (or certificate subject if
3102 .Fl x509
3103 is specified).
3104 .It Fl text
3105 Print the certificate request in plain text.
3106 .It Fl utf8
3107 Interpret field values as UTF8 strings, not ASCII.
3108 .It Fl verbose
3109 Print extra details about the operations being performed.
3110 .It Fl verify
3111 Verify the signature on the request.
3112 .It Fl x509
3113 Output a self-signed certificate instead of a certificate request.
3114 This is typically used to generate a test certificate or a self-signed root CA.
3115 The extensions added to the certificate (if any)
3116 are specified in the configuration file.
3117 Unless specified using the
3118 .Fl set_serial
3119 option, 0 is used for the serial number.
3122 The configuration options are specified in the
3123 .Qq req
3124 section of the configuration file.
3125 The options available are as follows:
3126 .Bl -tag -width "XXXX"
3127 .It Cm attributes
3128 The section containing any request attributes: its format
3129 is the same as
3130 .Cm distinguished_name .
3131 Typically these may contain the challengePassword or unstructuredName types.
3132 They are currently ignored by the
3133 .Nm openssl
3134 request signing utilities, but some CAs might want them.
3135 .It Cm default_bits
3136 The default key size, in bits.
3137 The default is 2048.
3138 It is used if the
3139 .Fl new
3140 option is used and can be overridden by using the
3141 .Fl newkey
3142 option.
3143 .It Cm default_keyfile
3144 The default file to write a private key to,
3145 or standard output if not specified.
3146 It can be overridden by the
3147 .Fl keyout
3148 option.
3149 .It Cm default_md
3150 The digest algorithm to use.
3151 Possible values include
3152 .Cm md5 ,
3153 .Cm sha1
3155 .Cm sha256
3156 (the default).
3157 It can be overridden on the command line.
3158 .It Cm distinguished_name
3159 The section containing the distinguished name fields to
3160 prompt for when generating a certificate or certificate request.
3161 The format is described below.
3162 .It Cm encrypt_key
3163 If set to
3164 .Qq no
3165 and a private key is generated, it is not encrypted.
3166 It is equivalent to the
3167 .Fl nodes
3168 option.
3169 For compatibility,
3170 .Cm encrypt_rsa_key
3171 is an equivalent option.
3172 .It Cm input_password | output_password
3173 The passwords for the input private key file (if present)
3174 and the output private key file (if one will be created).
3175 The command line options
3176 .Fl passin
3178 .Fl passout
3179 override the configuration file values.
3180 .It Cm oid_file
3181 A file containing additional OBJECT IDENTIFIERS.
3182 Each line of the file should consist of the numerical form of the
3183 object identifier, followed by whitespace, then the short name followed
3184 by whitespace and finally the long name.
3185 .It Cm oid_section
3186 Specify a section in the configuration file containing extra
3187 object identifiers.
3188 Each line should consist of the short name of the
3189 object identifier followed by
3190 .Sq =
3191 and the numerical form.
3192 The short and long names are the same when this option is used.
3193 .It Cm prompt
3194 If set to
3195 .Qq no ,
3196 it disables prompting of certificate fields
3197 and just takes values from the config file directly.
3198 It also changes the expected format of the
3199 .Cm distinguished_name
3201 .Cm attributes
3202 sections.
3203 .It Cm req_extensions
3204 The configuration file section containing a list of
3205 extensions to add to the certificate request.
3206 It can be overridden by the
3207 .Fl reqexts
3208 option.
3209 .It Cm string_mask
3210 Limit the string types for encoding certain fields.
3211 The following values may be used, limiting strings to the indicated types:
3212 .Bl -tag -width "MASK:number"
3213 .It Cm utf8only
3214 UTF8String.
3215 This is the default, as recommended by PKIX in RFC 2459.
3216 .It Cm default
3217 PrintableString, IA5String, T61String, BMPString, UTF8String.
3218 .It Cm pkix
3219 PrintableString, IA5String, BMPString, UTF8String.
3220 Inspired by the PKIX recommendation in RFC 2459 for certificates
3221 generated before 2004, but differs by also permitting IA5String.
3222 .It Cm nombstr
3223 PrintableString, IA5String, T61String, UniversalString.
3224 A workaround for some ancient software that had problems
3225 with the variable-sized BMPString and UTF8String types.
3226 .It Cm MASK : Ns Ar number
3227 An explicit bitmask of permitted types, where
3228 .Ar number
3229 is a C-style hex, decimal, or octal number that's a bit-wise OR of
3230 .Dv B_ASN1_*
3231 values from
3232 .In openssl/asn1.h .
3234 .It Cm utf8
3235 If set to
3236 .Qq yes ,
3237 field values are interpreted as UTF8 strings.
3238 .It Cm x509_extensions
3239 The configuration file section containing a list of
3240 extensions to add to a certificate generated when the
3241 .Fl x509
3242 switch is used.
3243 It can be overridden by the
3244 .Fl extensions
3245 command line switch.
3248 There are two separate formats for the distinguished name and attribute
3249 sections.
3250 If the
3251 .Fl prompt
3252 option is set to
3253 .Qq no ,
3254 then these sections just consist of field names and values.
3255 If the
3256 .Fl prompt
3257 option is absent or not set to
3258 .Qq no ,
3259 then the file contains field prompting information of the form:
3260 .Bd -unfilled -offset indent
3261 fieldName="prompt"
3262 fieldName_default="default field value"
3263 fieldName_min= 2
3264 fieldName_max= 4
3267 .Qq fieldName
3268 is the field name being used, for example
3269 .Cm commonName
3270 (or CN).
3272 .Qq prompt
3273 string is used to ask the user to enter the relevant details.
3274 If the user enters nothing, the default value is used;
3275 if no default value is present, the field is omitted.
3276 A field can still be omitted if a default value is present,
3277 if the user just enters the
3278 .Sq \&.
3279 character.
3281 The number of characters entered must be between the
3282 fieldName_min and fieldName_max limits:
3283 there may be additional restrictions based on the field being used
3284 (for example
3285 .Cm countryName
3286 can only ever be two characters long and must fit in a
3287 .Cm PrintableString ) .
3289 Some fields (such as
3290 .Cm organizationName )
3291 can be used more than once in a DN.
3292 This presents a problem because configuration files will
3293 not recognize the same name occurring twice.
3294 To avoid this problem, if the
3295 .Cm fieldName
3296 contains some characters followed by a full stop, they will be ignored.
3297 So, for example, a second
3298 .Cm organizationName
3299 can be input by calling it
3300 .Qq 1.organizationName .
3302 The actual permitted field names are any object identifier short or
3303 long names.
3304 These are compiled into
3305 .Nm openssl
3306 and include the usual values such as
3307 .Cm commonName , countryName , localityName , organizationName ,
3308 .Cm organizationalUnitName , stateOrProvinceName .
3309 Additionally,
3310 .Cm emailAddress
3311 is included as well as
3312 .Cm name , surname , givenName , initials
3314 .Cm dnQualifier .
3316 Additional object identifiers can be defined with the
3317 .Cm oid_file
3319 .Cm oid_section
3320 options in the configuration file.
3321 Any additional fields will be treated as though they were a
3322 .Cm DirectoryString .
3323 .Sh RSA
3324 .nr nS 1
3325 .Nm "openssl rsa"
3326 .Op Fl aes128 | aes192 | aes256 | des | des3
3327 .Op Fl check
3328 .Op Fl in Ar file
3329 .Op Fl inform Cm der | net | pem
3330 .Op Fl modulus
3331 .Op Fl noout
3332 .Op Fl out Ar file
3333 .Op Fl outform Cm der | net | pem
3334 .Op Fl passin Ar arg
3335 .Op Fl passout Ar arg
3336 .Op Fl pubin
3337 .Op Fl pubout
3338 .Op Fl sgckey
3339 .Op Fl text
3340 .nr nS 0
3343 .Nm rsa
3344 command processes RSA keys.
3345 They can be converted between various forms and their components printed out.
3346 .Nm rsa
3347 uses the traditional
3348 .Nm SSLeay
3349 compatible format for private key encryption:
3350 newer applications should use the more secure PKCS#8 format using the
3351 .Nm pkcs8
3352 utility.
3354 The options are as follows:
3355 .Bl -tag -width Ds
3356 .It Fl aes128 | aes192 | aes256 | des | des3
3357 Encrypt the private key with the AES, DES,
3358 or the triple DES ciphers, respectively, before outputting it.
3359 A pass phrase is prompted for.
3360 If none of these options are specified, the key is written in plain text.
3361 This means that using the
3362 .Nm rsa
3363 utility to read in an encrypted key with no encryption option can be used
3364 to remove the pass phrase from a key, or by setting the encryption options
3365 it can be used to add or change the pass phrase.
3366 These options can only be used with PEM format output files.
3367 .It Fl check
3368 Check the consistency of an RSA private key.
3369 .It Fl in Ar file
3370 The input file to read from,
3371 or standard input if not specified.
3372 If the key is encrypted, a pass phrase will be prompted for.
3373 .It Fl inform Cm der | net | pem
3374 The input format.
3375 .It Fl noout
3376 Do not output the encoded version of the key.
3377 .It Fl modulus
3378 Print the value of the modulus of the key.
3379 .It Fl out Ar file
3380 The output file to write to,
3381 or standard output if not specified.
3382 .It Fl outform Cm der | net | pem
3383 The output format.
3384 .It Fl passin Ar arg
3385 The key password source.
3386 .It Fl passout Ar arg
3387 The output file password source.
3388 .It Fl pubin
3389 Read in a public key,
3390 not a private key.
3391 .It Fl pubout
3392 Output a public key,
3393 not a private key.
3394 Automatically set if the input is a public key.
3395 .It Fl sgckey
3396 Use the modified NET algorithm used with some versions of Microsoft IIS
3397 and SGC keys.
3398 .It Fl text
3399 Print the public/private key components in plain text.
3401 .Sh RSAUTL
3402 .nr nS 1
3403 .Nm "openssl rsautl"
3404 .Op Fl asn1parse
3405 .Op Fl certin
3406 .Op Fl decrypt
3407 .Op Fl encrypt
3408 .Op Fl hexdump
3409 .Op Fl in Ar file
3410 .Op Fl inkey Ar file
3411 .Op Fl keyform Cm der | pem
3412 .Op Fl oaep | pkcs | raw
3413 .Op Fl out Ar file
3414 .Op Fl pubin
3415 .Op Fl sign
3416 .Op Fl verify
3417 .nr nS 0
3420 .Nm rsautl
3421 command can be used to sign, verify, encrypt and decrypt
3422 data using the RSA algorithm.
3424 The options are as follows:
3425 .Bl -tag -width Ds
3426 .It Fl asn1parse
3427 Asn1parse the output data; this is useful when combined with the
3428 .Fl verify
3429 option.
3430 .It Fl certin
3431 The input is a certificate containing an RSA public key.
3432 .It Fl decrypt
3433 Decrypt the input data using an RSA private key.
3434 .It Fl encrypt
3435 Encrypt the input data using an RSA public key.
3436 .It Fl hexdump
3437 Hex dump the output data.
3438 .It Fl in Ar file
3439 The input to read from,
3440 or standard input if not specified.
3441 .It Fl inkey Ar file
3442 The input key file; by default an RSA private key.
3443 .It Fl keyform Cm der | pem
3444 The private key format.
3445 The default is
3446 .Cm pem .
3447 .It Fl oaep | pkcs | raw
3448 The padding to use:
3449 PKCS#1 OAEP, PKCS#1 v1.5 (the default), or no padding, respectively.
3450 For signatures, only
3451 .Fl pkcs
3453 .Fl raw
3454 can be used.
3455 .It Fl out Ar file
3456 The output file to write to,
3457 or standard output if not specified.
3458 .It Fl pubin
3459 The input file is an RSA public key.
3460 .It Fl sign
3461 Sign the input data and output the signed result.
3462 This requires an RSA private key.
3463 .It Fl verify
3464 Verify the input data and output the recovered data.
3466 .Sh S_CLIENT
3467 .nr nS 1
3468 .Nm "openssl s_client"
3469 .Op Fl 4 | 6
3470 .Op Fl bugs
3471 .Op Fl CAfile Ar file
3472 .Op Fl CApath Ar directory
3473 .Op Fl cert Ar file
3474 .Op Fl check_ss_sig
3475 .Op Fl cipher Ar cipherlist
3476 .Op Fl connect Ar host Ns Op : Ns Ar port
3477 .Op Fl crl_check
3478 .Op Fl crl_check_all
3479 .Op Fl crlf
3480 .Op Fl debug
3481 .Op Fl extended_crl
3482 .Op Fl groups
3483 .Op Fl ign_eof
3484 .Op Fl ignore_critical
3485 .Op Fl issuer_checks
3486 .Op Fl key Ar keyfile
3487 .Op Fl msg
3488 .Op Fl nbio
3489 .Op Fl nbio_test
3490 .Op Fl no_ticket
3491 .Op Fl no_tls1
3492 .Op Fl no_tls1_1
3493 .Op Fl no_tls1_2
3494 .Op Fl pause
3495 .Op Fl policy_check
3496 .Op Fl prexit
3497 .Op Fl proxy Ar host : Ns Ar port
3498 .Op Fl psk Ar key
3499 .Op Fl psk_identity Ar identity
3500 .Op Fl quiet
3501 .Op Fl reconnect
3502 .Op Fl servername Ar name
3503 .Op Fl showcerts
3504 .Op Fl starttls Ar protocol
3505 .Op Fl state
3506 .Op Fl tls1
3507 .Op Fl tls1_1
3508 .Op Fl tls1_2
3509 .Op Fl tlsextdebug
3510 .Op Fl verify Ar depth
3511 .Op Fl x509_strict
3512 .Op Fl xmpphost Ar host
3513 .nr nS 0
3516 .Nm s_client
3517 command implements a generic SSL/TLS client which connects
3518 to a remote host using SSL/TLS.
3520 If a connection is established with an SSL server, any data received
3521 from the server is displayed and any key presses will be sent to the
3522 server.
3523 When used interactively (which means neither
3524 .Fl quiet
3526 .Fl ign_eof
3527 have been given), the session will be renegotiated if the line begins with an
3528 .Cm R ;
3529 if the line begins with a
3530 .Cm Q
3531 or if end of file is reached, the connection will be closed down.
3533 The options are as follows:
3534 .Bl -tag -width Ds
3535 .It Fl 4
3536 Attempt connections using IPv4 only.
3537 .It Fl 6
3538 Attempt connections using IPv6 only.
3539 .It Fl bugs
3540 Enable various workarounds for buggy implementations.
3541 .It Fl CAfile Ar file
3543 .Ar file
3544 containing trusted certificates to use during server authentication
3545 and to use when attempting to build the client certificate chain.
3546 .It Fl CApath Ar directory
3548 .Ar directory
3549 to use for server certificate verification.
3550 This directory must be in
3551 .Qq hash format ;
3553 .Fl verify
3554 for more information.
3555 These are also used when building the client certificate chain.
3556 .It Fl cert Ar file
3557 The certificate to use, if one is requested by the server.
3558 The default is not to use a certificate.
3559 .It Xo
3560 .Fl check_ss_sig ,
3561 .Fl crl_check ,
3562 .Fl crl_check_all ,
3563 .Fl extended_crl ,
3564 .Fl ignore_critical ,
3565 .Fl issuer_checks ,
3566 .Fl policy_check ,
3567 .Fl x509_strict
3569 Set various certificate chain validation options.
3570 See the
3571 .Nm verify
3572 command for details.
3573 .It Fl cipher Ar cipherlist
3574 Modify the cipher list sent by the client.
3575 Although the server determines which cipher suite is used, it should take
3576 the first supported cipher in the list sent by the client.
3577 See the
3578 .Nm ciphers
3579 command for more information.
3580 .It Fl connect Ar host Ns Op : Ns Ar port
3582 .Ar host
3584 .Ar port
3585 to connect to.
3586 If not specified, an attempt is made to connect to the local host
3587 on port 4433.
3588 Alternatively, the host and port pair may be separated using a forward-slash
3589 character,
3590 which is useful for numeric IPv6 addresses.
3591 .It Fl crlf
3592 Translate a line feed from the terminal into CR+LF,
3593 as required by some servers.
3594 .It Fl debug
3595 Print extensive debugging information, including a hex dump of all traffic.
3596 .It Fl groups Ar ecgroups
3597 Specify a colon-separated list of permitted EC curve groups.
3598 .It Fl ign_eof
3599 Inhibit shutting down the connection when end of file is reached in the input.
3600 .It Fl key Ar keyfile
3601 The private key to use.
3602 If not specified, the certificate file will be used.
3603 .It Fl msg
3604 Show all protocol messages with hex dump.
3605 .It Fl nbio
3606 Turn on non-blocking I/O.
3607 .It Fl nbio_test
3608 Test non-blocking I/O.
3609 .It Fl no_tls1 | no_tls1_1 | no_tls1_2
3610 Disable the use of TLS1.0, 1.1, and 1.2, respectively.
3611 .It Fl no_ticket
3612 Disable RFC 4507 session ticket support.
3613 .It Fl pause
3614 Pause 1 second between each read and write call.
3615 .It Fl prexit
3616 Print session information when the program exits.
3617 This will always attempt
3618 to print out information even if the connection fails.
3619 Normally, information will only be printed out once if the connection succeeds.
3620 This option is useful because the cipher in use may be renegotiated
3621 or the connection may fail because a client certificate is required or is
3622 requested only after an attempt is made to access a certain URL.
3623 Note that the output produced by this option is not always accurate
3624 because a connection might never have been established.
3625 .It Fl proxy Ar host : Ns Ar port
3626 Use the HTTP proxy at
3627 .Ar host
3629 .Ar port .
3630 The connection to the proxy is done in cleartext and the
3631 .Fl connect
3632 argument is given to the proxy.
3633 If not specified, localhost is used as final destination.
3634 After that, switch the connection through the proxy to the destination
3635 to TLS.
3636 .It Fl psk Ar key
3637 Use the PSK key
3638 .Ar key
3639 when using a PSK cipher suite.
3640 The key is given as a hexadecimal number without the leading 0x,
3641 for example -psk 1a2b3c4d.
3642 .It Fl psk_identity Ar identity
3643 Use the PSK
3644 .Ar identity
3645 when using a PSK cipher suite.
3646 .It Fl quiet
3647 Inhibit printing of session and certificate information.
3648 This implicitly turns on
3649 .Fl ign_eof
3650 as well.
3651 .It Fl reconnect
3652 Reconnect to the same server 5 times using the same session ID; this can
3653 be used as a test that session caching is working.
3654 .It Fl servername Ar name
3655 Include the TLS Server Name Indication (SNI) extension in the ClientHello
3656 message, using the specified server
3657 .Ar name .
3658 .It Fl showcerts
3659 Display the whole server certificate chain: normally only the server
3660 certificate itself is displayed.
3661 .It Fl starttls Ar protocol
3662 Send the protocol-specific messages to switch to TLS for communication.
3663 .Ar protocol
3664 is a keyword for the intended protocol.
3665 Currently, the supported keywords are
3666 .Qq ftp ,
3667 .Qq imap ,
3668 .Qq smtp ,
3669 .Qq pop3 ,
3671 .Qq xmpp .
3672 .It Fl state
3673 Print the SSL session states.
3674 .It Fl tls1 | tls1_1 | tls1_2
3675 Permit only TLS1.0, 1.1, or 1.2, respectively.
3676 .It Fl tlsextdebug
3677 Print a hex dump of any TLS extensions received from the server.
3678 .It Fl verify Ar depth
3679 Turn on server certificate verification,
3680 with a maximum length of
3681 .Ar depth .
3682 Currently the verify operation continues after errors so all the problems
3683 with a certificate chain can be seen.
3684 As a side effect the connection will never fail due to a server
3685 certificate verify failure.
3686 .It Fl xmpphost Ar hostname
3687 When used with
3688 .Fl starttls Ar xmpp ,
3689 specify the host for the "to" attribute of the stream element.
3690 If this option is not specified then the host specified with
3691 .Fl connect
3692 will be used.
3694 .Sh S_SERVER
3695 .nr nS 1
3696 .Nm "openssl s_server"
3697 .Op Fl accept Ar port
3698 .Op Fl bugs
3699 .Op Fl CAfile Ar file
3700 .Op Fl CApath Ar directory
3701 .Op Fl cert Ar file
3702 .Op Fl cipher Ar cipherlist
3703 .Op Fl context Ar id
3704 .Op Fl crl_check
3705 .Op Fl crl_check_all
3706 .Op Fl crlf
3707 .Op Fl dcert Ar file
3708 .Op Fl debug
3709 .Op Fl dhparam Ar file
3710 .Op Fl dkey Ar file
3711 .Op Fl hack
3712 .Op Fl HTTP
3713 .Op Fl id_prefix Ar arg
3714 .Op Fl key Ar keyfile
3715 .Op Fl msg
3716 .Op Fl nbio
3717 .Op Fl nbio_test
3718 .Op Fl no_dhe
3719 .Op Fl no_tls1
3720 .Op Fl no_tls1_1
3721 .Op Fl no_tls1_2
3722 .Op Fl no_tmp_rsa
3723 .Op Fl nocert
3724 .Op Fl psk Ar key
3725 .Op Fl psk_hint Ar hint
3726 .Op Fl quiet
3727 .Op Fl serverpref
3728 .Op Fl state
3729 .Op Fl tls1
3730 .Op Fl tls1_1
3731 .Op Fl tls1_2
3732 .Op Fl Verify Ar depth
3733 .Op Fl verify Ar depth
3734 .Op Fl WWW
3735 .Op Fl www
3736 .nr nS 0
3739 .Nm s_server
3740 command implements a generic SSL/TLS server which listens
3741 for connections on a given port using SSL/TLS.
3743 If a connection request is established with a client and neither the
3744 .Fl www
3745 nor the
3746 .Fl WWW
3747 option has been used, then any data received
3748 from the client is displayed and any key presses are sent to the client.
3749 Certain single letter commands perform special operations:
3751 .Bl -tag -width "XXXX" -compact
3752 .It Ic P
3753 Send plain text, which should cause the client to disconnect.
3754 .It Ic Q
3755 End the current SSL connection and exit.
3756 .It Ic q
3757 End the current SSL connection, but still accept new connections.
3758 .It Ic R
3759 Renegotiate the SSL session and request a client certificate.
3760 .It Ic r
3761 Renegotiate the SSL session.
3762 .It Ic S
3763 Print out some session cache status information.
3766 The options are as follows:
3767 .Bl -tag -width Ds
3768 .It Fl accept Ar port
3769 Listen on TCP
3770 .Ar port
3771 for connections.
3772 The default is port 4433.
3773 .It Fl bugs
3774 Enable various workarounds for buggy implementations.
3775 .It Fl CAfile Ar file
3777 .Ar file
3778 containing trusted certificates to use during client authentication
3779 and to use when attempting to build the server certificate chain.
3780 The list is also used in the list of acceptable client CAs passed to the
3781 client when a certificate is requested.
3782 .It Fl CApath Ar directory
3784 .Ar directory
3785 to use for client certificate verification.
3786 This directory must be in
3787 .Qq hash format ;
3789 .Fl verify
3790 for more information.
3791 These are also used when building the server certificate chain.
3792 .It Fl cert Ar file
3793 The certificate to use: most server's cipher suites require the use of a
3794 certificate and some require a certificate with a certain public key type.
3795 For example, the DSS cipher suites require a certificate containing a DSS
3796 (DSA) key.
3797 If not specified, the file
3798 .Pa server.pem
3799 will be used.
3800 .It Fl cipher Ar cipherlist
3801 Modify the cipher list used by the server.
3802 This allows the cipher list used by the server to be modified.
3803 When the client sends a list of supported ciphers, the first client cipher
3804 also included in the server list is used.
3805 Because the client specifies the preference order, the order of the server
3806 cipherlist is irrelevant.
3807 See the
3808 .Nm ciphers
3809 command for more information.
3810 .It Fl context Ar id
3811 Set the SSL context ID.
3812 It can be given any string value.
3813 .It Fl crl_check , crl_check_all
3814 Check the peer certificate has not been revoked by its CA.
3815 The CRLs are appended to the certificate file.
3816 .Fl crl_check_all
3817 checks all CRLs of all CAs in the chain.
3818 .It Fl crlf
3819 Translate a line feed from the terminal into CR+LF.
3820 .It Fl dcert Ar file , Fl dkey Ar file
3821 Specify an additional certificate and private key; these behave in the
3822 same manner as the
3823 .Fl cert
3825 .Fl key
3826 options except there is no default if they are not specified
3827 (no additional certificate or key is used).
3828 By using RSA and DSS certificates and keys,
3829 a server can support clients which only support RSA or DSS cipher suites
3830 by using an appropriate certificate.
3831 .It Fl debug
3832 Print extensive debugging information, including a hex dump of all traffic.
3833 .It Fl dhparam Ar file
3834 The DH parameter file to use.
3835 The ephemeral DH cipher suites generate keys
3836 using a set of DH parameters.
3837 If not specified, an attempt is made to
3838 load the parameters from the server certificate file.
3839 If this fails, a static set of parameters hard coded into the
3840 .Nm s_server
3841 program will be used.
3842 .It Fl hack
3843 Enables a further workaround for some early Netscape SSL code.
3844 .It Fl HTTP
3845 Emulate a simple web server.
3846 Pages are resolved relative to the current directory.
3847 For example if the URL
3848 .Pa https://myhost/page.html
3849 is requested, the file
3850 .Pa ./page.html
3851 will be loaded.
3852 The files loaded are assumed to contain a complete and correct HTTP
3853 response (lines that are part of the HTTP response line and headers
3854 must end with CRLF).
3855 .It Fl id_prefix Ar arg
3856 Generate SSL/TLS session IDs prefixed by
3857 .Ar arg .
3858 This is mostly useful for testing any SSL/TLS code
3859 that wish to deal with multiple servers,
3860 when each of which might be generating a unique range of session IDs.
3861 .It Fl key Ar keyfile
3862 The private key to use.
3863 If not specified, the certificate file will be used.
3864 .It Fl msg
3865 Show all protocol messages with hex dump.
3866 .It Fl nbio
3867 Turn on non-blocking I/O.
3868 .It Fl nbio_test
3869 Test non-blocking I/O.
3870 .It Fl no_dhe
3871 Disable ephemeral DH cipher suites.
3872 .It Fl no_tls1 | no_tls1_1 | no_tls1_2
3873 Disable the use of TLS1.0, 1.1, and 1.2, respectively.
3874 .It Fl no_tmp_rsa
3875 Disable temporary RSA key generation.
3876 .It Fl nocert
3877 Do not use a certificate.
3878 This restricts the cipher suites available to the anonymous ones
3879 (currently just anonymous DH).
3880 .It Fl psk Ar key
3881 Use the PSK key
3882 .Ar key
3883 when using a PSK cipher suite.
3884 The key is given as a hexadecimal number without the leading 0x,
3885 for example -psk 1a2b3c4d.
3886 .It Fl psk_hint Ar hint
3887 Use the PSK identity hint
3888 .Ar hint
3889 when using a PSK cipher suite.
3890 .It Fl quiet
3891 Inhibit printing of session and certificate information.
3892 .It Fl serverpref
3893 Use server's cipher preferences.
3894 .It Fl state
3895 Print the SSL session states.
3896 .It Fl tls1 | tls1_1 | tls1_2
3897 Permit only TLS1.0, 1.1, or 1.2, respectively.
3898 .It Fl WWW
3899 Emulate a simple web server.
3900 Pages are resolved relative to the current directory.
3901 For example if the URL
3902 .Pa https://myhost/page.html
3903 is requested, the file
3904 .Pa ./page.html
3905 will be loaded.
3906 .It Fl www
3907 Send a status message to the client when it connects,
3908 including information about the ciphers used and various session parameters.
3909 The output is in HTML format so this option will normally be used with a
3910 web browser.
3911 .It Fl Verify Ar depth , Fl verify Ar depth
3912 Request a certificate chain from the client,
3913 with a maximum length of
3914 .Ar depth .
3915 With
3916 .Fl Verify ,
3917 the client must supply a certificate or an error occurs;
3918 with
3919 .Fl verify ,
3920 a certificate is requested but the client does not have to send one.
3922 .Sh S_TIME
3923 .nr nS 1
3924 .Nm "openssl s_time"
3925 .Op Fl bugs
3926 .Op Fl CAfile Ar file
3927 .Op Fl CApath Ar directory
3928 .Op Fl cert Ar file
3929 .Op Fl cipher Ar cipherlist
3930 .Op Fl connect Ar host Ns Op : Ns Ar port
3931 .Op Fl key Ar keyfile
3932 .Op Fl nbio
3933 .Op Fl new
3934 .Op Fl no_shutdown
3935 .Op Fl reuse
3936 .Op Fl time Ar seconds
3937 .Op Fl verify Ar depth
3938 .Op Fl www Ar page
3939 .nr nS 0
3942 .Nm s_time
3943 command implements a generic SSL/TLS client which connects to a
3944 remote host using SSL/TLS.
3945 It can request a page from the server and includes
3946 the time to transfer the payload data in its timing measurements.
3947 It measures the number of connections within a given timeframe,
3948 the amount of data transferred
3949 .Pq if any ,
3950 and calculates the average time spent for one connection.
3952 The options are as follows:
3953 .Bl -tag -width Ds
3954 .It Fl bugs
3955 Enable various workarounds for buggy implementations.
3956 .It Fl CAfile Ar file
3958 .Ar file
3959 containing trusted certificates to use during server authentication
3960 and to use when attempting to build the client certificate chain.
3961 .It Fl CApath Ar directory
3962 The directory to use for server certificate verification.
3963 This directory must be in
3964 .Qq hash format ;
3966 .Nm verify
3967 for more information.
3968 These are also used when building the client certificate chain.
3969 .It Fl cert Ar file
3970 The certificate to use, if one is requested by the server.
3971 The default is not to use a certificate.
3972 .It Fl cipher Ar cipherlist
3973 Modify the cipher list sent by the client.
3974 Although the server determines which cipher suite is used,
3975 it should take the first supported cipher in the list sent by the client.
3976 See the
3977 .Nm ciphers
3978 command for more information.
3979 .It Fl connect Ar host Ns Op : Ns Ar port
3980 The host and port to connect to.
3981 .It Fl key Ar keyfile
3982 The private key to use.
3983 If not specified, the certificate file will be used.
3984 .It Fl nbio
3985 Turn on non-blocking I/O.
3986 .It Fl new
3987 Perform the timing test using a new session ID for each connection.
3988 If neither
3989 .Fl new
3991 .Fl reuse
3992 are specified,
3993 they are both on by default and executed in sequence.
3994 .It Fl no_shutdown
3995 Shut down the connection without sending a
3996 .Qq close notify
3997 shutdown alert to the server.
3998 .It Fl reuse
3999 Perform the timing test using the same session ID for each connection.
4000 If neither
4001 .Fl new
4003 .Fl reuse
4004 are specified,
4005 they are both on by default and executed in sequence.
4006 .It Fl time Ar seconds
4007 Limit
4008 .Nm s_time
4009 benchmarks to the number of
4010 .Ar seconds .
4011 The default is 30 seconds.
4012 .It Fl verify Ar depth
4013 Turn on server certificate verification,
4014 with a maximum length of
4015 .Ar depth .
4016 Currently the verify operation continues after errors, so all the problems
4017 with a certificate chain can be seen.
4018 As a side effect,
4019 the connection will never fail due to a server certificate verify failure.
4020 .It Fl www Ar page
4021 The page to GET from the server.
4022 A value of
4023 .Sq /
4024 gets the index.htm[l] page.
4025 If this parameter is not specified,
4026 .Nm s_time
4027 will only perform the handshake to establish SSL connections
4028 but not transfer any payload data.
4030 .Sh SESS_ID
4031 .nr nS 1
4032 .Nm "openssl sess_id"
4033 .Op Fl cert
4034 .Op Fl context Ar ID
4035 .Op Fl in Ar file
4036 .Op Fl inform Cm der | pem
4037 .Op Fl noout
4038 .Op Fl out Ar file
4039 .Op Fl outform Cm der | pem
4040 .Op Fl text
4041 .nr nS 0
4044 .Nm sess_id
4045 program processes the encoded version of the SSL session structure and
4046 optionally prints out SSL session details
4047 (for example the SSL session master key)
4048 in human-readable format.
4050 The options are as follows:
4051 .Bl -tag -width Ds
4052 .It Fl cert
4053 If a certificate is present in the session,
4054 it will be output using this option;
4055 if the
4056 .Fl text
4057 option is also present, then it will be printed out in text form.
4058 .It Fl context Ar ID
4059 Set the session
4060 .Ar ID .
4061 The ID can be any string of characters.
4062 .It Fl in Ar file
4063 The input file to read from,
4064 or standard input if not specified.
4065 .It Fl inform Cm der | pem
4066 The input format.
4067 .Cm der
4068 uses an ASN.1 DER-encoded format containing session details.
4069 The precise format can vary from one version to the next.
4070 .Cm pem
4071 is the default format: it consists of the DER
4072 format base64-encoded with additional header and footer lines.
4073 .It Fl noout
4074 Do not output the encoded version of the session.
4075 .It Fl out Ar file
4076 The output file to write to,
4077 or standard output if not specified.
4078 .It Fl outform Cm der | pem
4079 The output format.
4080 .It Fl text
4081 Print the various public or private key components in plain text,
4082 in addition to the encoded version.
4085 The output of
4086 .Nm sess_id
4087 is composed as follows:
4089 .Bl -tag -width "Verify return code " -offset 3n -compact
4090 .It Protocol
4091 The protocol in use.
4092 .It Cipher
4093 The actual raw SSL or TLS cipher code.
4094 .It Session-ID
4095 The SSL session ID, in hex format.
4096 .It Session-ID-ctx
4097 The session ID context, in hex format.
4098 .It Master-Key
4099 The SSL session master key.
4100 .It Key-Arg
4101 The key argument; this is only used in SSL v2.
4102 .It Start Time
4103 The session start time.
4105 format.
4106 .It Timeout
4107 The timeout, in seconds.
4108 .It Verify return code
4109 The return code when a certificate is verified.
4112 Since the SSL session output contains the master key, it is possible to read
4113 the contents of an encrypted session using this information.
4114 Therefore appropriate security precautions
4115 should be taken if the information is being output by a
4116 .Qq real
4117 application.
4118 This is, however, strongly discouraged and should only be used for
4119 debugging purposes.
4120 .Sh SMIME
4121 .nr nS 1
4122 .Nm "openssl smime"
4124 .Fl aes128 | aes192 | aes256 | des |
4125 .Fl des3 | rc2-40 | rc2-64 | rc2-128
4127 .Op Fl binary
4128 .Op Fl CAfile Ar file
4129 .Op Fl CApath Ar directory
4130 .Op Fl certfile Ar file
4131 .Op Fl check_ss_sig
4132 .Op Fl content Ar file
4133 .Op Fl crl_check
4134 .Op Fl crl_check_all
4135 .Op Fl decrypt
4136 .Op Fl encrypt
4137 .Op Fl extended_crl
4138 .Op Fl from Ar addr
4139 .Op Fl ignore_critical
4140 .Op Fl in Ar file
4141 .Op Fl indef
4142 .Op Fl inform Cm der | pem | smime
4143 .Op Fl inkey Ar file
4144 .Op Fl issuer_checks
4145 .Op Fl keyform Cm pem
4146 .Op Fl md Ar digest
4147 .Op Fl noattr
4148 .Op Fl nocerts
4149 .Op Fl nochain
4150 .Op Fl nodetach
4151 .Op Fl noindef
4152 .Op Fl nointern
4153 .Op Fl nosigs
4154 .Op Fl noverify
4155 .Op Fl out Ar file
4156 .Op Fl outform Cm der | pem | smime
4157 .Op Fl passin Ar arg
4158 .Op Fl pk7out
4159 .Op Fl policy_check
4160 .Op Fl recip Ar file
4161 .Op Fl resign
4162 .Op Fl sign
4163 .Op Fl signer Ar file
4164 .Op Fl stream
4165 .Op Fl subject Ar s
4166 .Op Fl text
4167 .Op Fl to Ar addr
4168 .Op Fl verify
4169 .Op Fl x509_strict
4170 .Op Ar cert.pem ...
4171 .nr nS 0
4174 .Nm smime
4175 command handles S/MIME mail.
4176 It can encrypt, decrypt, sign, and verify S/MIME messages.
4178 The MIME message must be sent without any blank lines between the
4179 headers and the output.
4180 Some mail programs will automatically add a blank line.
4181 Piping the mail directly to an MTA is one way to
4182 achieve the correct format.
4184 The supplied message to be signed or encrypted must include the necessary
4185 MIME headers or many S/MIME clients won't display it properly (if at all).
4186 Use the
4187 .Fl text
4188 option to automatically add plain text headers.
4191 .Qq signed and encrypted
4192 message is one where a signed message is then encrypted.
4193 This can be produced by encrypting an already signed message.
4195 There are a number of operations that can be performed, as follows:
4196 .Bl -tag -width "XXXX"
4197 .It Fl decrypt
4198 Decrypt mail using the supplied certificate and private key.
4199 The input file is an encrypted mail message in MIME format.
4200 The decrypted mail is written to the output file.
4201 .It Fl encrypt
4202 Encrypt mail for the given recipient certificates.
4203 The input is the message to be encrypted.
4204 The output file is the encrypted mail, in MIME format.
4205 .It Fl pk7out
4206 Take an input message and write out a PEM-encoded PKCS#7 structure.
4207 .It Fl resign
4208 Resign a message: take an existing message and one or more new signers.
4209 .It Fl sign
4210 Sign mail using the supplied certificate and private key.
4211 The input file is the message to be signed.
4212 The signed message, in MIME format, is written to the output file.
4213 .It Fl verify
4214 Verify signed mail.
4215 The input is a signed mail message and the output is the signed data.
4216 Both clear text and opaque signing is supported.
4219 The remaining options are as follows:
4220 .Bl -tag -width "XXXX"
4221 .It Xo
4222 .Fl aes128 | aes192 | aes256 | des |
4223 .Fl des3 | rc2-40 | rc2-64 | rc2-128
4225 The encryption algorithm to use.
4226 128-, 192-, or 256-bit AES, DES (56 bits), triple DES (168 bits),
4227 or 40-, 64-, or 128-bit RC2, respectively;
4228 if not specified, 40-bit RC2 is
4229 used.
4230 Only used with
4231 .Fl encrypt .
4232 .It Fl binary
4233 Normally, the input message is converted to
4234 .Qq canonical
4235 format which uses CR/LF as end of line,
4236 as required by the S/MIME specification.
4237 When this option is present no translation occurs.
4238 This is useful when handling binary data which may not be in MIME format.
4239 .It Fl CAfile Ar file
4241 .Ar file
4242 containing trusted CA certificates; only used with
4243 .Fl verify .
4244 .It Fl CApath Ar directory
4246 .Ar directory
4247 containing trusted CA certificates; only used with
4248 .Fl verify .
4249 This directory must be a standard certificate directory:
4250 that is, a hash of each subject name (using
4251 .Nm x509 -hash )
4252 should be linked to each certificate.
4253 .It Ar cert.pem ...
4254 One or more certificates of message recipients: used when encrypting
4255 a message.
4256 .It Fl certfile Ar file
4257 Allows additional certificates to be specified.
4258 When signing, these will be included with the message.
4259 When verifying, these will be searched for the signers' certificates.
4260 The certificates should be in PEM format.
4261 .It Xo
4262 .Fl check_ss_sig ,
4263 .Fl crl_check ,
4264 .Fl crl_check_all ,
4265 .Fl extended_crl ,
4266 .Fl ignore_critical ,
4267 .Fl issuer_checks ,
4268 .Fl policy_check ,
4269 .Fl x509_strict
4271 Set various certificate chain validation options.
4272 See the
4273 .Nm verify
4274 command for details.
4275 .It Fl content Ar file
4276 A file containing the detached content.
4277 This is only useful with the
4278 .Fl verify
4279 option,
4280 and only usable if the PKCS#7 structure is using the detached
4281 signature form where the content is not included.
4282 This option will override any content if the input format is S/MIME
4283 and it uses the multipart/signed MIME content type.
4284 .It Xo
4285 .Fl from Ar addr ,
4286 .Fl subject Ar s ,
4287 .Fl to Ar addr
4289 The relevant mail headers.
4290 These are included outside the signed
4291 portion of a message so they may be included manually.
4292 When signing, many S/MIME
4293 mail clients check that the signer's certificate email
4294 address matches the From: address.
4295 .It Fl in Ar file
4296 The input file to read from.
4297 .It Fl indef
4298 Enable streaming I/O for encoding operations.
4299 This permits single pass processing of data without
4300 the need to hold the entire contents in memory,
4301 potentially supporting very large files.
4302 Streaming is automatically set for S/MIME signing with detached
4303 data if the output format is SMIME;
4304 it is currently off by default for all other operations.
4305 .It Fl inform Cm der | pem | smime
4306 The input format.
4307 .It Fl inkey Ar file
4308 The private key to use when signing or decrypting,
4309 which must match the corresponding certificate.
4310 If this option is not specified, the private key must be included
4311 in the certificate file specified with
4313 .Fl recip
4315 .Fl signer
4316 file.
4317 When signing,
4318 this option can be used multiple times to specify successive keys.
4319 .It Fl keyform Cm pem
4320 Input private key format.
4321 .It Fl md Ar digest
4322 The digest algorithm to use when signing or resigning.
4323 If not present then the default digest algorithm for the signing key is used
4324 (usually SHA1).
4325 .It Fl noattr
4326 Do not include attributes.
4327 .It Fl nocerts
4328 Do not include the signer's certificate.
4329 This will reduce the size of the signed message but the verifier must
4330 have a copy of the signer's certificate available locally (passed using the
4331 .Fl certfile
4332 option, for example).
4333 .It Fl nochain
4334 Do not do chain verification of signers' certificates: that is,
4335 don't use the certificates in the signed message as untrusted CAs.
4336 .It Fl nodetach
4337 When signing a message use opaque signing: this form is more resistant
4338 to translation by mail relays but it cannot be read by mail agents that
4339 do not support S/MIME.
4340 Without this option cleartext signing with the MIME type
4341 multipart/signed is used.
4342 .It Fl noindef
4343 Disable streaming I/O where it would produce an encoding of indefinite length
4344 (currently has no effect).
4345 .It Fl nointern
4346 Only use certificates specified in the
4347 .Fl certfile .
4348 The supplied certificates can still be used as untrusted CAs.
4349 .It Fl nosigs
4350 Do not try to verify the signatures on the message.
4351 .It Fl noverify
4352 Do not verify the signer's certificate of a signed message.
4353 .It Fl out Ar file
4354 The output file to write to.
4355 .It Fl outform Cm der | pem | smime
4356 The output format.
4357 The default is smime, which writes an S/MIME format message.
4358 .Cm pem
4360 .Cm der
4361 change this to write PEM and DER format PKCS#7 structures instead.
4362 This currently only affects the output format of the PKCS#7
4363 structure; if no PKCS#7 structure is being output (for example with
4364 .Fl verify
4366 .Fl decrypt )
4367 this option has no effect.
4368 .It Fl passin Ar arg
4369 The key password source.
4370 .It Fl recip Ar file
4371 The recipients certificate when decrypting a message.
4372 This certificate
4373 must match one of the recipients of the message or an error occurs.
4374 .It Fl signer Ar file
4375 A signing certificate when signing or resigning a message;
4376 this option can be used multiple times if more than one signer is required.
4377 If a message is being verified, the signer's certificates will be
4378 written to this file if the verification was successful.
4379 .It Fl stream
4380 The same as
4381 .Fl indef .
4382 .It Fl text
4383 Add plain text (text/plain) MIME
4384 headers to the supplied message if encrypting or signing.
4385 If decrypting or verifying, it strips off text headers:
4386 if the decrypted or verified message is not of MIME type text/plain
4387 then an error occurs.
4390 The exit codes for
4391 .Nm smime
4392 are as follows:
4394 .Bl -tag -width "XXXX"  -offset 3n -compact
4395 .It 0
4396 The operation was completely successful.
4397 .It 1
4398 An error occurred parsing the command options.
4399 .It 2
4400 One of the input files could not be read.
4401 .It 3
4402 An error occurred creating the file or when reading the message.
4403 .It 4
4404 An error occurred decrypting or verifying the message.
4405 .It 5
4406 An error occurred writing certificates.
4408 .Sh SPEED
4409 .nr nS 1
4410 .Nm "openssl speed"
4411 .Op Ar algorithm
4412 .Op Fl decrypt
4413 .Op Fl elapsed
4414 .Op Fl evp Ar algorithm
4415 .Op Fl mr
4416 .Op Fl multi Ar number
4417 .nr nS 0
4420 .Nm speed
4421 command is used to test the performance of cryptographic algorithms.
4422 .Bl -tag -width "XXXX"
4423 .It Ar algorithm
4424 Perform the test using
4425 .Ar algorithm .
4426 The default is to test all algorithms.
4427 .It Fl decrypt
4428 Time decryption instead of encryption;
4429 must be used with
4430 .Fl evp .
4431 .It Fl elapsed
4432 Measure time in real time instead of CPU user time.
4433 .It Fl evp Ar algorithm
4434 Perform the test using one of the algorithms accepted by
4435 .Xr EVP_get_cipherbyname 3 .
4436 .It Fl mr
4437 Produce machine readable output.
4438 .It Fl multi Ar number
4440 .Ar number
4441 benchmarks in parallel.
4443 .Sh SPKAC
4444 .nr nS 1
4445 .Nm "openssl spkac"
4446 .Op Fl challenge Ar string
4447 .Op Fl in Ar file
4448 .Op Fl key Ar keyfile
4449 .Op Fl noout
4450 .Op Fl out Ar file
4451 .Op Fl passin Ar arg
4452 .Op Fl pubkey
4453 .Op Fl spkac Ar spkacname
4454 .Op Fl spksect Ar section
4455 .Op Fl verify
4456 .nr nS 0
4459 .Nm spkac
4460 command processes signed public key and challenge (SPKAC) files.
4461 It can print out their contents, verify the signature,
4462 and produce its own SPKACs from a supplied private key.
4464 The options are as follows:
4465 .Bl -tag -width Ds
4466 .It Fl challenge Ar string
4467 The challenge string, if an SPKAC is being created.
4468 .It Fl in Ar file
4469 The input file to read from,
4470 or standard input if not specified.
4471 Ignored if the
4472 .Fl key
4473 option is used.
4474 .It Fl key Ar keyfile
4475 Create an SPKAC file using the private key in
4476 .Ar keyfile .
4478 .Fl in , noout , spksect ,
4480 .Fl verify
4481 options are ignored, if present.
4482 .It Fl noout
4483 Do not output the text version of the SPKAC.
4484 .It Fl out Ar file
4485 The output file to write to,
4486 or standard output if not specified.
4487 .It Fl passin Ar arg
4488 The key password source.
4489 .It Fl pubkey
4490 Output the public key of an SPKAC.
4491 .It Fl spkac Ar spkacname
4492 An alternative name for the variable containing the SPKAC.
4493 The default is "SPKAC".
4494 This option affects both generated and input SPKAC files.
4495 .It Fl spksect Ar section
4496 An alternative name for the
4497 .Ar section
4498 containing the SPKAC.
4499 .It Fl verify
4500 Verify the digital signature on the supplied SPKAC.
4502 .Sh TS
4503 .nr nS 1
4504 .Nm "openssl ts"
4505 .Fl query
4506 .Op Fl md4 | md5 | ripemd160 | sha1
4507 .Op Fl cert
4508 .Op Fl config Ar configfile
4509 .Op Fl data Ar file_to_hash
4510 .Op Fl digest Ar digest_bytes
4511 .Op Fl in Ar request.tsq
4512 .Op Fl no_nonce
4513 .Op Fl out Ar request.tsq
4514 .Op Fl policy Ar object_id
4515 .Op Fl text
4516 .nr nS 0
4518 .nr nS 1
4519 .Nm "openssl ts"
4520 .Fl reply
4521 .Op Fl chain Ar certs_file.pem
4522 .Op Fl config Ar configfile
4523 .Op Fl in Ar response.tsr
4524 .Op Fl inkey Ar private.pem
4525 .Op Fl out Ar response.tsr
4526 .Op Fl passin Ar arg
4527 .Op Fl policy Ar object_id
4528 .Op Fl queryfile Ar request.tsq
4529 .Op Fl section Ar tsa_section
4530 .Op Fl signer Ar tsa_cert.pem
4531 .Op Fl text
4532 .Op Fl token_in
4533 .Op Fl token_out
4534 .nr nS 0
4536 .nr nS 1
4537 .Nm "openssl ts"
4538 .Fl verify
4539 .Op Fl CAfile Ar trusted_certs.pem
4540 .Op Fl CApath Ar trusted_cert_path
4541 .Op Fl data Ar file_to_hash
4542 .Op Fl digest Ar digest_bytes
4543 .Op Fl in Ar response.tsr
4544 .Op Fl queryfile Ar request.tsq
4545 .Op Fl token_in
4546 .Op Fl untrusted Ar cert_file.pem
4547 .nr nS 0
4550 .Nm ts
4551 command is a basic Time Stamping Authority (TSA) client and server
4552 application as specified in RFC 3161 (Time-Stamp Protocol, TSP).
4553 A TSA can be part of a PKI deployment and its role is to provide long
4554 term proof of the existence of specific data.
4555 Here is a brief description of the protocol:
4556 .Bl -enum
4558 The TSA client computes a one-way hash value for a data file and sends
4559 the hash to the TSA.
4561 The TSA attaches the current date and time to the received hash value,
4562 signs them and sends the time stamp token back to the client.
4563 By creating this token the TSA certifies the existence of the original
4564 data file at the time of response generation.
4566 The TSA client receives the time stamp token and verifies the
4567 signature on it.
4568 It also checks if the token contains the same hash
4569 value that it had sent to the TSA.
4572 There is one DER-encoded protocol data unit defined for transporting a time
4573 stamp request to the TSA and one for sending the time stamp response
4574 back to the client.
4576 .Nm ts
4577 command has three main functions:
4578 creating a time stamp request based on a data file;
4579 creating a time stamp response based on a request;
4580 and verifying if a response corresponds
4581 to a particular request or a data file.
4583 There is no support for sending the requests/responses automatically
4584 over HTTP or TCP yet as suggested in RFC 3161.
4585 Users must send the requests either by FTP or email.
4588 .Fl query
4589 switch can be used for creating and printing a time stamp
4590 request with the following options:
4591 .Bl -tag -width Ds
4592 .It Fl cert
4593 Expect the TSA to include its signing certificate in the response.
4594 .It Fl config Ar configfile
4595 Specify an alternative configuration file.
4596 Only the OID section is used.
4597 .It Fl data Ar file_to_hash
4598 The data file for which the time stamp request needs to be created.
4599 The default is standard input.
4600 .It Fl digest Ar digest_bytes
4601 Specify the message imprint explicitly without the data file.
4602 The imprint must be specified in a hexadecimal format,
4603 two characters per byte,
4604 the bytes optionally separated by colons.
4605 The number of bytes must match the message digest algorithm in use.
4606 .It Fl in Ar request.tsq
4607 A previously created time stamp request in DER
4608 format that will be printed into the output file.
4609 Useful for examining the content of a request in human-readable format.
4610 .It Fl md4 | md5 | ripemd160 | sha | sha1
4611 The message digest to apply to the data file.
4612 It supports all the message digest algorithms that are supported by the
4613 .Nm dgst
4614 command.
4615 The default is SHA-1.
4616 .It Fl no_nonce
4617 Specify no nonce in the request.
4618 The default, to include a 64-bit long pseudo-random nonce,
4619 is recommended to protect against replay attacks.
4620 .It Fl out Ar request.tsq
4621 The output file to write to,
4622 or standard output if not specified.
4623 .It Fl policy Ar object_id
4624 The policy that the client expects the TSA to use for creating the
4625 time stamp token.
4626 Either dotted OID notation or OID names defined
4627 in the config file can be used.
4628 If no policy is requested the TSA uses its own default policy.
4629 .It Fl text
4630 Output in human-readable text format instead of DER.
4633 A time stamp response (TimeStampResp) consists of a response status
4634 and the time stamp token itself (ContentInfo),
4635 if the token generation was successful.
4637 .Fl reply
4638 command is for creating a time stamp
4639 response or time stamp token based on a request and printing the
4640 response/token in human-readable format.
4642 .Fl token_out
4643 is not specified the output is always a time stamp response (TimeStampResp),
4644 otherwise it is a time stamp token (ContentInfo).
4645 .Bl -tag -width Ds
4646 .It Fl chain Ar certs_file.pem
4647 The collection of PEM certificates
4648 that will be included in the response
4649 in addition to the signer certificate if the
4650 .Fl cert
4651 option was used for the request.
4652 This file is supposed to contain the certificate chain
4653 for the signer certificate from its issuer upwards.
4655 .Fl reply
4656 command does not build a certificate chain automatically.
4657 .It Fl config Ar configfile
4658 Specify an alternative configuration file.
4659 .It Fl in Ar response.tsr
4660 Specify a previously created time stamp response (or time stamp token, if
4661 .Fl token_in
4662 is also specified)
4663 in DER format that will be written to the output file.
4664 This option does not require a request;
4665 it is useful, for example,
4666 to examine the content of a response or token
4667 or to extract the time stamp token from a response.
4668 If the input is a token and the output is a time stamp response a default
4669 .Qq granted
4670 status info is added to the token.
4671 .It Fl inkey Ar private.pem
4672 The signer private key of the TSA in PEM format.
4673 Overrides the
4674 .Cm signer_key
4675 config file option.
4676 .It Fl out Ar response.tsr
4677 The response is written to this file.
4678 The format and content of the file depends on other options (see
4679 .Fl text
4681 .Fl token_out ) .
4682 The default is stdout.
4683 .It Fl passin Ar arg
4684 The key password source.
4685 .It Fl policy Ar object_id
4686 The default policy to use for the response.
4687 Either dotted OID notation or OID names defined
4688 in the config file can be used.
4689 If no policy is requested the TSA uses its own default policy.
4690 .It Fl queryfile Ar request.tsq
4691 The file containing a DER-encoded time stamp request.
4692 .It Fl section Ar tsa_section
4693 The config file section containing the settings for response generation.
4694 .It Fl signer Ar tsa_cert.pem
4695 The PEM signer certificate of the TSA.
4696 The TSA signing certificate must have exactly one extended key usage
4697 assigned to it: timeStamping.
4698 The extended key usage must also be critical,
4699 otherwise the certificate is going to be refused.
4700 Overrides the
4701 .Cm signer_cert
4702 variable of the config file.
4703 .It Fl text
4704 Output in human-readable text format instead of DER.
4705 .It Fl token_in
4706 The input is a DER-encoded time stamp token (ContentInfo)
4707 instead of a time stamp response (TimeStampResp).
4708 .It Fl token_out
4709 The output is a time stamp token (ContentInfo)
4710 instead of a time stamp response (TimeStampResp).
4714 .Fl verify
4715 command is for verifying if a time stamp response or time stamp token
4716 is valid and matches a particular time stamp request or data file.
4718 .Fl verify
4719 command does not use the configuration file.
4720 .Bl -tag -width Ds
4721 .It Fl CAfile Ar trusted_certs.pem
4722 The file containing a set of trusted self-signed PEM CA certificates.
4724 .Nm verify
4725 for additional details.
4726 Either this option or
4727 .Fl CApath
4728 must be specified.
4729 .It Fl CApath Ar trusted_cert_path
4730 The directory containing the trused CA certificates of the client.
4732 .Nm verify
4733 for additional details.
4734 Either this option or
4735 .Fl CAfile
4736 must be specified.
4737 .It Fl data Ar file_to_hash
4738 The response or token must be verified against
4739 .Ar file_to_hash .
4740 The file is hashed with the message digest algorithm specified in the token.
4742 .Fl digest
4744 .Fl queryfile
4745 options must not be specified with this one.
4746 .It Fl digest Ar digest_bytes
4747 The response or token must be verified against the message digest specified
4748 with this option.
4749 The number of bytes must match the message digest algorithm
4750 specified in the token.
4752 .Fl data
4754 .Fl queryfile
4755 options must not be specified with this one.
4756 .It Fl in Ar response.tsr
4757 The time stamp response that needs to be verified, in DER format.
4758 This option in mandatory.
4759 .It Fl queryfile Ar request.tsq
4760 The original time stamp request, in DER format.
4762 .Fl data
4764 .Fl digest
4765 options must not be specified with this one.
4766 .It Fl token_in
4767 The input is a DER-encoded time stamp token (ContentInfo)
4768 instead of a time stamp response (TimeStampResp).
4769 .It Fl untrusted Ar cert_file.pem
4770 Additional untrusted PEM certificates which may be needed
4771 when building the certificate chain for the TSA's signing certificate.
4772 This file must contain the TSA signing certificate and
4773 all intermediate CA certificates unless the response includes them.
4776 Options specified on the command line always override
4777 the settings in the config file:
4778 .Bl -tag -width Ds
4779 .It Cm tsa Ar section , Cm default_tsa
4780 This is the main section and it specifies the name of another section
4781 that contains all the options for the
4782 .Fl reply
4783 option.
4784 This section can be overridden with the
4785 .Fl section
4786 command line switch.
4787 .It Cm oid_file
4789 .Nm ca
4790 for a description.
4791 .It Cm oid_section
4793 .Nm ca
4794 for a description.
4795 .It Cm serial
4796 The file containing the hexadecimal serial number of the
4797 last time stamp response created.
4798 This number is incremented by 1 for each response.
4799 If the file does not exist at the time of response generation
4800 a new file is created with serial number 1.
4801 This parameter is mandatory.
4802 .It Cm signer_cert
4803 TSA signing certificate, in PEM format.
4804 The same as the
4805 .Fl signer
4806 command line option.
4807 .It Cm certs
4808 A set of PEM-encoded certificates that need to be
4809 included in the response.
4810 The same as the
4811 .Fl chain
4812 command line option.
4813 .It Cm signer_key
4814 The private key of the TSA, in PEM format.
4815 The same as the
4816 .Fl inkey
4817 command line option.
4818 .It Cm default_policy
4819 The default policy to use when the request does not mandate any policy.
4820 The same as the
4821 .Fl policy
4822 command line option.
4823 .It Cm other_policies
4824 Comma separated list of policies that are also acceptable by the TSA
4825 and used only if the request explicitly specifies one of them.
4826 .It Cm digests
4827 The list of message digest algorithms that the TSA accepts.
4828 At least one algorithm must be specified.
4829 This parameter is mandatory.
4830 .It Cm accuracy
4831 The accuracy of the time source of the TSA in seconds, milliseconds
4832 and microseconds.
4833 For example, secs:1, millisecs:500, microsecs:100.
4834 If any of the components is missing,
4835 zero is assumed for that field.
4836 .It Cm clock_precision_digits
4837 The maximum number of digits, which represent the fraction of seconds,
4838 that need to be included in the time field.
4839 The trailing zeroes must be removed from the time,
4840 so there might actually be fewer digits
4841 or no fraction of seconds at all.
4842 The maximum value is 6;
4843 the default is 0.
4844 .It Cm ordering
4845 If this option is yes,
4846 the responses generated by this TSA can always be ordered,
4847 even if the time difference between two responses is less
4848 than the sum of their accuracies.
4849 The default is no.
4850 .It Cm tsa_name
4851 Set this option to yes if the subject name of the TSA must be included in
4852 the TSA name field of the response.
4853 The default is no.
4854 .It Cm ess_cert_id_chain
4855 The SignedData objects created by the TSA always contain the
4856 certificate identifier of the signing certificate in a signed
4857 attribute (see RFC 2634, Enhanced Security Services).
4858 If this option is set to yes and either the
4859 .Cm certs
4860 variable or the
4861 .Fl chain
4862 option is specified then the certificate identifiers of the chain will also
4863 be included in the SigningCertificate signed attribute.
4864 If this variable is set to no,
4865 only the signing certificate identifier is included.
4866 The default is no.
4868 .Sh VERIFY
4869 .nr nS 1
4870 .Nm "openssl verify"
4871 .Op Fl CAfile Ar file
4872 .Op Fl CApath Ar directory
4873 .Op Fl check_ss_sig
4874 .Op Fl crl_check
4875 .Op Fl crl_check_all
4876 .Op Fl explicit_policy
4877 .Op Fl extended_crl
4878 .Op Fl help
4879 .Op Fl ignore_critical
4880 .Op Fl inhibit_any
4881 .Op Fl inhibit_map
4882 .Op Fl issuer_checks
4883 .Op Fl policy_check
4884 .Op Fl purpose Ar purpose
4885 .Op Fl untrusted Ar file
4886 .Op Fl verbose
4887 .Op Fl x509_strict
4888 .Op Ar certificates
4889 .nr nS 0
4892 .Nm verify
4893 command verifies certificate chains.
4895 The options are as follows:
4896 .Bl -tag -width Ds
4897 .It Fl check_ss_sig
4898 Verify the signature on the self-signed root CA.
4899 This is disabled by default
4900 because it doesn't add any security.
4901 .It Fl CAfile Ar file
4903 .Ar file
4904 of trusted certificates.
4906 .Ar file
4907 should contain multiple certificates in PEM format, concatenated together.
4908 .It Fl CApath Ar directory
4910 .Ar directory
4911 of trusted certificates.
4912 The certificates, or symbolic links to them,
4913 should have names of the form
4914 .Ar hash Ns .0 ,
4915 where
4916 .Ar hash
4917 is the hashed certificate subject name
4918 (see the
4919 .Fl hash
4920 option of the
4921 .Nm x509
4922 utility).
4923 .It Fl crl_check
4924 Check end entity certificate validity by attempting to look up a valid CRL.
4925 If a valid CRL cannot be found an error occurs.
4926 .It Fl crl_check_all
4927 Check the validity of all certificates in the chain by attempting
4928 to look up valid CRLs.
4929 .It Fl explicit_policy
4930 Set policy variable require-explicit-policy (RFC 3280).
4931 .It Fl extended_crl
4932 Enable extended CRL features such as indirect CRLs and alternate CRL
4933 signing keys.
4934 .It Fl help
4935 Print a usage message.
4936 .It Fl ignore_critical
4937 Ignore critical extensions instead of rejecting the certificate.
4938 .It Fl inhibit_any
4939 Set policy variable inhibit-any-policy (RFC 3280).
4940 .It Fl inhibit_map
4941 Set policy variable inhibit-policy-mapping (RFC 3280).
4942 .It Fl issuer_checks
4943 Print diagnostics relating to searches for the issuer certificate
4944 of the current certificate
4945 showing why each candidate issuer certificate was rejected.
4946 The presence of rejection messages
4947 does not itself imply that anything is wrong:
4948 during the normal verify process several rejections may take place.
4949 .It Fl policy_check
4950 Enable certificate policy processing.
4951 .It Fl purpose Ar purpose
4952 The intended use for the certificate.
4953 Without this option no chain verification will be done.
4954 Currently accepted uses are
4955 .Cm sslclient , sslserver ,
4956 .Cm nssslserver , smimesign ,
4957 .Cm smimeencrypt , crlsign ,
4958 .Cm any ,
4960 .Cm ocsphelper .
4961 .It Fl untrusted Ar file
4963 .Ar file
4964 of untrusted certificates.
4966 .Ar file
4967 should contain multiple certificates.
4968 .It Fl verbose
4969 Print extra information about the operations being performed.
4970 .It Fl x509_strict
4971 Disable workarounds for broken certificates which have to be disabled
4972 for strict X.509 compliance.
4973 .It Ar certificates
4974 One or more PEM
4975 .Ar certificates
4976 to verify.
4977 If no certificate files are included, an attempt is made to read
4978 a certificate from standard input.
4979 If the first certificate filename begins with a dash,
4980 use a lone dash to mark the last option.
4984 .Nm verify
4985 program uses the same functions as the internal SSL and S/MIME verification,
4986 with one crucial difference:
4987 wherever possible an attempt is made to continue after an error,
4988 whereas normally the verify operation would halt on the first error.
4989 This allows all the problems with a certificate chain to be determined.
4991 The verify operation consists of a number of separate steps.
4992 Firstly a certificate chain is built up starting from the supplied certificate
4993 and ending in the root CA.
4994 It is an error if the whole chain cannot be built up.
4995 The chain is built up by looking up the issuer's certificate of the current
4996 certificate.
4997 If a certificate is found which is its own issuer, it is assumed
4998 to be the root CA.
5000 All certificates whose subject name matches the issuer name
5001 of the current certificate are subject to further tests.
5002 The relevant authority key identifier components of the current certificate
5003 (if present) must match the subject key identifier (if present)
5004 and issuer and serial number of the candidate issuer;
5005 in addition the
5006 .Cm keyUsage
5007 extension of the candidate issuer (if present) must permit certificate signing.
5009 The lookup first looks in the list of untrusted certificates and if no match
5010 is found the remaining lookups are from the trusted certificates.
5011 The root CA is always looked up in the trusted certificate list:
5012 if the certificate to verify is a root certificate,
5013 then an exact match must be found in the trusted list.
5015 The second operation is to check every untrusted certificate's extensions for
5016 consistency with the supplied purpose.
5017 If the
5018 .Fl purpose
5019 option is not included, then no checks are done.
5020 The supplied or
5021 .Qq leaf
5022 certificate must have extensions compatible with the supplied purpose
5023 and all other certificates must also be valid CA certificates.
5024 The precise extensions required are described in more detail in
5026 .Nm X509
5027 section below.
5029 The third operation is to check the trust settings on the root CA.
5030 The root CA should be trusted for the supplied purpose.
5031 A certificate with no trust settings is considered to be valid for
5032 all purposes.
5034 The final operation is to check the validity of the certificate chain.
5035 The validity period is checked against the current system time and the
5036 .Cm notBefore
5038 .Cm notAfter
5039 dates in the certificate.
5040 The certificate signatures are also checked at this point.
5042 If all operations complete successfully, the certificate is considered
5043 valid.
5044 If any operation fails then the certificate is not valid.
5045 When a verify operation fails, the output messages can be somewhat cryptic.
5046 The general form of the error message is:
5047 .Bd -literal
5048 server.pem: /C=AU/ST=Queensland/O=CryptSoft Pty Ltd/CN=Test CA (1024-bit)
5049 error 24 at 1 depth lookup:invalid CA certificate
5052 The first line contains the name of the certificate being verified, followed by
5053 the subject name of the certificate.
5054 The second line contains the error number and the depth.
5055 The depth is the number of the certificate being verified when a
5056 problem was detected starting with zero for the certificate being verified
5057 itself, then 1 for the CA that signed the certificate and so on.
5058 Finally a text version of the error number is presented.
5060 An exhaustive list of the error codes and messages is shown below; this also
5061 includes the name of the error code as defined in the header file
5062 .In openssl/x509_vfy.h .
5063 Some of the error codes are defined but never returned: these are described as
5064 .Qq unused .
5065 .Bl -tag -width "XXXX"
5066 .It 0 X509_V_OK
5067 The operation was successful.
5068 .It 2 X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT
5069 The issuer certificate of an untrusted certificate could not be found.
5070 .It 3 X509_V_ERR_UNABLE_TO_GET_CRL
5071 The CRL of a certificate could not be found.
5072 .It 4 X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE
5073 The certificate signature could not be decrypted.
5074 This means that the actual signature value could not be determined
5075 rather than it not matching the expected value.
5076 This is only meaningful for RSA keys.
5077 .It 5 X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE
5078 The CRL signature could not be decrypted.
5079 This means that the actual signature value could not be determined
5080 rather than it not matching the expected value.
5081 Unused.
5082 .It 6 X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY
5083 The public key in the certificate
5084 .Cm SubjectPublicKeyInfo
5085 could not be read.
5086 .It 7 X509_V_ERR_CERT_SIGNATURE_FAILURE
5087 The signature of the certificate is invalid.
5088 .It 8 X509_V_ERR_CRL_SIGNATURE_FAILURE
5089 The signature of the certificate is invalid.
5090 .It 9 X509_V_ERR_CERT_NOT_YET_VALID
5091 The certificate is not yet valid: the
5092 .Cm notBefore
5093 date is after the current time.
5094 .It 10 X509_V_ERR_CERT_HAS_EXPIRED
5095 The certificate has expired; that is, the
5096 .Cm notAfter
5097 date is before the current time.
5098 .It 11 X509_V_ERR_CRL_NOT_YET_VALID
5099 The CRL is not yet valid.
5100 .It 12 X509_V_ERR_CRL_HAS_EXPIRED
5101 The CRL has expired.
5102 .It 13 X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD
5103 The certificate
5104 .Cm notBefore
5105 field contains an invalid time.
5106 .It 14 X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD
5107 The certificate
5108 .Cm notAfter
5109 field contains an invalid time.
5110 .It 15 X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD
5111 The CRL
5112 .Cm lastUpdate
5113 field contains an invalid time.
5114 .It 16 X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD
5115 The CRL
5116 .Cm nextUpdate
5117 field contains an invalid time.
5118 .It 17 X509_V_ERR_OUT_OF_MEM
5119 An error occurred trying to allocate memory.
5120 This should never happen.
5121 .It 18 X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT
5122 The passed certificate is self-signed and the same certificate cannot be
5123 found in the list of trusted certificates.
5124 .It 19 X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN
5125 The certificate chain could be built up using the untrusted certificates but
5126 the root could not be found locally.
5127 .It 20 X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY
5128 The issuer certificate of a locally looked up certificate could not be found.
5129 This normally means the list of trusted certificates is not complete.
5130 .It 21 X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE
5131 No signatures could be verified because the chain contains only one
5132 certificate and it is not self-signed.
5133 .It 22 X509_V_ERR_CERT_CHAIN_TOO_LONG
5134 The certificate chain length is greater than the supplied maximum depth.
5135 Unused.
5136 .It 23 X509_V_ERR_CERT_REVOKED
5137 The certificate has been revoked.
5138 .It 24 X509_V_ERR_INVALID_CA
5139 A CA certificate is invalid.
5140 Either it is not a CA or its extensions are not consistent
5141 with the supplied purpose.
5142 .It 25 X509_V_ERR_PATH_LENGTH_EXCEEDED
5144 .Cm basicConstraints
5145 pathlength parameter has been exceeded.
5146 .It 26 X509_V_ERR_INVALID_PURPOSE
5147 The supplied certificate cannot be used for the specified purpose.
5148 .It 27 X509_V_ERR_CERT_UNTRUSTED
5149 The root CA is not marked as trusted for the specified purpose.
5150 .It 28 X509_V_ERR_CERT_REJECTED
5151 The root CA is marked to reject the specified purpose.
5152 .It 29 X509_V_ERR_SUBJECT_ISSUER_MISMATCH
5153 The current candidate issuer certificate was rejected because its subject name
5154 did not match the issuer name of the current certificate.
5155 Only displayed when the
5156 .Fl issuer_checks
5157 option is set.
5158 .It 30 X509_V_ERR_AKID_SKID_MISMATCH
5159 The current candidate issuer certificate was rejected because its subject key
5160 identifier was present and did not match the authority key identifier current
5161 certificate.
5162 Only displayed when the
5163 .Fl issuer_checks
5164 option is set.
5165 .It 31 X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH
5166 The current candidate issuer certificate was rejected because its issuer name
5167 and serial number were present and did not match the authority key identifier
5168 of the current certificate.
5169 Only displayed when the
5170 .Fl issuer_checks
5171 option is set.
5172 .It 32 X509_V_ERR_KEYUSAGE_NO_CERTSIGN
5173 The current candidate issuer certificate was rejected because its
5174 .Cm keyUsage
5175 extension does not permit certificate signing.
5176 .It 50 X509_V_ERR_APPLICATION_VERIFICATION
5177 An application specific error.
5178 Unused.
5180 .Sh VERSION
5181 .Nm openssl version
5182 .Op Fl abdfopv
5185 .Nm version
5186 command is used to print out version information about
5187 .Nm openssl .
5189 The options are as follows:
5190 .Bl -tag -width Ds
5191 .It Fl a
5192 All information: this is the same as setting all the other flags.
5193 .It Fl b
5194 The date the current version of
5195 .Nm openssl
5196 was built.
5197 .It Fl d
5198 .Ev OPENSSLDIR
5199 setting.
5200 .It Fl f
5201 Compilation flags.
5202 .It Fl o
5203 Option information: various options set when the library was built.
5204 .It Fl p
5205 Platform setting.
5206 .It Fl v
5207 The current
5208 .Nm openssl
5209 version.
5211 .Sh X509
5212 .nr nS 1
5213 .Nm "openssl x509"
5214 .Op Fl C
5215 .Op Fl addreject Ar arg
5216 .Op Fl addtrust Ar arg
5217 .Op Fl alias
5218 .Op Fl CA Ar file
5219 .Op Fl CAcreateserial
5220 .Op Fl CAform Cm der | pem
5221 .Op Fl CAkey Ar file
5222 .Op Fl CAkeyform Cm der | pem
5223 .Op Fl CAserial Ar file
5224 .Op Fl certopt Ar option
5225 .Op Fl checkend Ar arg
5226 .Op Fl clrext
5227 .Op Fl clrreject
5228 .Op Fl clrtrust
5229 .Op Fl dates
5230 .Op Fl days Ar arg
5231 .Op Fl email
5232 .Op Fl enddate
5233 .Op Fl extensions Ar section
5234 .Op Fl extfile Ar file
5235 .Op Fl fingerprint
5236 .Op Fl hash
5237 .Op Fl in Ar file
5238 .Op Fl inform Cm der | net | pem
5239 .Op Fl issuer
5240 .Op Fl issuer_hash
5241 .Op Fl issuer_hash_old
5242 .Op Fl keyform Cm der | pem
5243 .Op Fl md5 | sha1
5244 .Op Fl modulus
5245 .Op Fl nameopt Ar option
5246 .Op Fl noout
5247 .Op Fl ocsp_uri
5248 .Op Fl ocspid
5249 .Op Fl out Ar file
5250 .Op Fl outform Cm der | net | pem
5251 .Op Fl passin Ar arg
5252 .Op Fl pubkey
5253 .Op Fl purpose
5254 .Op Fl req
5255 .Op Fl serial
5256 .Op Fl set_serial Ar n
5257 .Op Fl setalias Ar arg
5258 .Op Fl signkey Ar file
5259 .Op Fl startdate
5260 .Op Fl subject
5261 .Op Fl subject_hash
5262 .Op Fl subject_hash_old
5263 .Op Fl text
5264 .Op Fl trustout
5265 .Op Fl x509toreq
5266 .nr nS 0
5269 .Nm x509
5270 command is a multi-purpose certificate utility.
5271 It can be used to display certificate information, convert certificates to
5272 various forms, sign certificate requests like a
5273 .Qq mini CA ,
5274 or edit certificate trust settings.
5276 The following are x509 input, output, and general purpose options:
5277 .Bl -tag -width "XXXX"
5278 .It Fl in Ar file
5279 The input file to read from,
5280 or standard input if not specified.
5281 .It Fl inform Cm der | net | pem
5282 The input format.
5283 Normally, the command will expect an X.509 certificate,
5284 but this can change if other options such as
5285 .Fl req
5286 are present.
5287 .It Fl md5 | sha1
5288 The digest to use.
5289 This affects any signing or display option that uses a message digest,
5290 such as the
5291 .Fl fingerprint , signkey ,
5293 .Fl CA
5294 options.
5295 If not specified, MD5 is used.
5296 SHA1 is always used with DSA keys.
5297 .It Fl out Ar file
5298 The output file to write to,
5299 or standard output if none is specified.
5300 .It Fl outform Cm der | net | pem
5301 The output format.
5302 .It Fl passin Ar arg
5303 The key password source.
5306 The following are x509 display options:
5307 .Bl -tag -width "XXXX"
5308 .It Fl C
5309 Output the certificate in the form of a C source file.
5310 .It Fl certopt Ar option
5311 Customise the output format used with
5312 .Fl text ,
5313 either using a list of comma-separated options or by specifying
5314 .Fl certopt
5315 multiple times.
5316 The default behaviour is to print all fields.
5317 The options are as follows:
5319 .Bl -tag -width "no_extensions" -offset indent -compact
5320 .It Cm ca_default
5321 Equivalent to
5322 .Cm no_issuer , no_pubkey , no_header ,
5323 .Cm no_version , no_sigdump ,
5325 .Cm no_signame .
5326 .It Cm compatible
5327 Equivalent to no output options at all.
5328 .It Cm ext_default
5329 Print unsupported certificate extensions.
5330 .It Cm ext_dump
5331 Hex dump unsupported extensions.
5332 .It Cm ext_error
5333 Print an error message for unsupported certificate extensions.
5334 .It Cm ext_parse
5335 ASN.1 parse unsupported extensions.
5336 .It Cm no_aux
5337 Do not print certificate trust information.
5338 .It Cm no_extensions
5339 Do not print X509V3 extensions.
5340 .It Cm no_header
5341 Do not print header (Certificate and Data) information.
5342 .It Cm no_issuer
5343 Do not print the issuer name.
5344 .It Cm no_pubkey
5345 Do not print the public key.
5346 .It Cm no_serial
5347 Do not print the serial number.
5348 .It Cm no_sigdump
5349 Do not give a hexadecimal dump of the certificate signature.
5350 .It Cm no_signame
5351 Do not print the signature algorithm used.
5352 .It Cm no_subject
5353 Do not print the subject name.
5354 .It Cm no_validity
5355 Do not print the
5356 .Cm notBefore
5358 .Cm notAfter
5359 (validity) fields.
5360 .It Cm no_version
5361 Do not print the version number.
5363 .It Fl dates
5364 Print the start and expiry date of a certificate.
5365 .It Fl email
5366 Output the email addresses, if any.
5367 .It Fl enddate
5368 Print the expiry date of the certificate; that is, the
5369 .Cm notAfter
5370 date.
5371 .It Fl fingerprint
5372 Print the digest of the DER-encoded version of the whole certificate.
5373 .It Fl hash
5374 A synonym for
5375 .Fl subject_hash .
5376 .It Fl issuer
5377 Print the issuer name.
5378 .It Fl issuer_hash
5379 Print the hash of the certificate issuer name.
5380 .It Fl issuer_hash_old
5381 Print the hash of the certificate issuer name
5382 using the older algorithm as used by
5383 .Nm openssl
5384 versions before 1.0.0.
5385 .It Fl modulus
5386 Print the value of the modulus of the public key contained in the certificate.
5387 .It Fl nameopt Ar option
5388 Customise how the subject or issuer names are displayed,
5389 either using a list of comma-separated options or by specifying
5390 .Fl nameopt
5391 multiple times.
5392 The default behaviour is to use the
5393 .Cm oneline
5394 format.
5395 The options,
5396 which can be preceded by a dash to turn them off,
5397 are as follows:
5398 .Bl -tag -width "XXXX"
5399 .It Cm align
5400 Align field values for a more readable output.
5401 Only usable with
5402 .Ar sep_multiline .
5403 .It Cm compat
5404 Use the old format,
5405 equivalent to specifying no options at all.
5406 .It Cm dn_rev
5407 Reverse the fields of the DN, as required by RFC 2253.
5408 As a side effect, this also reverses the order of multiple AVAs.
5409 .It Cm dump_all
5410 Dump all fields.
5411 When used with
5412 .Ar dump_der ,
5413 it allows the DER encoding of the structure to be unambiguously determined.
5414 .It Cm dump_der
5415 Any fields that need to be hexdumped are
5416 dumped using the DER encoding of the field.
5417 Otherwise just the content octets will be displayed.
5418 Both options use the RFC 2253 #XXXX... format.
5419 .It Cm dump_nostr
5420 Dump non-character string types
5421 (for example OCTET STRING);
5422 usually, non-character string types are displayed
5423 as though each content octet represents a single character.
5424 .It Cm dump_unknown
5425 Dump any field whose OID is not recognised by
5426 .Nm openssl .
5427 .It Cm esc_2253
5428 Escape the
5429 .Qq special
5430 characters required by RFC 2253 in a field that is
5431 .Dq \& ,+"<>; .
5432 Additionally,
5433 .Sq #
5434 is escaped at the beginning of a string
5435 and a space character at the beginning or end of a string.
5436 .It Cm esc_ctrl
5437 Escape control characters.
5438 That is, those with ASCII values less than 0x20 (space)
5439 and the delete (0x7f) character.
5440 They are escaped using the RFC 2253 \eXX notation (where XX are two hex
5441 digits representing the character value).
5442 .It Cm esc_msb
5443 Escape characters with the MSB set; that is, with ASCII values larger than
5444 127.
5445 .It Cm multiline
5446 A multiline format.
5447 Equivalent to
5448 .Cm esc_ctrl , esc_msb , sep_multiline ,
5449 .Cm space_eq , lname ,
5451 .Cm align .
5452 .It Cm no_type
5453 Do not attempt to interpret multibyte characters.
5454 That is, content octets are merely dumped as though one octet
5455 represents each character.
5456 This is useful for diagnostic purposes
5457 but results in rather odd looking output.
5458 .It Cm nofname , sname , lname , oid
5459 Alter how the field name is displayed:
5460 .Cm nofname
5461 does not display the field at all;
5462 .Cm sname
5463 uses the short name form (CN for
5464 .Cm commonName ,
5465 for example);
5466 .Cm lname
5467 uses the long form.
5468 .Cm oid
5469 represents the OID in numerical form and is useful for diagnostic purpose.
5470 .It Cm oneline
5471 A one line format which is more readable than
5472 .Cm RFC2253 .
5473 Equivalent to
5474 .Cm esc_2253 , esc_ctrl , esc_msb , utf8 ,
5475 .Cm dump_nostr , dump_der , use_quote , sep_comma_plus_spc ,
5476 .Cm space_eq ,
5478 .Cm sname .
5479 .It Cm RFC2253
5480 Displays names compatible with RFC 2253.
5481 Equivalent to
5482 .Cm esc_2253 , esc_ctrl ,
5483 .Cm esc_msb , utf8 , dump_nostr , dump_unknown ,
5484 .Cm dump_der , sep_comma_plus , dn_rev ,
5486 .Cm sname .
5487 .It Cm sep_comma_plus , sep_comma_plus_space , sep_semi_plus_space , sep_multiline
5488 Determine the field separators:
5489 the first character is between RDNs and the second between multiple AVAs
5490 (multiple AVAs are very rare and their use is discouraged).
5491 The options ending in
5492 .Qq space
5493 additionally place a space after the separator to make it more readable.
5494 .Cm sep_multiline
5495 uses a linefeed character for the RDN separator and a spaced
5496 .Sq +
5497 for the AVA separator,
5498 as well as indenting the fields by four characters.
5499 .It Cm show_type
5500 Show the type of the ASN.1 character string.
5501 The type precedes the field contents.
5502 For example
5503 .Qq BMPSTRING: Hello World .
5504 .It Cm space_eq
5505 Place spaces round the
5506 .Sq =
5507 character which follows the field name.
5508 .It Cm use_quote
5509 Escape some characters by surrounding the whole string with
5510 .Sq \&"
5511 characters.
5512 Without the option, all escaping is done with the
5513 .Sq \e
5514 character.
5515 .It Cm utf8
5516 Convert all strings to UTF8 format first, as required by RFC 2253.
5517 On a UTF8 compatible terminal,
5518 the use of this option (and not setting
5519 .Cm esc_msb )
5520 may result in the correct display of multibyte characters.
5521 Usually, multibyte characters larger than 0xff
5522 are represented using the format \eUXXXX for 16 bits and \eWXXXXXXXX
5523 for 32 bits,
5524 and any UTF8Strings are converted to their character form first.
5526 .It Fl noout
5527 Do not output the encoded version of the request.
5528 .It Fl ocsp_uri
5529 Print the OCSP responder addresses, if any.
5530 .It Fl ocspid
5531 Print OCSP hash values for the subject name and public key.
5532 .It Fl pubkey
5533 Print the public key.
5534 .It Fl serial
5535 Print the certificate serial number.
5536 .It Fl startdate
5537 Print the start date of the certificate; that is, the
5538 .Cm notBefore
5539 date.
5540 .It Fl subject
5541 Print the subject name.
5542 .It Fl subject_hash
5543 Print the hash of the certificate subject name.
5544 This is used in
5545 .Nm openssl
5546 to form an index to allow certificates in a directory to be looked up
5547 by subject name.
5548 .It Fl subject_hash_old
5549 Print the hash of the certificate subject name
5550 using the older algorithm as used by
5551 .Nm openssl
5552 versions before 1.0.0.
5553 .It Fl text
5554 Print the full certificate in text form.
5557 A trusted certificate is a certificate which has several
5558 additional pieces of information attached to it such as the permitted
5559 and prohibited uses of the certificate and an alias.
5560 When a certificate is being verified at least one certificate must be trusted.
5561 By default, a trusted certificate must be stored locally and be a root CA.
5562 The following are x509 trust settings options:
5563 .Bl -tag -width "XXXX"
5564 .It Fl addreject Ar arg
5565 Add a prohibited use.
5566 Accepts the same values as the
5567 .Fl addtrust
5568 option.
5569 .It Fl addtrust Ar arg
5570 Add a trusted certificate use.
5571 Any object name can be used here, but currently only
5572 .Cm clientAuth
5573 (SSL client use),
5574 .Cm serverAuth
5575 (SSL server use),
5577 .Cm emailProtection
5578 (S/MIME email) are used.
5579 .It Fl alias
5580 Output the certificate alias.
5581 .It Fl clrreject
5582 Clear all the prohibited or rejected uses of the certificate.
5583 .It Fl clrtrust
5584 Clear all the permitted or trusted uses of the certificate.
5585 .It Fl purpose
5586 Perform tests on the certificate extensions.
5587 The same code is used when verifying untrusted certificates in chains,
5588 so this section is useful if a chain is rejected by the verify code.
5591 .Cm basicConstraints
5592 extension CA flag is used to determine whether the
5593 certificate can be used as a CA.
5594 If the CA flag is true, it is a CA;
5595 if the CA flag is false, it is not a CA.
5596 All CAs should have the CA flag set to true.
5598 If the
5599 .Cm basicConstraints
5600 extension is absent, then the certificate is
5601 considered to be a possible CA;
5602 other extensions are checked according to the intended use of the certificate.
5603 A warning is given in this case because the certificate should really not
5604 be regarded as a CA.
5605 However it is allowed to be a CA to work around some broken software.
5607 If the certificate is a V1 certificate
5608 (and thus has no extensions) and it is self-signed,
5609 it is also assumed to be a CA but a warning is again given.
5610 This is to work around the problem of Verisign roots
5611 which are V1 self-signed certificates.
5613 If the
5614 .Cm keyUsage
5615 extension is present, then additional restraints are
5616 made on the uses of the certificate.
5617 A CA certificate must have the
5618 .Cm keyCertSign
5619 bit set if the
5620 .Cm keyUsage
5621 extension is present.
5623 The extended key usage extension places additional restrictions on the
5624 certificate uses.
5625 If this extension is present, whether critical or not,
5626 the key can only be used for the purposes specified.
5628 A complete description of each test is given below.
5629 The comments about
5630 .Cm basicConstraints
5632 .Cm keyUsage
5633 and V1 certificates above apply to all CA certificates.
5634 .Bl -tag -width "XXXX"
5635 .It SSL Client
5636 The extended key usage extension must be absent or include the
5637 web client authentication OID.
5638 .Cm keyUsage
5639 must be absent or it must have the
5640 .Cm digitalSignature
5641 bit set.
5642 The Netscape certificate type must be absent
5643 or it must have the SSL client bit set.
5644 .It SSL Client CA
5645 The extended key usage extension must be absent or include the
5646 web client authentication OID.
5647 The Netscape certificate type must be absent
5648 or it must have the SSL CA bit set:
5649 this is used as a workaround if the
5650 .Cm basicConstraints
5651 extension is absent.
5652 .It SSL Server
5653 The extended key usage extension must be absent or include the
5654 web server authentication and/or one of the SGC OIDs.
5655 .Cm keyUsage
5656 must be absent or it must have the
5657 .Cm digitalSignature
5658 set, the
5659 .Cm keyEncipherment
5660 set, or both bits set.
5661 The Netscape certificate type must be absent or have the SSL server bit set.
5662 .It SSL Server CA
5663 The extended key usage extension must be absent or include the
5664 web server authentication and/or one of the SGC OIDs.
5665 The Netscape certificate type must be absent or the SSL CA bit must be set:
5666 this is used as a workaround if the
5667 .Cm basicConstraints
5668 extension is absent.
5669 .It Netscape SSL Server
5670 For Netscape SSL clients to connect to an SSL server; it must have the
5671 .Cm keyEncipherment
5672 bit set if the
5673 .Cm keyUsage
5674 extension is present.
5675 This isn't always valid because some cipher suites use the key for
5676 digital signing.
5677 Otherwise it is the same as a normal SSL server.
5678 .It Common S/MIME Client Tests
5679 The extended key usage extension must be absent or include the
5680 email protection OID.
5681 The Netscape certificate type must be absent or should have the S/MIME bit set.
5682 If the S/MIME bit is not set in Netscape certificate type, then the SSL
5683 client bit is tolerated as an alternative but a warning is shown:
5684 this is because some Verisign certificates don't set the S/MIME bit.
5685 .It S/MIME Signing
5686 In addition to the common S/MIME client tests, the
5687 .Cm digitalSignature
5688 bit must be set if the
5689 .Cm keyUsage
5690 extension is present.
5691 .It S/MIME Encryption
5692 In addition to the common S/MIME tests, the
5693 .Cm keyEncipherment
5694 bit must be set if the
5695 .Cm keyUsage
5696 extension is present.
5697 .It S/MIME CA
5698 The extended key usage extension must be absent or include the
5699 email protection OID.
5700 The Netscape certificate type must be absent
5701 or must have the S/MIME CA bit set:
5702 this is used as a workaround if the
5703 .Cm basicConstraints
5704 extension is absent.
5705 .It CRL Signing
5707 .Cm keyUsage
5708 extension must be absent or it must have the CRL signing bit set.
5709 .It CRL Signing CA
5710 The normal CA tests apply, except the
5711 .Cm basicConstraints
5712 extension must be present.
5714 .It Fl setalias Ar arg
5715 Set the alias of the certificate,
5716 allowing the certificate to be referred to using a nickname,
5717 such as
5718 .Qq Steve's Certificate .
5719 .It Fl trustout
5720 Output a trusted certificate
5721 (the default if any trust settings are modified).
5722 An ordinary or trusted certificate can be input, but by default an ordinary
5723 certificate is output and any trust settings are discarded.
5727 .Nm x509
5728 utility can be used to sign certificates and requests:
5729 it can thus behave like a mini CA.
5730 The following are x509 signing options:
5731 .Bl -tag -width "XXXX"
5732 .It Fl CA Ar file
5733 The CA certificate to be used for signing.
5734 When this option is present,
5735 .Nm x509
5736 behaves like a mini CA.
5737 The input file is signed by the CA using this option;
5738 that is, its issuer name is set to the subject name of the CA and it is
5739 digitally signed using the CA's private key.
5741 This option is normally combined with the
5742 .Fl req
5743 option.
5744 Without the
5745 .Fl req
5746 option, the input is a certificate which must be self-signed.
5747 .It Fl CAcreateserial
5748 Create the CA serial number file if it does not exist
5749 instead of generating an error.
5750 The file will contain the serial number
5751 .Sq 02
5752 and the certificate being signed will have
5753 .Sq 1
5754 as its serial number.
5755 .It Fl CAform Cm der | pem
5756 The format of the CA certificate file.
5757 The default is
5758 .Cm pem .
5759 .It Fl CAkey Ar file
5760 Set the CA private key to sign a certificate with.
5761 Otherwise it is assumed that the CA private key is present
5762 in the CA certificate file.
5763 .It Fl CAkeyform Cm der | pem
5764 The format of the CA private key.
5765 The default is
5766 .Cm pem .
5767 .It Fl CAserial Ar file
5768 Use the serial number in
5769 .Ar file
5770 to sign a certificate.
5771 The file should consist of one line containing an even number of hex digits
5772 with the serial number to use.
5773 After each use the serial number is incremented and written out
5774 to the file again.
5776 The default filename consists of the CA certificate file base name with
5777 .Pa .srl
5778 appended.
5779 For example, if the CA certificate file is called
5780 .Pa mycacert.pem ,
5781 it expects to find a serial number file called
5782 .Pa mycacert.srl .
5783 .It Fl checkend Ar arg
5784 Check whether the certificate expires in the next
5785 .Ar arg
5786 seconds.
5787 If so, exit with return value 1;
5788 otherwise exit with return value 0.
5789 .It Fl clrext
5790 Delete any extensions from a certificate.
5791 This option is used when a certificate is being created from another
5792 certificate (for example with the
5793 .Fl signkey
5794 or the
5795 .Fl CA
5796 options).
5797 Normally, all extensions are retained.
5798 .It Fl days Ar arg
5799 The number of days to make a certificate valid for.
5800 The default is 30 days.
5801 .It Fl extensions Ar section
5802 The section to add certificate extensions from.
5803 If this option is not specified, the extensions should either be
5804 contained in the unnamed (default) section
5805 or the default section should contain a variable called
5806 .Qq extensions
5807 which contains the section to use.
5808 .It Fl extfile Ar file
5809 File containing certificate extensions to use.
5810 If not specified, no extensions are added to the certificate.
5811 .It Fl keyform Cm der | pem
5812 The format of the private key file used in the
5813 .Fl signkey
5814 option.
5815 .It Fl req
5816 Expect a certificate request on input instead of a certificate.
5817 .It Fl set_serial Ar n
5818 The serial number to use.
5819 This option can be used with either the
5820 .Fl signkey
5822 .Fl CA
5823 options.
5824 If used in conjunction with the
5825 .Fl CA
5826 option, the serial number file (as specified by the
5827 .Fl CAserial
5829 .Fl CAcreateserial
5830 options) is not used.
5832 The serial number can be decimal or hex (if preceded by
5833 .Sq 0x ) .
5834 Negative serial numbers can also be specified but their use is not recommended.
5835 .It Fl signkey Ar file
5836 Self-sign
5837 .Ar file
5838 using the supplied private key.
5840 If the input file is a certificate, it sets the issuer name to the
5841 subject name (i.e. makes it self-signed),
5842 changes the public key to the supplied value,
5843 and changes the start and end dates.
5844 The start date is set to the current time and the end date is set to
5845 a value determined by the
5846 .Fl days
5847 option.
5848 Any certificate extensions are retained unless the
5849 .Fl clrext
5850 option is supplied.
5852 If the input is a certificate request, a self-signed certificate
5853 is created using the supplied private key using the subject name in
5854 the request.
5855 .It Fl x509toreq
5856 Convert a certificate into a certificate request.
5858 .Fl signkey
5859 option is used to pass the required private key.
5861 .Sh COMMON NOTATION
5862 Several commands share a common syntax,
5863 as detailed below.
5865 Password arguments, typically specified using
5866 .Fl passin
5868 .Fl passout
5869 for input and output passwords,
5870 allow passwords to be obtained from a variety of sources.
5871 Both of these options take a single argument, described below.
5872 If no password argument is given and a password is required,
5873 then the user is prompted to enter one:
5874 this will typically be read from the current terminal with echoing turned off.
5875 .Bl -tag -width "pass:password" -offset indent
5876 .It Cm pass : Ns Ar password
5877 The actual password is
5878 .Ar password .
5879 Since the password is visible to utilities,
5880 this form should only be used where security is not important.
5881 .It Cm env : Ns Ar var
5882 Obtain the password from the environment variable
5883 .Ar var .
5884 Since the environment of other processes is visible,
5885 this option should be used with caution.
5886 .It Cm file : Ns Ar path
5887 The first line of
5888 .Ar path
5889 is the password.
5890 If the same
5891 .Ar path
5892 argument is supplied to
5893 .Fl passin
5895 .Fl passout ,
5896 then the first line will be used for the input password and the next line
5897 for the output password.
5898 .Ar path
5899 need not refer to a regular file:
5900 it could, for example, refer to a device or named pipe.
5901 .It Cm fd : Ns Ar number
5902 Read the password from the file descriptor
5903 .Ar number .
5904 This can be used to send the data via a pipe, for example.
5905 .It Cm stdin
5906 Read the password from standard input.
5909 Input/output formats,
5910 typically specified using
5911 .Fl inform
5913 .Fl outform ,
5914 indicate the format being read from or written to.
5915 The argument is case insensitive.
5917 .Bl -tag -width Ds -offset indent -compact
5918 .It Cm der
5919 Distinguished Encoding Rules (DER)
5920 is a binary format.
5921 .It Cm net
5922 Insecure legacy format.
5923 .It Cm pem
5924 Privacy Enhanced Mail (PEM)
5925 is base64-encoded.
5926 .It Cm smime
5927 An SMIME format message.
5928 .It Cm txt
5929 Plain ASCII text.
5931 .Sh ENVIRONMENT
5932 The following environment variables affect the execution of
5933 .Nm openssl :
5934 .Bl -tag -width "/etc/ssl/openssl.cnf"
5935 .It Ev OPENSSL_CONF
5936 The location of the master configuration file.
5938 .Sh FILES
5939 .Bl -tag -width "/etc/ssl/openssl.cnf" -compact
5940 .It Pa /etc/ssl/
5941 Default config directory for
5942 .Nm openssl .
5943 .It Pa /etc/ssl/lib/
5944 Unused.
5945 .It Pa /etc/ssl/private/
5946 Default private key directory.
5947 .It Pa /etc/ssl/openssl.cnf
5948 Default configuration file for
5949 .Nm openssl .
5950 .It Pa /etc/ssl/x509v3.cnf
5951 Default configuration file for
5952 .Nm x509
5953 certificates.
5955 .Sh SEE ALSO
5956 .Xr acme-client 1 ,
5957 .Xr nc 1 ,
5958 .Xr openssl.cnf 5 ,
5959 .Xr x509v3.cnf 5 ,
5960 .Xr ssl 8 ,
5961 .Xr starttls 8
5962 .Sh STANDARDS
5964 .%A T. Dierks
5965 .%A C. Allen
5966 .%D January 1999
5967 .%R RFC 2246
5968 .%T The TLS Protocol Version 1.0
5972 .%A M. Wahl
5973 .%A S. Killie
5974 .%A T. Howes
5975 .%D December 1997
5976 .%R RFC 2253
5977 .%T Lightweight Directory Access Protocol (v3): UTF-8 String Representation of Distinguished Names
5981 .%A B. Kaliski
5982 .%D March 1998
5983 .%R RFC 2315
5984 .%T PKCS #7: Cryptographic Message Syntax Version 1.5
5988 .%A R. Housley
5989 .%A W. Ford
5990 .%A W. Polk
5991 .%A D. Solo
5992 .%D January 1999
5993 .%R RFC 2459
5994 .%T Internet X.509 Public Key Infrastructure Certificate and CRL Profile
5998 .%A M. Myers
5999 .%A R. Ankney
6000 .%A A. Malpani
6001 .%A S. Galperin
6002 .%A C. Adams
6003 .%D June 1999
6004 .%R RFC 2560
6005 .%T X.509 Internet Public Key Infrastructure Online Certificate Status Protocol \(en OCSP
6009 .%A R. Housley
6010 .%D June 1999
6011 .%R RFC 2630
6012 .%T Cryptographic Message Syntax
6016 .%A P. Chown
6017 .%D June 2002
6018 .%R RFC 3268
6019 .%T Advanced Encryption Standard (AES) Ciphersuites for Transport Layer Security (TLS)