Annotation of src/usr.bin/openssl/openssl.1, Revision 1.93
1.93 ! schwarze 1: .\" $OpenBSD: openssl.1,v 1.92 2018/03/31 12:46:12 schwarze Exp $
1.1 jsing 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.
107: .\"
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.]
112: .\"
1.93 ! schwarze 113: .Dd $Mdocdate: March 31 2018 $
1.1 jsing 114: .Dt OPENSSL 1
115: .Os
116: .Sh NAME
117: .Nm openssl
118: .Nd OpenSSL command line tool
119: .Sh SYNOPSIS
120: .Nm
1.90 schwarze 121: .Ar command
1.1 jsing 122: .Op Ar command_opts
123: .Op Ar command_args
124: .Pp
125: .Nm
1.13 bentley 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 |
1.1 jsing 131: .Cm list-public-key-algorithms
132: .Pp
133: .Nm
1.39 jmc 134: .Cm no- Ns Ar command
1.1 jsing 135: .Sh DESCRIPTION
136: .Nm OpenSSL
1.31 jmc 137: is a cryptography toolkit implementing the
138: Transport Layer Security
1.1 jsing 139: .Pq TLS v1
1.31 jmc 140: network protocol,
141: as well as related cryptography standards.
1.1 jsing 142: .Pp
143: The
144: .Nm
145: program is a command line tool for using the various
146: cryptography functions of
1.39 jmc 147: .Nm openssl Ns 's
1.33 jmc 148: crypto library from the shell.
1.1 jsing 149: .Pp
150: The pseudo-commands
151: .Cm list-standard-commands , list-message-digest-commands ,
152: and
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
158: .Nm
159: utility.
160: .Pp
161: The pseudo-commands
162: .Cm list-cipher-algorithms
163: and
164: .Cm list-message-digest-algorithms
165: list all cipher and message digest names,
166: one entry per line.
167: Aliases are listed as:
168: .Pp
1.33 jmc 169: .D1 from => to
1.1 jsing 170: .Pp
171: The pseudo-command
172: .Cm list-public-key-algorithms
173: lists all supported public key algorithms.
174: .Pp
175: The pseudo-command
1.39 jmc 176: .Cm no- Ns Ar command
1.1 jsing 177: tests whether a command of the
178: specified name is available.
1.39 jmc 179: If
180: .Ar command
181: does not exist,
1.1 jsing 182: it returns 0
183: and prints
1.39 jmc 184: .Cm no- Ns Ar command ;
1.1 jsing 185: otherwise it returns 1 and prints
1.39 jmc 186: .Ar command .
187: In both cases, the output goes to stdout and nothing is printed to stderr.
1.1 jsing 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
192: .Nm
193: program.
194: .Pp
195: .Sy Note :
1.39 jmc 196: .Cm no- Ns Ar command
1.1 jsing 197: is not able to detect pseudo-commands such as
198: .Cm quit ,
199: .Cm list- Ns Ar ... Ns Cm -commands ,
200: or
1.39 jmc 201: .Cm no- Ns Ar command
1.1 jsing 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
1.34 jmc 212: .Op Fl inform Cm der | pem | txt
1.1 jsing 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
220: .Pp
221: The
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.
225: .Pp
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 ,
1.34 jmc 239: or both, using the format described in
240: .Xr ASN1_generate_nconf 3 .
1.1 jsing 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 .
1.84 jmc 246: The encoded data is passed through the ASN.1 parser and printed out as
1.1 jsing 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
1.34 jmc 252: Indent the output according to the
1.1 jsing 253: .Qq depth
254: of the structures.
255: .It Fl in Ar file
1.41 jmc 256: The input file to read from, or standard input if not specified.
1.34 jmc 257: .It Fl inform Cm der | pem | txt
1.1 jsing 258: The input format.
259: .It Fl length Ar number
1.34 jmc 260: Number of bytes to parse; the default is until end of file.
1.1 jsing 261: .It Fl noout
1.46 jmc 262: Do not output the parsed version of the input file.
1.1 jsing 263: .It Fl offset Ar number
1.34 jmc 264: Starting offset to begin parsing; the default is start of file.
1.1 jsing 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
1.34 jmc 271: .Nm openssl Ns 's
1.1 jsing 272: internal table it will be represented in
273: numerical form
274: .Pq for example 1.2.3.4 .
1.34 jmc 275: .Pp
1.1 jsing 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
1.34 jmc 280: .Qq short name ,
1.1 jsing 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.
1.34 jmc 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.
296: .El
1.1 jsing 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
1.91 schwarze 303: .Op Fl create_serial
1.1 jsing 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
1.91 schwarze 318: .Op Fl key Ar password
1.1 jsing 319: .Op Fl keyfile Ar arg
1.91 schwarze 320: .Op Fl keyform Cm pem | der
1.1 jsing 321: .Op Fl md Ar arg
322: .Op Fl msie_hack
1.91 schwarze 323: .Op Fl multivalue\-rdn
1.1 jsing 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
1.91 schwarze 333: .Op Fl selfsign
1.1 jsing 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
1.91 schwarze 340: .Op Fl utf8
1.1 jsing 341: .Op Fl verbose
342: .nr nS 0
343: .Pp
344: The
345: .Nm ca
1.35 jmc 346: command is a minimal certificate authority (CA) application.
1.1 jsing 347: It can be used to sign certificate requests in a variety of forms
1.35 jmc 348: and generate certificate revocation lists (CRLs).
1.1 jsing 349: It also maintains a text database of issued certificates and their status.
350: .Pp
1.35 jmc 351: The options relevant to CAs are as follows:
1.1 jsing 352: .Bl -tag -width "XXXX"
353: .It Fl batch
1.41 jmc 354: Batch mode.
1.1 jsing 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
1.72 jmc 360: Specify an alternative configuration file.
1.91 schwarze 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.
1.1 jsing 365: .It Fl days Ar arg
366: The number of days to certify the certificate for.
367: .It Fl enddate Ar date
1.41 jmc 368: Set the expiry date.
1.88 jmc 369: The format of the date is [YY]YYMMDDHHMMSSZ,
370: with all four year digits required for dates from 2050 onwards.
1.1 jsing 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
1.35 jmc 374: .Cm x509_extensions
1.1 jsing 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.
1.91 schwarze 382: See the
383: .Xr x509v3.cnf 5
384: manual page for details of the extension section format.
1.1 jsing 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.
1.91 schwarze 399: .It Fl key Ar password
400: The
401: .Fa password
402: used to encrypt the private key.
1.35 jmc 403: Since on some systems the command line arguments are visible,
404: this option should be used with caution.
1.1 jsing 405: .It Fl keyfile Ar file
406: The private key to sign requests with.
1.91 schwarze 407: .It Fl keyform Cm pem | der
1.1 jsing 408: Private key file format.
1.91 schwarze 409: The default is
410: .Cm pem .
1.1 jsing 411: .It Fl md Ar alg
412: The message digest to use.
413: Possible values include
414: .Ar md5
415: and
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.
1.91 schwarze 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" .
435: If
436: .Fl multivalue\-rdn
437: is not used, the UID value is set to
438: .Qq "123456+CN=John Doe" .
1.1 jsing 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
1.30 mmcc 449: request DN, however it is good policy just having the email set into
1.1 jsing 450: the
1.35 jmc 451: .Cm altName
1.1 jsing 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.
455: The
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.
1.91 schwarze 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.
1.1 jsing 467: .It Fl outdir Ar directory
468: The
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
1.41 jmc 478: Define the CA
1.1 jsing 479: .Qq policy
480: to use.
1.35 jmc 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.
1.1 jsing 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.
1.91 schwarze 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.
508: If
509: .Fl gencrl ,
510: .Fl spkac ,
511: or
512: .Fl ss_cert
513: are given,
514: .Fl selfsign
515: is ignored.
516: .Pp
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.
1.1 jsing 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.
1.35 jmc 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.
532: .Pp
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 \&. .
1.1 jsing 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
1.41 jmc 541: Set the start date.
1.88 jmc 542: The format of the date is [YY]YYMMDDHHMMSSZ,
543: with all four year digits required for dates from 2050 onwards.
1.91 schwarze 544: .It Fl subj Ar arg
545: Supersedes the subject name given in the request.
546: The
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.
1.1 jsing 561: .It Fl verbose
1.41 jmc 562: Print extra details about the operations being performed.
1.1 jsing 563: .El
1.35 jmc 564: .Pp
565: The options relevant to CRLs are as follows:
1.1 jsing 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
1.41 jmc 572: Set the revocation reason to keyCompromise and the compromise time to
1.1 jsing 573: .Ar time .
574: .Ar time
575: should be in GeneralizedTime format, i.e. YYYYMMDDHHMMSSZ.
576: .It Fl crl_hold Ar instruction
1.41 jmc 577: Set the CRL revocation reason code to certificateHold and the hold
1.1 jsing 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
1.35 jmc 599: .Cm nextUpdate
1.1 jsing 600: field.
601: .It Fl crlexts Ar section
602: The
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
1.81 jmc 607: (even if it is empty)
1.1 jsing 608: then a V2 CRL is created.
1.81 jmc 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.
1.91 schwarze 611: See the
612: .Xr x509v3.cnf 5
613: manual page for details of the extension section format.
1.1 jsing 614: .It Fl crlhours Ar num
615: The number of hours before the next CRL is due.
616: .It Fl gencrl
1.41 jmc 617: Generate a CRL based on information in the index file.
1.1 jsing 618: .It Fl revoke Ar file
619: A
620: .Ar file
621: containing a certificate to revoke.
1.91 schwarze 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.
1.1 jsing 627: .El
628: .Pp
1.35 jmc 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
635: or
636: .Fl name .
637: The options
638: .Cm preserve
639: and
640: .Cm msie_hack
641: are read directly from the
642: .Cm ca
643: section.
1.1 jsing 644: .Pp
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"
1.35 jmc 654: .It Cm certificate
1.1 jsing 655: The same as
656: .Fl cert .
657: It gives the file containing the CA certificate.
658: Mandatory.
1.35 jmc 659: .It Cm copy_extensions
1.1 jsing 660: Determines how extensions in certificate requests should be handled.
661: If set to
1.35 jmc 662: .Cm none
1.1 jsing 663: or this option is not present, then extensions are
664: ignored and not copied to the certificate.
665: If set to
1.35 jmc 666: .Cm copy ,
1.1 jsing 667: then any extensions present in the request that are not already present
668: are copied to the certificate.
669: If set to
1.35 jmc 670: .Cm copyall ,
1.1 jsing 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.
1.35 jmc 673: .Pp
674: The
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
1.91 schwarze 685: this when the certificate is displayed, then this will hand the requester
1.35 jmc 686: a valid CA certificate.
687: .Pp
688: This situation can be avoided by setting
689: .Cm copy_extensions
690: to
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.
1.1 jsing 698: .Pp
699: The main use of this option is to allow a certificate request to supply
700: values for certain extensions such as
1.35 jmc 701: .Cm subjectAltName .
702: .It Cm crl_extensions
1.1 jsing 703: The same as
704: .Fl crlexts .
1.35 jmc 705: .It Cm crlnumber
1.1 jsing 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.
1.35 jmc 709: .It Cm database
1.1 jsing 710: The text database file to use.
711: Mandatory.
712: This file must be present, though initially it will be empty.
1.35 jmc 713: .It Cm default_crl_hours , default_crl_days
1.1 jsing 714: The same as the
715: .Fl crlhours
716: and
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.
1.35 jmc 721: .It Cm default_days
1.1 jsing 722: The same as the
723: .Fl days
724: option.
725: The number of days to certify a certificate for.
1.35 jmc 726: .It Cm default_enddate
1.1 jsing 727: The same as the
728: .Fl enddate
729: option.
730: Either this option or
1.35 jmc 731: .Cm default_days
1.1 jsing 732: .Pq or the command line equivalents
733: must be present.
1.35 jmc 734: .It Cm default_md
1.1 jsing 735: The same as the
736: .Fl md
737: option.
738: The message digest to use.
739: Mandatory.
1.35 jmc 740: .It Cm default_startdate
1.1 jsing 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.
1.35 jmc 746: .It Cm email_in_dn
1.1 jsing 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.
1.35 jmc 754: .It Cm msie_hack
1.1 jsing 755: The same as
756: .Fl msie_hack .
1.35 jmc 757: .It Cm name_opt , cert_opt
1.1 jsing 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
764: and
765: .Fl certopt
766: switches can be used here, except that
1.35 jmc 767: .Cm no_signame
1.1 jsing 768: and
1.35 jmc 769: .Cm no_sigdump
1.1 jsing 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).
773: .Pp
774: For convenience, the value
1.35 jmc 775: .Cm ca_default
1.1 jsing 776: is accepted by both to produce a reasonable output.
777: .Pp
778: If neither option is present, the format used in earlier versions of
1.35 jmc 779: .Nm openssl
1.1 jsing 780: is used.
1.81 jmc 781: Use of the old format is strongly discouraged
782: because it only displays fields mentioned in the
1.35 jmc 783: .Cm policy
1.1 jsing 784: section,
785: mishandles multicharacter string types and does not display extensions.
1.35 jmc 786: .It Cm new_certs_dir
1.1 jsing 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.
1.35 jmc 792: .It Cm oid_file
1.1 jsing 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.
1.35 jmc 797: .It Cm oid_section
1.1 jsing 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.
1.35 jmc 805: .It Cm policy
1.1 jsing 806: The same as
807: .Fl policy .
808: Mandatory.
1.35 jmc 809: .It Cm preserve
1.1 jsing 810: The same as
811: .Fl preserveDN .
1.35 jmc 812: .It Cm private_key
1.1 jsing 813: Same as the
814: .Fl keyfile
815: option.
816: The file containing the CA private key.
817: Mandatory.
1.35 jmc 818: .It Cm serial
1.1 jsing 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.
1.35 jmc 822: .It Cm unique_subject
1.1 jsing 823: If the value
1.35 jmc 824: .Cm yes
1.1 jsing 825: is given, the valid certificate entries in the
826: database must have unique subjects.
827: If the value
1.35 jmc 828: .Cm no
1.1 jsing 829: is given,
830: several valid certificate entries may have the exact same subject.
831: The default value is
1.35 jmc 832: .Cm yes .
833: .It Cm x509_extensions
1.1 jsing 834: The same as
835: .Fl extensions .
836: .El
837: .Sh CIPHERS
838: .Nm openssl ciphers
839: .Op Fl hVv
1.93 ! schwarze 840: .Op Ar control
1.1 jsing 841: .Pp
842: The
843: .Nm ciphers
1.93 ! schwarze 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.
1.1 jsing 854: .Pp
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
1.36 jmc 860: Verbose.
1.92 schwarze 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.
1.36 jmc 864: .It Fl v
1.1 jsing 865: Like
1.36 jmc 866: .Fl V ,
867: but without cipher suite codes.
1.1 jsing 868: .El
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
1.38 jmc 877: .Op Fl inform Cm der | pem
1.1 jsing 878: .Op Fl issuer
879: .Op Fl lastupdate
880: .Op Fl nextupdate
881: .Op Fl noout
882: .Op Fl out Ar file
1.38 jmc 883: .Op Fl outform Cm der | pem
1.1 jsing 884: .Op Fl text
885: .nr nS 0
886: .Pp
887: The
888: .Nm crl
889: command processes CRL files in DER or PEM format.
1.37 jmc 890: .Pp
1.1 jsing 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
1.37 jmc 909: The input file to read from, or standard input if not specified.
1.38 jmc 910: .It Fl inform Cm der | pem
1.37 jmc 911: The input format.
1.1 jsing 912: .It Fl issuer
913: Output the issuer name.
914: .It Fl lastupdate
915: Output the
1.37 jmc 916: .Cm lastUpdate
1.1 jsing 917: field.
918: .It Fl nextupdate
919: Output the
1.37 jmc 920: .Cm nextUpdate
1.1 jsing 921: field.
922: .It Fl noout
1.46 jmc 923: Do not output the encoded version of the CRL.
1.1 jsing 924: .It Fl out Ar file
1.37 jmc 925: The output file to write to, or standard output if not specified.
1.38 jmc 926: .It Fl outform Cm der | pem
1.37 jmc 927: The output format.
1.1 jsing 928: .It Fl text
1.64 jmc 929: Print the CRL in plain text.
1.1 jsing 930: .El
931: .Sh CRL2PKCS7
932: .nr nS 1
933: .Nm "openssl crl2pkcs7"
934: .Op Fl certfile Ar file
935: .Op Fl in Ar file
1.40 jmc 936: .Op Fl inform Cm der | pem
1.1 jsing 937: .Op Fl nocrl
938: .Op Fl out Ar file
1.40 jmc 939: .Op Fl outform Cm der | pem
1.1 jsing 940: .nr nS 0
941: .Pp
942: The
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.
948: .Pp
949: The options are as follows:
950: .Bl -tag -width Ds
951: .It Fl certfile Ar file
1.40 jmc 952: Add the certificates in PEM
1.1 jsing 953: .Ar file
1.40 jmc 954: to the PKCS#7 structure.
955: This option can be used more than once
956: to read certificates from multiple files.
1.1 jsing 957: .It Fl in Ar file
1.40 jmc 958: Read the CRL from
959: .Ar file ,
960: or standard input if not specified.
961: .It Fl inform Cm der | pem
1.64 jmc 962: The input format.
1.1 jsing 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
1.40 jmc 968: Write the PKCS#7 structure to
969: .Ar file ,
970: or standard output if not specified.
971: .It Fl outform Cm der | pem
1.64 jmc 972: The output format.
1.1 jsing 973: .El
974: .Sh DGST
975: .nr nS 1
976: .Nm "openssl dgst"
1.43 jmc 977: .Op Fl cd
1.1 jsing 978: .Op Fl binary
1.43 jmc 979: .Op Fl Ar digest
1.1 jsing 980: .Op Fl hex
981: .Op Fl hmac Ar key
1.43 jmc 982: .Op Fl keyform Cm pem
1.1 jsing 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
994: .Pp
995: The digest functions output the message digest of a supplied
996: .Ar file
997: or
998: .Ar files
999: in hexadecimal form.
1000: They can also be used for digital signing and verification.
1001: .Pp
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
1.48 jmc 1007: Print the digest in two-digit groups separated by colons.
1.1 jsing 1008: .It Fl d
1.48 jmc 1009: Print BIO debugging information.
1.43 jmc 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
1020: and
1021: .Nm openssl
1022: .Cm md5 .
1.1 jsing 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 .
1.43 jmc 1031: .It Fl keyform Cm pem
1.1 jsing 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
1.43 jmc 1045: .It Cm key : Ns Ar string
1.1 jsing 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.
1.43 jmc 1049: .It Cm hexkey : Ns Ar string
1.1 jsing 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.
1052: .El
1053: .It Fl out Ar file
1.43 jmc 1054: The output file to write to,
1055: or standard output if not specified.
1.1 jsing 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
1063: or
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
1078: or
1079: .Qq Verification Failure .
1080: .It Ar
1081: File or files to digest.
1082: If no files are specified then standard input is used.
1083: .El
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
1.44 jmc 1092: .Op Fl inform Cm der | pem
1.1 jsing 1093: .Op Fl noout
1094: .Op Fl out Ar file
1.44 jmc 1095: .Op Fl outform Cm der | pem
1.1 jsing 1096: .Op Fl text
1097: .Op Ar numbits
1098: .nr nS 0
1099: .Pp
1100: The
1101: .Nm dhparam
1102: command is used to manipulate DH parameter files.
1.44 jmc 1103: Only the older PKCS#3 DH is supported,
1104: not the newer X9.42 DH.
1.1 jsing 1105: .Pp
1106: The options are as follows:
1107: .Bl -tag -width Ds
1108: .It Fl 2 , 5
1.44 jmc 1109: The generator to use;
1.1 jsing 1110: 2 is the default.
1111: If present, the input file is ignored and parameters are generated instead.
1112: .It Fl C
1.44 jmc 1113: Convert the parameters into C code.
1.1 jsing 1114: The parameters can then be loaded by calling the
1.44 jmc 1115: .No get_dh Ns Ar numbits
1.1 jsing 1116: function.
1117: .It Fl check
1118: Check the DH parameters.
1119: .It Fl dsaparam
1.44 jmc 1120: Read or create DSA parameters,
1121: converted to DH format on output.
1.1 jsing 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.
1127: .Pp
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
1.44 jmc 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.
1.1 jsing 1141: .It Fl noout
1.46 jmc 1142: Do not output the encoded version of the parameters.
1.44 jmc 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
1.64 jmc 1149: Print the DH parameters in plain text.
1.1 jsing 1150: .It Ar numbits
1.44 jmc 1151: Generate a parameter set of size
1.1 jsing 1152: .Ar numbits .
1153: It must be the last option.
1.16 sthen 1154: If not present, a value of 2048 is used.
1.1 jsing 1155: If this value is present, the input file is ignored and
1156: parameters are generated instead.
1157: .El
1158: .Sh DSA
1159: .nr nS 1
1160: .Nm "openssl dsa"
1161: .Oo
1162: .Fl aes128 | aes192 | aes256 |
1163: .Fl des | des3
1164: .Oc
1165: .Op Fl in Ar file
1.45 jmc 1166: .Op Fl inform Cm der | pem
1.1 jsing 1167: .Op Fl modulus
1168: .Op Fl noout
1169: .Op Fl out Ar file
1.45 jmc 1170: .Op Fl outform Cm der | pem
1.1 jsing 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
1177: .Pp
1178: The
1179: .Nm dsa
1180: command processes DSA keys.
1181: They can be converted between various forms and their components printed out.
1182: .Pp
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.
1190: .Pp
1191: The options are as follows:
1192: .Bl -tag -width Ds
1193: .It Xo
1194: .Fl aes128 | aes192 | aes256 |
1195: .Fl des | des3
1196: .Xc
1.45 jmc 1197: Encrypt the private key with the AES, DES, or the triple DES
1.1 jsing 1198: ciphers, respectively, before outputting it.
1199: A pass phrase is prompted for.
1.45 jmc 1200: If none of these options are specified, the key is written in plain text.
1.1 jsing 1201: This means that using the
1202: .Nm dsa
1.45 jmc 1203: utility to read an encrypted key with no encryption option can be used to
1.1 jsing 1204: remove the pass phrase from a key,
1.45 jmc 1205: or by setting the encryption options it can be used to add or change
1.1 jsing 1206: the pass phrase.
1207: These options can only be used with PEM format output files.
1208: .It Fl in Ar file
1.45 jmc 1209: The input file to read from,
1210: or standard input if not specified.
1.1 jsing 1211: If the key is encrypted, a pass phrase will be prompted for.
1.45 jmc 1212: .It Fl inform Cm der | pem
1213: The input format.
1.1 jsing 1214: .It Fl modulus
1.45 jmc 1215: Print the value of the public key component of the key.
1.1 jsing 1216: .It Fl noout
1.46 jmc 1217: Do not output the encoded version of the key.
1.1 jsing 1218: .It Fl out Ar file
1.45 jmc 1219: The output file to write to,
1220: or standard output if not specified.
1.1 jsing 1221: If any encryption options are set then a pass phrase will be
1222: prompted for.
1.45 jmc 1223: .It Fl outform Cm der | pem
1224: The output format.
1.1 jsing 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
1.60 jmc 1230: Read in a public key, not a private key.
1.1 jsing 1231: .It Fl pubout
1.60 jmc 1232: Output a public key, not a private key.
1233: Automatically set if the input is a public key.
1.1 jsing 1234: .It Fl text
1.64 jmc 1235: Print the public/private key in plain text.
1.1 jsing 1236: .El
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
1.46 jmc 1243: .Op Fl inform Cm der | pem
1.1 jsing 1244: .Op Fl noout
1245: .Op Fl out Ar file
1.46 jmc 1246: .Op Fl outform Cm der | pem
1.1 jsing 1247: .Op Fl text
1248: .Op Ar numbits
1249: .nr nS 0
1250: .Pp
1251: The
1252: .Nm dsaparam
1253: command is used to manipulate or generate DSA parameter files.
1254: .Pp
1255: The options are as follows:
1256: .Bl -tag -width Ds
1257: .It Fl C
1.46 jmc 1258: Convert the parameters into C code.
1.1 jsing 1259: The parameters can then be loaded by calling the
1.46 jmc 1260: .No get_dsa Ns Ar XXX
1.1 jsing 1261: function.
1262: .It Fl genkey
1.46 jmc 1263: Generate a DSA key either using the specified or generated
1.1 jsing 1264: parameters.
1265: .It Fl in Ar file
1.46 jmc 1266: The input file to read from,
1267: or standard input if not specified.
1.1 jsing 1268: If the
1269: .Ar numbits
1.46 jmc 1270: parameter is included, then this option is ignored.
1271: .It Fl inform Cm der | pem
1272: The input format.
1.1 jsing 1273: .It Fl noout
1.46 jmc 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
1.64 jmc 1281: Print the DSA parameters in plain text.
1.1 jsing 1282: .It Ar numbits
1.46 jmc 1283: Generate a parameter set of size
1.1 jsing 1284: .Ar numbits .
1.46 jmc 1285: If this option is included, the input file is ignored.
1.1 jsing 1286: .El
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
1.47 jmc 1294: .Op Fl inform Cm der | pem
1.1 jsing 1295: .Op Fl noout
1296: .Op Fl out Ar file
1.47 jmc 1297: .Op Fl outform Cm der | pem
1.1 jsing 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
1306: .Pp
1307: The
1308: .Nm ec
1309: command processes EC keys.
1310: They can be converted between various
1311: forms and their components printed out.
1.47 jmc 1312: .Nm openssl
1.1 jsing 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.
1320: .Pp
1321: The options are as follows:
1322: .Bl -tag -width Ds
1323: .It Fl conv_form Ar arg
1.47 jmc 1324: Specify how the points on the elliptic curve are converted
1.1 jsing 1325: into octet strings.
1326: Possible values are:
1327: .Cm compressed
1.47 jmc 1328: (the default),
1.1 jsing 1329: .Cm uncompressed ,
1330: and
1331: .Cm hybrid .
1332: For more information regarding
1.47 jmc 1333: the point conversion forms see the X9.62 standard.
1.1 jsing 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
1.47 jmc 1339: .Dv OPENSSL_EC_BIN_PT_COMP
1.1 jsing 1340: at compile time.
1341: .It Fl des | des3
1.47 jmc 1342: Encrypt the private key with DES, triple DES, or
1.1 jsing 1343: any other cipher supported by
1.47 jmc 1344: .Nm openssl .
1.1 jsing 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
1.83 naddy 1352: it can be used to add or change the pass phrase.
1.1 jsing 1353: These options can only be used with PEM format output files.
1354: .It Fl in Ar file
1.47 jmc 1355: The input file to read a key from,
1356: or standard input if not specified.
1.1 jsing 1357: If the key is encrypted a pass phrase will be prompted for.
1.47 jmc 1358: .It Fl inform Cm der | pem
1359: The input format.
1.1 jsing 1360: .It Fl noout
1.47 jmc 1361: Do not output the encoded version of the key.
1.1 jsing 1362: .It Fl out Ar file
1.47 jmc 1363: The output filename to write to,
1364: or standard output if not specified.
1.1 jsing 1365: If any encryption options are set then a pass phrase will be prompted for.
1.47 jmc 1366: .It Fl outform Cm der | pem
1367: The output format.
1.1 jsing 1368: .It Fl param_enc Ar arg
1.47 jmc 1369: Specify how the elliptic curve parameters are encoded.
1.1 jsing 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,
1.47 jmc 1382: is currently not implemented.
1.1 jsing 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
1.60 jmc 1388: Read in a public key, not a private key.
1.1 jsing 1389: .It Fl pubout
1.60 jmc 1390: Output a public key, not a private key.
1391: Automatically set if the input is a public key.
1.1 jsing 1392: .It Fl text
1.64 jmc 1393: Print the public/private key in plain text.
1.1 jsing 1394: .El
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
1.48 jmc 1403: .Op Fl inform Cm der | pem
1.1 jsing 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
1.48 jmc 1409: .Op Fl outform Cm der | pem
1.1 jsing 1410: .Op Fl param_enc Ar arg
1411: .Op Fl text
1412: .nr nS 0
1413: .Pp
1.48 jmc 1414: The
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.
1421: .Pp
1.1 jsing 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
1.48 jmc 1427: .No get_ec_group_ Ns Ar XXX
1.1 jsing 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
1.48 jmc 1436: (the default),
1.1 jsing 1437: .Cm uncompressed ,
1438: and
1439: .Cm hybrid .
1440: For more information regarding
1.48 jmc 1441: the point conversion forms see the X9.62 standard.
1.1 jsing 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
1.48 jmc 1447: .Dv OPENSSL_EC_BIN_PT_COMP
1.1 jsing 1448: at compile time.
1449: .It Fl genkey
1450: Generate an EC private key using the specified parameters.
1451: .It Fl in Ar file
1.48 jmc 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.
1.1 jsing 1456: .It Fl list_curves
1.48 jmc 1457: Print a list of all
1.1 jsing 1458: currently implemented EC parameter names and exit.
1459: .It Fl name Ar arg
1.48 jmc 1460: Use the EC parameters with the specified "short" name.
1.1 jsing 1461: .It Fl no_seed
1.48 jmc 1462: Do not include the seed for the parameter generation
1463: in the ECParameters structure (see RFC 3279).
1.1 jsing 1464: .It Fl noout
1.48 jmc 1465: Do not output the encoded version of the parameters.
1.1 jsing 1466: .It Fl out Ar file
1.48 jmc 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.
1.1 jsing 1471: .It Fl param_enc Ar arg
1.48 jmc 1472: Specify how the elliptic curve parameters are encoded.
1.1 jsing 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,
1.48 jmc 1484: is currently not implemented.
1.1 jsing 1485: .It Fl text
1.64 jmc 1486: Print the EC parameters in plain text.
1.1 jsing 1487: .El
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
1510: .Pp
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.
1.49 jmc 1516: The program can be called either as
1517: .Nm openssl Ar ciphername
1518: or
1519: .Nm openssl enc - Ns Ar ciphername .
1520: .Pp
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.
1.1 jsing 1527: .Pp
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.
1.49 jmc 1538: If decryption is set, the input data is base64-decoded before
1.1 jsing 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
1.49 jmc 1547: Encrypt the input data.
1548: This is the default.
1.1 jsing 1549: .It Fl in Ar file
1.49 jmc 1550: The input file to read from,
1.57 jmc 1551: or standard input if not specified.
1.1 jsing 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
1.49 jmc 1562: option,
1563: the IV must explicitly be defined.
1.1 jsing 1564: When a password is being specified using one of the other options,
1.49 jmc 1565: the IV is generated from this password.
1.1 jsing 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.
1.49 jmc 1571: If only the key is specified,
1572: the IV must also be specified using the
1.1 jsing 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
1.49 jmc 1583: option will be used and the IV generated from the password will be taken.
1.1 jsing 1584: It probably does not make much sense to specify both
1585: .Ar key
1586: and
1587: .Ar password .
1588: .It Fl k Ar password
1589: The
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
1602: Use
1603: .Ar digest
1604: to create a key from a pass phrase.
1605: .Ar digest
1606: may be one of
1.49 jmc 1607: .Cm md5
1.1 jsing 1608: or
1.49 jmc 1609: .Cm sha1 .
1.1 jsing 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
1.49 jmc 1615: Don't use a salt in the key derivation routines.
1.81 jmc 1616: This option should never be used
1.49 jmc 1617: since it makes it possible to perform efficient dictionary
1618: attacks on the password and to attack stream cipher encrypted data.
1.1 jsing 1619: .It Fl out Ar file
1.51 jmc 1620: The output file to write to,
1.57 jmc 1621: or standard output if not specified.
1.1 jsing 1622: .It Fl P
1.49 jmc 1623: Print out the salt, key, and IV used, then immediately exit;
1.1 jsing 1624: don't do any encryption or decryption.
1625: .It Fl p
1.49 jmc 1626: Print out the salt, key, and IV used.
1.1 jsing 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
1.49 jmc 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.
1.1 jsing 1640: .El
1641: .Sh ERRSTR
1642: .Nm openssl errstr
1643: .Op Fl stats
1644: .Ar errno ...
1645: .Pp
1646: The
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:
1654: .Pp
1655: .Dl error:[error code]:[library name]:[function name]:[reason string]
1656: .Pp
1657: .Bq error code
1658: is an 8-digit hexadecimal number.
1659: The remaining fields
1660: .Bq library name ,
1661: .Bq function name ,
1662: and
1663: .Bq reason string
1664: are all ASCII text.
1665: .Pp
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.
1670: .El
1671: .Sh GENDSA
1672: .nr nS 1
1673: .Nm "openssl gendsa"
1674: .Oo
1675: .Fl aes128 | aes192 | aes256 |
1676: .Fl des | des3
1677: .Oc
1678: .Op Fl out Ar file
1679: .Op Ar paramfile
1680: .nr nS 0
1681: .Pp
1682: The
1683: .Nm gendsa
1684: command generates a DSA private key from a DSA parameter file
1.51 jmc 1685: (typically generated by the
1.1 jsing 1686: .Nm openssl dsaparam
1687: command).
1.51 jmc 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.
1.1 jsing 1692: .Pp
1693: The options are as follows:
1694: .Bl -tag -width Ds
1695: .It Xo
1696: .Fl aes128 | aes192 | aes256 |
1697: .Fl des | des3
1698: .Xc
1.51 jmc 1699: Encrypt the private key with the AES, DES,
1.1 jsing 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
1.51 jmc 1704: The output file to write to,
1.57 jmc 1705: or standard output if not specified.
1.1 jsing 1706: .It Ar paramfile
1.51 jmc 1707: Specify the DSA parameter file to use.
1.1 jsing 1708: The parameters in this file determine the size of the private key.
1709: .El
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
1.52 jmc 1717: .Op Fl outform Cm der | pem
1.1 jsing 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
1723: .Pp
1724: The
1725: .Nm genpkey
1726: command generates private keys.
1727: The use of this
1728: program is encouraged over the algorithm specific utilities
1.22 bcook 1729: because additional algorithm options can be used.
1.1 jsing 1730: .Pp
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.
1.52 jmc 1736: This option must precede any
1.1 jsing 1737: .Fl pkeyopt
1738: options.
1739: The options
1740: .Fl paramfile
1741: and
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
1.52 jmc 1747: .Xr EVP_get_cipherbyname 3
1748: is acceptable.
1.1 jsing 1749: .It Fl genparam
1750: Generate a set of parameters instead of a private key.
1.52 jmc 1751: This option must precede any
1.1 jsing 1752: .Fl algorithm ,
1753: .Fl paramfile ,
1754: or
1755: .Fl pkeyopt
1756: options.
1757: .It Fl out Ar file
1.52 jmc 1758: The output file to write to,
1.57 jmc 1759: or standard output if not specified.
1.52 jmc 1760: .It Fl outform Cm der | pem
1761: The output format.
1.1 jsing 1762: .It Fl paramfile Ar file
1.52 jmc 1763: Some public key algorithms generate a private key based on a set of parameters,
1764: which can be supplied using this option.
1.1 jsing 1765: If this option is used the public key
1766: algorithm used is determined by the parameters.
1.52 jmc 1767: This option must precede any
1.1 jsing 1768: .Fl pkeyopt
1769: options.
1770: The options
1771: .Fl paramfile
1772: and
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
1780: to
1.52 jmc 1781: .Ar value ,
1782: as follows:
1.1 jsing 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.
1.52 jmc 1787: The default is 2048.
1.1 jsing 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.
1.52 jmc 1792: The default is 65537.
1.1 jsing 1793: .It dsa_paramgen_bits : Ns Ar numbits
1794: (DSA)
1795: The number of bits in the generated parameters.
1.52 jmc 1796: The default is 1024.
1.1 jsing 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.
1808: .El
1.52 jmc 1809: .It Fl text
1.64 jmc 1810: Print the private/public key in plain text.
1.52 jmc 1811: .El
1.1 jsing 1812: .Sh GENRSA
1813: .nr nS 1
1814: .Nm "openssl genrsa"
1815: .Op Fl 3 | f4
1.53 jmc 1816: .Op Fl aes128 | aes192 | aes256 | des | des3
1.1 jsing 1817: .Op Fl out Ar file
1818: .Op Fl passout Ar arg
1819: .Op Ar numbits
1820: .nr nS 0
1821: .Pp
1822: The
1823: .Nm genrsa
1.53 jmc 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.
1828: A
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).
1.1 jsing 1835: .Pp
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.
1.53 jmc 1841: .It Fl aes128 | aes192 | aes256 | des | des3
1842: Encrypt the private key with the AES, DES,
1.1 jsing 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
1.53 jmc 1850: The output file to write to,
1.57 jmc 1851: or standard output if not specified.
1.1 jsing 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.
1858: .El
1859: .Sh NSEQ
1860: .Nm openssl nseq
1861: .Op Fl in Ar file
1862: .Op Fl out Ar file
1863: .Op Fl toseq
1864: .Pp
1865: The
1866: .Nm nseq
1.54 jmc 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.
1872: .Pp
1.1 jsing 1873: The options are as follows:
1874: .Bl -tag -width Ds
1875: .It Fl in Ar file
1.54 jmc 1876: The input file to read from,
1877: or standard input if not specified.
1.1 jsing 1878: .It Fl out Ar file
1.54 jmc 1879: The output file to write to,
1880: or standard output if not specified.
1.1 jsing 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.
1888: .El
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
1.55 jmc 1897: .Op Fl host Ar hostname : Ns Ar port
1.1 jsing 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
1938: .Pp
1.55 jmc 1939: The Online Certificate Status Protocol (OCSP)
1940: enables applications to determine the (revocation) state
1941: of an identified certificate (RFC 2560).
1.1 jsing 1942: .Pp
1943: The
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.
1949: .Pp
1950: The options are as follows:
1951: .Bl -tag -width Ds
1952: .It Fl CAfile Ar file , Fl CApath Ar directory
1.55 jmc 1953: A file or path containing trusted CA certificates,
1954: used to verify the signature on the OCSP response.
1.1 jsing 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
1.55 jmc 1963: Use the digest algorithm
1964: .Ar alg
1965: for certificate identification in the OCSP request.
1.1 jsing 1966: By default SHA-1 is used.
1967: .It Xo
1968: .Fl host Ar hostname : Ns Ar port ,
1969: .Fl path Ar path
1970: .Xc
1.55 jmc 1971: Send
1972: the OCSP request to
1.1 jsing 1973: .Ar hostname
1.55 jmc 1974: on
1.1 jsing 1975: .Ar port .
1976: .Fl path
1977: specifies the HTTP path name to use, or
1.55 jmc 1978: .Pa /
1.1 jsing 1979: by default.
1980: .It Fl issuer Ar file
1.81 jmc 1981: The current issuer certificate, in PEM format.
1982: Can be used multiple times and must come before any
1.1 jsing 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
1.55 jmc 1995: Don't include any certificates in the signed request.
1.1 jsing 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.
1.55 jmc 2002: The signer's certificate must be specified with either the
1.1 jsing 2003: .Fl verify_other
2004: or
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
1.55 jmc 2012: Add an OCSP nonce extension to a request,
2013: or disable an OCSP nonce addition.
1.1 jsing 2014: Normally, if an OCSP request is input using the
2015: .Fl respin
1.55 jmc 2016: option no nonce is added:
1.1 jsing 2017: using the
2018: .Fl nonce
1.55 jmc 2019: option will force the addition of a nonce.
1.1 jsing 2020: If an OCSP request is being created (using the
2021: .Fl cert
2022: and
2023: .Fl serial
2024: options)
1.55 jmc 2025: a nonce is automatically added; specifying
1.1 jsing 2026: .Fl no_nonce
2027: overrides this.
2028: .It Fl noverify
1.55 jmc 2029: Don't attempt to verify the OCSP response signature or the nonce values.
2030: This is normally only be used for debugging
1.1 jsing 2031: since it disables all verification of the responder's certificate.
2032: .It Fl out Ar file
1.55 jmc 2033: Specify the output file to write to,
1.57 jmc 2034: or standard output if not specified.
1.1 jsing 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 ,
2044: and
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 .
1.55 jmc 2058: Negative integers can also be specified
2059: by preceding the value with a minus sign.
1.1 jsing 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
1.55 jmc 2086: A file containing explicitly trusted responder certificates.
1.1 jsing 2087: Equivalent to the
2088: .Fl verify_other
2089: and
2090: .Fl trust_other
2091: options.
2092: .It Fl validity_period Ar nsec , Fl status_age Ar age
1.55 jmc 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.
1.1 jsing 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,
1.55 jmc 2103: the default value being 5 minutes.
1.1 jsing 2104: .Pp
1.55 jmc 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
1.1 jsing 2109: .Ar age
2110: seconds old.
2111: By default, this additional check is not performed.
2112: .It Fl verify_other Ar file
1.55 jmc 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.
1.1 jsing 2117: .El
1.55 jmc 2118: .Pp
2119: The options for the OCSP server are as follows:
1.1 jsing 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
1.55 jmc 2126: is a text index file in ca format
2127: containing certificate revocation information.
1.1 jsing 2128: .Pp
1.55 jmc 2129: If this option is specified,
1.1 jsing 2130: .Nm ocsp
1.55 jmc 2131: is in responder mode, otherwise it is in client mode.
2132: The requests the responder processes can be either specified on
1.1 jsing 2133: the command line (using the
2134: .Fl issuer
2135: and
2136: .Fl serial
2137: options), supplied in a file (using the
2138: .Fl respin
1.55 jmc 2139: option), or via external OCSP clients (if
1.1 jsing 2140: .Ar port
2141: or
2142: .Ar url
2143: is specified).
2144: .Pp
1.55 jmc 2145: If this option is present, then the
1.1 jsing 2146: .Fl CA
2147: and
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
2153: or
2154: .Ar days
1.55 jmc 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.
1.1 jsing 2160: .It Fl nrequest Ar number
1.55 jmc 2161: Exit after receiving
1.1 jsing 2162: .Ar number
1.55 jmc 2163: requests (the default is unlimited).
1.1 jsing 2164: .It Fl port Ar portnum
2165: Port to listen for OCSP requests on.
1.55 jmc 2166: May also be specified using the
1.1 jsing 2167: .Fl url
2168: option.
2169: .It Fl resp_key_id
2170: Identify the signer certificate using the key ID;
1.55 jmc 2171: the default is to use the subject name.
1.1 jsing 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.
2183: .El
2184: .Pp
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
2192: and
2193: .Fl CApath
2194: options or they will be looked for in the standard
1.55 jmc 2195: .Nm openssl
2196: certificates directory.
1.1 jsing 2197: .Pp
1.55 jmc 2198: If the initial verify fails, the OCSP verify process halts with an error.
1.1 jsing 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.
2201: .Pp
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.
2206: .Pp
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.
2210: .Pp
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
1.55 jmc 2214: (and it is correctly configured),
1.1 jsing 2215: then verification will succeed.
2216: .Pp
1.55 jmc 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.
1.1 jsing 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
2238: .Pp
2239: The
2240: .Nm passwd
1.56 jmc 2241: command computes the hash of a password.
1.1 jsing 2242: .Pp
2243: The options are as follows:
2244: .Bl -tag -width Ds
2245: .It Fl 1
2246: Use the MD5 based
2247: .Bx
2248: password algorithm
1.56 jmc 2249: .Qq 1 .
1.1 jsing 2250: .It Fl apr1
2251: Use the
1.56 jmc 2252: .Qq apr1
1.1 jsing 2253: algorithm
1.56 jmc 2254: .Po
2255: Apache variant of the
1.1 jsing 2256: .Bx
1.56 jmc 2257: algorithm
2258: .Pc .
1.1 jsing 2259: .It Fl crypt
2260: Use the
1.56 jmc 2261: .Qq crypt
2262: algorithm (the default).
1.1 jsing 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
1.56 jmc 2276: Use the salt specified by
2277: .Ar string .
1.1 jsing 2278: When reading a password from the terminal, this implies
2279: .Fl noverify .
2280: .It Fl stdin
1.56 jmc 2281: Read passwords from standard input.
1.1 jsing 2282: .It Fl table
2283: In the output list, prepend the cleartext password and a TAB character
2284: to each password hash.
2285: .El
2286: .Sh PKCS7
2287: .nr nS 1
2288: .Nm "openssl pkcs7"
2289: .Op Fl in Ar file
1.57 jmc 2290: .Op Fl inform Cm der | pem
1.1 jsing 2291: .Op Fl noout
2292: .Op Fl out Ar file
1.57 jmc 2293: .Op Fl outform Cm der | pem
1.1 jsing 2294: .Op Fl print_certs
2295: .Op Fl text
2296: .nr nS 0
2297: .Pp
2298: The
2299: .Nm pkcs7
2300: command processes PKCS#7 files in DER or PEM format.
1.57 jmc 2301: The PKCS#7 routines only understand PKCS#7 v 1.5 as specified in RFC 2315.
2302: .Pp
1.1 jsing 2303: The options are as follows:
2304: .Bl -tag -width Ds
2305: .It Fl in Ar file
1.57 jmc 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.
1.1 jsing 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
1.57 jmc 2316: The output to write to,
2317: or standard output if not specified.
2318: .It Fl outform Cm der | pem
2319: The output format.
1.1 jsing 2320: .It Fl print_certs
1.57 jmc 2321: Print any certificates or CRLs contained in the file,
2322: preceded by their subject and issuer names in a one-line format.
1.1 jsing 2323: .It Fl text
1.57 jmc 2324: Print certificate details in full rather than just subject and issuer names.
1.1 jsing 2325: .El
2326: .Sh PKCS8
2327: .nr nS 1
2328: .Nm "openssl pkcs8"
2329: .Op Fl embed
2330: .Op Fl in Ar file
1.58 jmc 2331: .Op Fl inform Cm der | pem
1.1 jsing 2332: .Op Fl nocrypt
2333: .Op Fl noiter
2334: .Op Fl nooct
2335: .Op Fl nsdb
2336: .Op Fl out Ar file
1.58 jmc 2337: .Op Fl outform Cm der | pem
1.1 jsing 2338: .Op Fl passin Ar arg
2339: .Op Fl passout Ar arg
2340: .Op Fl topk8
2341: .Op Fl v1 Ar alg
2342: .Op Fl v2 Ar alg
2343: .nr nS 0
2344: .Pp
2345: The
2346: .Nm pkcs8
1.58 jmc 2347: command processes private keys
2348: (both encrypted and unencrypted)
2349: in PKCS#8 format
2350: with a variety of PKCS#5 (v1.5 and v2.0) and PKCS#12 algorithms.
2351: The default encryption is only 56 bits;
2352: keys encrypted using PKCS#5 v2.0 algorithms and high iteration counts
2353: are more secure.
2354: .Pp
1.1 jsing 2355: The options are as follows:
2356: .Bl -tag -width Ds
2357: .It Fl embed
1.58 jmc 2358: Generate DSA keys in a broken format.
2359: The DSA parameters are embedded inside the PrivateKey structure.
1.84 jmc 2360: In this form the OCTET STRING contains an ASN.1 SEQUENCE consisting of
1.1 jsing 2361: two structures:
1.84 jmc 2362: a SEQUENCE containing the parameters and an ASN.1 INTEGER containing
1.1 jsing 2363: the private key.
2364: .It Fl in Ar file
1.58 jmc 2365: The input file to read from,
2366: or standard input if not specified.
1.1 jsing 2367: If the key is encrypted, a pass phrase will be prompted for.
1.58 jmc 2368: .It Fl inform Cm der | pem
2369: The input format.
1.1 jsing 2370: .It Fl nocrypt
1.58 jmc 2371: Generate an unencrypted PrivateKeyInfo structure.
2372: This option does not encrypt private keys at all
2373: and should only be used when absolutely necessary.
1.1 jsing 2374: .It Fl noiter
2375: Use an iteration count of 1.
2376: See the
2377: .Sx PKCS12
2378: section below for a detailed explanation of this option.
2379: .It Fl nooct
1.58 jmc 2380: Generate RSA private keys in a broken format that some software uses.
1.1 jsing 2381: Specifically the private key should be enclosed in an OCTET STRING,
2382: but some software just includes the structure itself without the
2383: surrounding OCTET STRING.
2384: .It Fl nsdb
1.58 jmc 2385: Generate DSA keys in a broken format compatible with Netscape
1.1 jsing 2386: private key databases.
1.58 jmc 2387: The PrivateKey contains a SEQUENCE
2388: consisting of the public and private keys, respectively.
1.1 jsing 2389: .It Fl out Ar file
1.58 jmc 2390: The output file to write to,
2391: or standard output if none is specified.
1.1 jsing 2392: If any encryption options are set, a pass phrase will be prompted for.
1.58 jmc 2393: .It Fl outform Cm der | pem
2394: The output format.
1.1 jsing 2395: .It Fl passin Ar arg
2396: The key password source.
2397: .It Fl passout Ar arg
2398: The output file password source.
2399: .It Fl topk8
1.58 jmc 2400: Read a traditional format private key and write a PKCS#8 format key.
1.1 jsing 2401: .It Fl v1 Ar alg
1.58 jmc 2402: Specify a PKCS#5 v1.5 or PKCS#12 algorithm to use.
2403: .Pp
2404: .Bl -tag -width "XXXX" -compact
2405: .It PBE-MD5-DES
2406: 56-bit DES.
2407: .It PBE-SHA1-RC2-64 | PBE-MD5-RC2-64 | PBE-SHA1-DES
2408: 64-bit RC2 or 56-bit DES.
2409: .It PBE-SHA1-RC4-128 | PBE-SHA1-RC4-40 | PBE-SHA1-3DES
2410: .It PBE-SHA1-2DES | PBE-SHA1-RC2-128 | PBE-SHA1-RC2-40
2411: PKCS#12 password-based encryption algorithm,
2412: which allow strong encryption algorithms like triple DES or 128-bit RC2.
2413: .El
1.1 jsing 2414: .It Fl v2 Ar alg
1.58 jmc 2415: Use PKCS#5 v2.0 algorithms.
2416: Supports algorithms such as 168-bit triple DES or 128-bit RC2,
2417: however not many implementations support PKCS#5 v2.0 yet
2418: (if using private keys with
2419: .Nm openssl
2420: this doesn't matter).
1.1 jsing 2421: .Pp
2422: .Ar alg
1.58 jmc 2423: is the encryption algorithm to use;
2424: valid values include des, des3, and rc2.
2425: It is recommended that des3 is used.
1.1 jsing 2426: .El
2427: .Sh PKCS12
2428: .nr nS 1
2429: .Nm "openssl pkcs12"
1.59 jmc 2430: .Op Fl aes128 | aes192 | aes256 | des | des3
1.1 jsing 2431: .Op Fl cacerts
2432: .Op Fl CAfile Ar file
2433: .Op Fl caname Ar name
2434: .Op Fl CApath Ar directory
2435: .Op Fl certfile Ar file
2436: .Op Fl certpbe Ar alg
2437: .Op Fl chain
2438: .Op Fl clcerts
2439: .Op Fl CSP Ar name
2440: .Op Fl descert
2441: .Op Fl export
2442: .Op Fl in Ar file
2443: .Op Fl info
2444: .Op Fl inkey Ar file
2445: .Op Fl keyex
2446: .Op Fl keypbe Ar alg
2447: .Op Fl keysig
2448: .Op Fl macalg Ar alg
2449: .Op Fl maciter
2450: .Op Fl name Ar name
2451: .Op Fl nocerts
2452: .Op Fl nodes
2453: .Op Fl noiter
2454: .Op Fl nokeys
2455: .Op Fl nomac
2456: .Op Fl nomaciter
2457: .Op Fl nomacver
2458: .Op Fl noout
2459: .Op Fl out Ar file
2460: .Op Fl passin Ar arg
2461: .Op Fl passout Ar arg
2462: .Op Fl twopass
2463: .nr nS 0
2464: .Pp
2465: The
2466: .Nm pkcs12
2467: command allows PKCS#12 files
2468: .Pq sometimes referred to as PFX files
2469: to be created and parsed.
2470: By default, a PKCS#12 file is parsed;
2471: a PKCS#12 file can be created by using the
2472: .Fl export
1.59 jmc 2473: option.
2474: .Pp
2475: The options for parsing a PKCS12 file are as follows:
1.1 jsing 2476: .Bl -tag -width "XXXX"
1.59 jmc 2477: .It Fl aes128 | aes192 | aes256 | des | des3
2478: Encrypt private keys
2479: using AES, DES, or triple DES, respectively.
1.1 jsing 2480: The default is triple DES.
2481: .It Fl cacerts
2482: Only output CA certificates
2483: .Pq not client certificates .
2484: .It Fl clcerts
2485: Only output client certificates
2486: .Pq not CA certificates .
2487: .It Fl in Ar file
1.59 jmc 2488: The input file to read from,
2489: or standard input if not specified.
1.1 jsing 2490: .It Fl info
2491: Output additional information about the PKCS#12 file structure,
2492: algorithms used, and iteration counts.
2493: .It Fl nocerts
1.59 jmc 2494: Do not output certificates.
1.1 jsing 2495: .It Fl nodes
1.59 jmc 2496: Do not encrypt private keys.
1.1 jsing 2497: .It Fl nokeys
1.59 jmc 2498: Do not output private keys.
1.1 jsing 2499: .It Fl nomacver
1.59 jmc 2500: Do not attempt to verify the integrity MAC before reading the file.
1.1 jsing 2501: .It Fl noout
1.59 jmc 2502: Do not output the keys and certificates to the output file
1.1 jsing 2503: version of the PKCS#12 file.
2504: .It Fl out Ar file
1.59 jmc 2505: The output file to write to,
2506: or standard output if not specified.
1.1 jsing 2507: .It Fl passin Ar arg
2508: The key password source.
2509: .It Fl passout Ar arg
2510: The output file password source.
2511: .It Fl twopass
2512: Prompt for separate integrity and encryption passwords: most software
2513: always assumes these are the same so this option will render such
2514: PKCS#12 files unreadable.
2515: .El
1.59 jmc 2516: .Pp
2517: The options for PKCS12 file creation are as follows:
1.1 jsing 2518: .Bl -tag -width "XXXX"
2519: .It Fl CAfile Ar file
2520: CA storage as a file.
2521: .It Fl CApath Ar directory
2522: CA storage as a directory.
1.59 jmc 2523: The directory must be a standard certificate directory:
1.1 jsing 2524: that is, a hash of each subject name (using
1.59 jmc 2525: .Nm x509 Fl hash )
1.1 jsing 2526: should be linked to each certificate.
2527: .It Fl caname Ar name
1.59 jmc 2528: Specify the
1.1 jsing 2529: .Qq friendly name
2530: for other certificates.
1.59 jmc 2531: May be used multiple times to specify names for all certificates
1.1 jsing 2532: in the order they appear.
2533: .It Fl certfile Ar file
2534: A file to read additional certificates from.
2535: .It Fl certpbe Ar alg , Fl keypbe Ar alg
1.59 jmc 2536: Specify the algorithm used to encrypt the private key and
1.1 jsing 2537: certificates to be selected.
1.59 jmc 2538: Any PKCS#5 v1.5 or PKCS#12 PBE algorithm name can be used.
1.1 jsing 2539: If a cipher name
2540: (as output by the
2541: .Cm list-cipher-algorithms
2542: command) is specified then it
2543: is used with PKCS#5 v2.0.
2544: For interoperability reasons it is advisable to only use PKCS#12 algorithms.
2545: .It Fl chain
1.59 jmc 2546: Include the entire certificate chain of the user certificate.
1.1 jsing 2547: The standard CA store is used for this search.
2548: If the search fails, it is considered a fatal error.
2549: .It Fl CSP Ar name
2550: Write
2551: .Ar name
2552: as a Microsoft CSP name.
2553: .It Fl descert
2554: Encrypt the certificate using triple DES; this may render the PKCS#12
2555: file unreadable by some
2556: .Qq export grade
2557: software.
2558: By default, the private key is encrypted using triple DES and the
2559: certificate using 40-bit RC2.
2560: .It Fl export
1.59 jmc 2561: Create a PKCS#12 file (rather than parsing one).
1.1 jsing 2562: .It Fl in Ar file
1.59 jmc 2563: The input file to read from,
1.81 jmc 2564: or standard input if not specified.
1.1 jsing 2565: The order doesn't matter but one private key and its corresponding
2566: certificate should be present.
2567: If additional certificates are present, they will also be included
2568: in the PKCS#12 file.
2569: .It Fl inkey Ar file
1.59 jmc 2570: File to read a private key from.
1.1 jsing 2571: If not present, a private key must be present in the input file.
2572: .It Fl keyex | keysig
1.59 jmc 2573: Specify whether the private key is to be used for key exchange or just signing.
1.1 jsing 2574: Normally,
2575: .Qq export grade
2576: software will only allow 512-bit RSA keys to be
2577: used for encryption purposes, but arbitrary length keys for signing.
2578: The
2579: .Fl keysig
2580: option marks the key for signing only.
2581: Signing only keys can be used for S/MIME signing, authenticode
1.66 jmc 2582: (ActiveX control signing)
1.59 jmc 2583: and SSL client authentication.
1.1 jsing 2584: .It Fl macalg Ar alg
2585: Specify the MAC digest algorithm.
1.59 jmc 2586: The default is SHA1.
1.1 jsing 2587: .It Fl maciter
1.66 jmc 2588: Included for compatibility only:
1.59 jmc 2589: it used to be needed to use MAC iterations counts
2590: but they are now used by default.
1.1 jsing 2591: .It Fl name Ar name
1.59 jmc 2592: Specify the
1.1 jsing 2593: .Qq friendly name
2594: for the certificate and private key.
2595: This name is typically displayed in list boxes by software importing the file.
2596: .It Fl nomac
2597: Don't attempt to provide the MAC integrity.
2598: .It Fl nomaciter , noiter
1.59 jmc 2599: Affect the iteration counts on the MAC and key algorithms.
1.1 jsing 2600: .Pp
2601: To discourage attacks by using large dictionaries of common passwords,
2602: the algorithm that derives keys from passwords can have an iteration count
2603: applied to it: this causes a certain part of the algorithm to be repeated
2604: and slows it down.
2605: The MAC is used to check the file integrity but since it will normally
2606: have the same password as the keys and certificates it could also be attacked.
2607: By default, both MAC and encryption iteration counts are set to 2048;
2608: using these options the MAC and encryption iteration counts can be set to 1.
2609: Since this reduces the file security you should not use these options
2610: unless you really have to.
2611: Most software supports both MAC and key iteration counts.
2612: .It Fl out Ar file
1.59 jmc 2613: The output file to write to,
2614: or standard output if not specified.
1.1 jsing 2615: .It Fl passin Ar arg
2616: The key password source.
2617: .It Fl passout Ar arg
2618: The output file password source.
2619: .El
2620: .Sh PKEY
2621: .nr nS 1
2622: .Nm "openssl pkey"
2623: .Op Ar cipher
2624: .Op Fl in Ar file
1.60 jmc 2625: .Op Fl inform Cm der | pem
1.1 jsing 2626: .Op Fl noout
2627: .Op Fl out Ar file
1.60 jmc 2628: .Op Fl outform Cm der | pem
1.1 jsing 2629: .Op Fl passin Ar arg
2630: .Op Fl passout Ar arg
2631: .Op Fl pubin
2632: .Op Fl pubout
2633: .Op Fl text
2634: .Op Fl text_pub
2635: .nr nS 0
2636: .Pp
2637: The
2638: .Nm pkey
2639: command processes public or private keys.
2640: They can be converted between various forms
2641: and their components printed out.
2642: .Pp
2643: The options are as follows:
2644: .Bl -tag -width Ds
2645: .It Ar cipher
1.60 jmc 2646: Encrypt the private key with the specified cipher.
1.1 jsing 2647: Any algorithm name accepted by
1.60 jmc 2648: .Xr EVP_get_cipherbyname 3
1.1 jsing 2649: is acceptable, such as
2650: .Cm des3 .
2651: .It Fl in Ar file
1.60 jmc 2652: The input file to read from,
2653: or standard input if not specified.
1.1 jsing 2654: If the key is encrypted a pass phrase will be prompted for.
1.60 jmc 2655: .It Fl inform Cm der | pem
2656: The input format.
1.1 jsing 2657: .It Fl noout
2658: Do not output the encoded version of the key.
2659: .It Fl out Ar file
1.60 jmc 2660: The output file to write to,
2661: or standard output if not specified.
1.1 jsing 2662: If any encryption options are set then a pass phrase
2663: will be prompted for.
1.60 jmc 2664: .It Fl outform Cm der | pem
2665: The output format.
1.1 jsing 2666: .It Fl passin Ar arg
2667: The key password source.
2668: .It Fl passout Ar arg
2669: The output file password source.
2670: .It Fl pubin
1.60 jmc 2671: Read in a public key, not a private key.
1.1 jsing 2672: .It Fl pubout
1.60 jmc 2673: Output a public key, not a private key.
2674: Automatically set if the input is a public key.
1.1 jsing 2675: .It Fl text
1.64 jmc 2676: Print the public/private key in plain text.
1.1 jsing 2677: .It Fl text_pub
2678: Print out only public key components
2679: even if a private key is being processed.
2680: .El
2681: .Sh PKEYPARAM
2682: .Cm openssl pkeyparam
2683: .Op Fl in Ar file
2684: .Op Fl noout
2685: .Op Fl out Ar file
2686: .Op Fl text
2687: .Pp
2688: The
1.61 jmc 2689: .Nm pkeyparam
1.1 jsing 2690: command processes public or private keys.
1.61 jmc 2691: The key type is determined by the PEM headers.
1.1 jsing 2692: .Pp
2693: The options are as follows:
2694: .Bl -tag -width Ds
2695: .It Fl in Ar file
1.61 jmc 2696: The input file to read from,
2697: or standard input if not specified.
1.1 jsing 2698: .It Fl noout
2699: Do not output the encoded version of the parameters.
2700: .It Fl out Ar file
1.61 jmc 2701: The output file to write to,
2702: or standard output if not specified.
1.1 jsing 2703: .It Fl text
1.64 jmc 2704: Print the parameters in plain text.
1.1 jsing 2705: .El
2706: .Sh PKEYUTL
2707: .nr nS 1
2708: .Nm "openssl pkeyutl"
2709: .Op Fl asn1parse
2710: .Op Fl certin
2711: .Op Fl decrypt
2712: .Op Fl derive
2713: .Op Fl encrypt
2714: .Op Fl hexdump
2715: .Op Fl in Ar file
2716: .Op Fl inkey Ar file
1.62 jmc 2717: .Op Fl keyform Cm der | pem
1.1 jsing 2718: .Op Fl out Ar file
2719: .Op Fl passin Ar arg
1.62 jmc 2720: .Op Fl peerform Cm der | pem
1.1 jsing 2721: .Op Fl peerkey Ar file
2722: .Op Fl pkeyopt Ar opt : Ns Ar value
2723: .Op Fl pubin
2724: .Op Fl rev
2725: .Op Fl sigfile Ar file
2726: .Op Fl sign
2727: .Op Fl verify
2728: .Op Fl verifyrecover
2729: .nr nS 0
2730: .Pp
2731: The
2732: .Nm pkeyutl
2733: command can be used to perform public key operations using
2734: any supported algorithm.
2735: .Pp
2736: The options are as follows:
2737: .Bl -tag -width Ds
2738: .It Fl asn1parse
1.84 jmc 2739: ASN.1 parse the output data.
1.1 jsing 2740: This is useful when combined with the
2741: .Fl verifyrecover
1.84 jmc 2742: option when an ASN.1 structure is signed.
1.1 jsing 2743: .It Fl certin
2744: The input is a certificate containing a public key.
2745: .It Fl decrypt
2746: Decrypt the input data using a private key.
2747: .It Fl derive
2748: Derive a shared secret using the peer key.
2749: .It Fl encrypt
2750: Encrypt the input data using a public key.
2751: .It Fl hexdump
2752: Hex dump the output data.
2753: .It Fl in Ar file
1.62 jmc 2754: The input file to read from,
2755: or standard input if not specified.
1.1 jsing 2756: .It Fl inkey Ar file
2757: The input key file.
2758: By default it should be a private key.
1.62 jmc 2759: .It Fl keyform Cm der | pem
2760: The key format.
1.1 jsing 2761: .It Fl out Ar file
1.62 jmc 2762: The output file to write to,
2763: or standard output if not specified.
1.1 jsing 2764: .It Fl passin Ar arg
2765: The key password source.
1.62 jmc 2766: .It Fl peerform Cm der | pem
2767: The peer key format.
1.1 jsing 2768: .It Fl peerkey Ar file
2769: The peer key file, used by key derivation (agreement) operations.
2770: .It Fl pkeyopt Ar opt : Ns Ar value
1.62 jmc 2771: Set the public key algorithm option
2772: .Ar opt
2773: to
2774: .Ar value .
2775: Unless otherwise mentioned, all algorithms support the format
2776: .Ar digest : Ns Ar alg ,
2777: which specifies the digest to use
1.1 jsing 2778: for sign, verify, and verifyrecover operations.
2779: The value
2780: .Ar alg
2781: should represent a digest name as used in the
1.62 jmc 2782: .Xr EVP_get_digestbyname 3
2783: function.
2784: .Pp
1.1 jsing 2785: The RSA algorithm supports the
2786: encrypt, decrypt, sign, verify, and verifyrecover operations in general.
2787: Some padding modes only support some of these
2788: operations however.
2789: .Bl -tag -width Ds
2790: .It rsa_padding_mode : Ns Ar mode
2791: This sets the RSA padding mode.
2792: Acceptable values for
2793: .Ar mode
2794: are
2795: .Cm pkcs1
2796: for PKCS#1 padding;
2797: .Cm none
2798: for no padding;
2799: .Cm oaep
2800: for OAEP mode;
2801: .Cm x931
2802: for X9.31 mode;
2803: and
2804: .Cm pss
2805: for PSS.
2806: .Pp
2807: In PKCS#1 padding if the message digest is not set then the supplied data is
2808: signed or verified directly instead of using a DigestInfo structure.
2809: If a digest is set then a DigestInfo
2810: structure is used and its length
2811: must correspond to the digest type.
2812: For oeap mode only encryption and decryption is supported.
2813: For x931 if the digest type is set it is used to format the block data;
2814: otherwise the first byte is used to specify the X9.31 digest ID.
2815: Sign, verify, and verifyrecover can be performed in this mode.
2816: For pss mode only sign and verify are supported and the digest type must be
2817: specified.
2818: .It rsa_pss_saltlen : Ns Ar len
2819: For pss
2820: mode only this option specifies the salt length.
2821: Two special values are supported:
2822: -1 sets the salt length to the digest length.
2823: When signing -2 sets the salt length to the maximum permissible value.
2824: When verifying -2 causes the salt length to be automatically determined
2825: based on the PSS block structure.
2826: .El
1.62 jmc 2827: .Pp
1.1 jsing 2828: The DSA algorithm supports the sign and verify operations.
2829: Currently there are no additional options other than
2830: .Ar digest .
2831: Only the SHA1 digest can be used and this digest is assumed by default.
1.62 jmc 2832: .Pp
1.1 jsing 2833: The DH algorithm supports the derive operation
2834: and no additional options.
1.62 jmc 2835: .Pp
1.1 jsing 2836: The EC algorithm supports the sign, verify, and derive operations.
2837: The sign and verify operations use ECDSA and derive uses ECDH.
2838: Currently there are no additional options other than
2839: .Ar digest .
2840: Only the SHA1 digest can be used and this digest is assumed by default.
1.62 jmc 2841: .It Fl pubin
2842: The input file is a public key.
2843: .It Fl rev
2844: Reverse the order of the input buffer.
2845: .It Fl sigfile Ar file
2846: Signature file (verify operation only).
2847: .It Fl sign
2848: Sign the input data and output the signed result.
2849: This requires a private key.
2850: .It Fl verify
2851: Verify the input data against the signature file and indicate if the
2852: verification succeeded or failed.
2853: .It Fl verifyrecover
2854: Verify the input data and output the recovered data.
2855: .El
1.1 jsing 2856: .Sh PRIME
2857: .Cm openssl prime
2858: .Op Fl bits Ar n
2859: .Op Fl checks Ar n
2860: .Op Fl generate
2861: .Op Fl hex
2862: .Op Fl safe
2863: .Ar p
2864: .Pp
2865: The
2866: .Nm prime
2867: command is used to generate prime numbers,
2868: or to check numbers for primality.
2869: Results are probabilistic:
2870: they have an exceedingly high likelihood of being correct,
2871: but are not guaranteed.
2872: .Pp
2873: The options are as follows:
2874: .Bl -tag -width Ds
2875: .It Fl bits Ar n
2876: Specify the number of bits in the generated prime number.
2877: Must be used in conjunction with
2878: .Fl generate .
2879: .It Fl checks Ar n
2880: Perform a Miller-Rabin probabilistic primality test with
2881: .Ar n
2882: iterations.
2883: The default is 20.
2884: .It Fl generate
2885: Generate a pseudo-random prime number.
2886: Must be used in conjunction with
2887: .Fl bits .
2888: .It Fl hex
2889: Output in hex format.
2890: .It Fl safe
2891: Generate only
2892: .Qq safe
2893: prime numbers
2894: (i.e. a prime p so that (p-1)/2 is also prime).
2895: .It Ar p
2896: Test if number
2897: .Ar p
2898: is prime.
2899: .El
2900: .Sh RAND
2901: .nr nS 1
2902: .Nm "openssl rand"
2903: .Op Fl base64
2904: .Op Fl hex
2905: .Op Fl out Ar file
2906: .Ar num
2907: .nr nS 0
2908: .Pp
2909: The
2910: .Nm rand
2911: command outputs
2912: .Ar num
2913: pseudo-random bytes.
2914: .Pp
2915: The options are as follows:
2916: .Bl -tag -width Ds
2917: .It Fl base64
1.81 jmc 2918: Perform base64 encoding on the output.
1.1 jsing 2919: .It Fl hex
2920: Specify hexadecimal output.
2921: .It Fl out Ar file
1.63 jmc 2922: The output file to write to,
2923: or standard output if not specified.
1.1 jsing 2924: .El
2925: .Sh REQ
2926: .nr nS 1
2927: .Nm "openssl req"
2928: .Op Fl asn1-kludge
2929: .Op Fl batch
2930: .Op Fl config Ar file
2931: .Op Fl days Ar n
2932: .Op Fl extensions Ar section
2933: .Op Fl in Ar file
1.63 jmc 2934: .Op Fl inform Cm der | pem
1.1 jsing 2935: .Op Fl key Ar keyfile
1.63 jmc 2936: .Op Fl keyform Cm der | pem
1.1 jsing 2937: .Op Fl keyout Ar file
1.28 doug 2938: .Op Fl md4 | md5 | sha1
1.1 jsing 2939: .Op Fl modulus
2940: .Op Fl nameopt Ar option
2941: .Op Fl new
2942: .Op Fl newhdr
2943: .Op Fl newkey Ar arg
2944: .Op Fl no-asn1-kludge
2945: .Op Fl nodes
2946: .Op Fl noout
2947: .Op Fl out Ar file
1.63 jmc 2948: .Op Fl outform Cm der | pem
1.1 jsing 2949: .Op Fl passin Ar arg
2950: .Op Fl passout Ar arg
2951: .Op Fl pubkey
2952: .Op Fl reqexts Ar section
2953: .Op Fl reqopt Ar option
2954: .Op Fl set_serial Ar n
2955: .Op Fl subj Ar arg
2956: .Op Fl subject
2957: .Op Fl text
2958: .Op Fl utf8
2959: .Op Fl verbose
2960: .Op Fl verify
2961: .Op Fl x509
2962: .nr nS 0
2963: .Pp
2964: The
2965: .Nm req
2966: command primarily creates and processes certificate requests
2967: in PKCS#10 format.
2968: It can additionally create self-signed certificates,
2969: for use as root CAs, for example.
2970: .Pp
2971: The options are as follows:
2972: .Bl -tag -width Ds
2973: .It Fl asn1-kludge
1.63 jmc 2974: Produce requests in an invalid format for certain picky CAs.
2975: Very few CAs still require the use of this option.
1.1 jsing 2976: .It Fl batch
2977: Non-interactive mode.
2978: .It Fl config Ar file
1.63 jmc 2979: Specify an alternative configuration file.
1.1 jsing 2980: .It Fl days Ar n
1.63 jmc 2981: Specify the number of days to certify the certificate for.
2982: The default is 30 days.
2983: Used with the
1.1 jsing 2984: .Fl x509
1.63 jmc 2985: option.
1.1 jsing 2986: .It Fl extensions Ar section , Fl reqexts Ar section
1.63 jmc 2987: Specify alternative sections to include certificate
2988: extensions (with
2989: .Fl x509 )
2990: or certificate request extensions,
2991: allowing several different sections to be used in the same configuration file.
1.1 jsing 2992: .It Fl in Ar file
1.63 jmc 2993: The input file to read a request from,
2994: or standard input if not specified.
1.1 jsing 2995: A request is only read if the creation options
2996: .Fl new
2997: and
2998: .Fl newkey
2999: are not specified.
1.63 jmc 3000: .It Fl inform Cm der | pem
3001: The input format.
1.1 jsing 3002: .It Fl key Ar keyfile
1.63 jmc 3003: The file to read the private key from.
1.1 jsing 3004: It also accepts PKCS#8 format private keys for PEM format files.
1.63 jmc 3005: .It Fl keyform Cm der | pem
1.1 jsing 3006: The format of the private key file specified in the
3007: .Fl key
3008: argument.
1.81 jmc 3009: The default is
3010: .Cm pem .
1.1 jsing 3011: .It Fl keyout Ar file
1.63 jmc 3012: The file to write the newly created private key to.
3013: If this option is not specified,
3014: the filename present in the configuration file is used.
1.4 sthen 3015: .It Fl md5 | sha1 | sha256
1.63 jmc 3016: The message digest to sign the request with.
1.1 jsing 3017: This overrides the digest algorithm specified in the configuration file.
3018: .Pp
3019: Some public key algorithms may override this choice.
3020: For instance, DSA signatures always use SHA1.
3021: .It Fl modulus
1.63 jmc 3022: Print the value of the modulus of the public key contained in the request.
1.1 jsing 3023: .It Fl nameopt Ar option , Fl reqopt Ar option
1.63 jmc 3024: Determine how the subject or issuer names are displayed.
1.1 jsing 3025: .Ar option
1.63 jmc 3026: can be a single option or multiple options separated by commas.
1.1 jsing 3027: Alternatively, these options may be used more than once to set multiple options.
3028: See the
3029: .Sx X509
3030: section below for details.
3031: .It Fl new
1.63 jmc 3032: Generate a new certificate request.
3033: The user is prompted for the relevant field values.
1.1 jsing 3034: The actual fields prompted for and their maximum and minimum sizes
3035: are specified in the configuration file and any requested extensions.
3036: .Pp
3037: If the
3038: .Fl key
3039: option is not used, it will generate a new RSA private
3040: key using information specified in the configuration file.
3041: .It Fl newhdr
1.63 jmc 3042: Add the word NEW to the PEM file header and footer lines
1.1 jsing 3043: on the outputed request.
1.63 jmc 3044: Some software and CAs need this.
1.1 jsing 3045: .It Fl newkey Ar arg
1.63 jmc 3046: Create a new certificate request and a new private key.
1.1 jsing 3047: The argument takes one of several forms.
1.63 jmc 3048: .Pp
3049: .No rsa : Ns Ar nbits
3050: generates an RSA key
1.1 jsing 3051: .Ar nbits
3052: in size.
3053: If
3054: .Ar nbits
1.63 jmc 3055: is omitted
3056: the default key size is used.
3057: .Pp
3058: .No dsa : Ns Ar file
3059: generates a DSA key using the parameters in
3060: .Ar file .
3061: .Pp
3062: .No param : Ns Ar file
3063: generates a key using the parameters or certificate in
3064: .Ar file .
3065: .Pp
3066: All other algorithms support the form
3067: .Ar algorithm : Ns Ar file ,
1.1 jsing 3068: where file may be an algorithm parameter file,
3069: created by the
3070: .Cm genpkey -genparam
1.14 jmc 3071: command or an X.509 certificate for a key with appropriate algorithm.
1.63 jmc 3072: .Ar file
3073: can be omitted,
3074: in which case any parameters can be specified via the
1.1 jsing 3075: .Fl pkeyopt
3076: option.
3077: .It Fl no-asn1-kludge
1.63 jmc 3078: Reverse the effect of
1.1 jsing 3079: .Fl asn1-kludge .
3080: .It Fl nodes
1.63 jmc 3081: Do not encrypt the private key.
1.1 jsing 3082: .It Fl noout
1.63 jmc 3083: Do not output the encoded version of the request.
1.1 jsing 3084: .It Fl out Ar file
1.63 jmc 3085: The output file to write to,
3086: or standard output if not spceified.
3087: .It Fl outform Cm der | pem
3088: The output format.
1.1 jsing 3089: .It Fl passin Ar arg
3090: The key password source.
3091: .It Fl passout Ar arg
3092: The output file password source.
3093: .It Fl pubkey
1.63 jmc 3094: Output the public key.
1.1 jsing 3095: .It Fl reqopt Ar option
3096: Customise the output format used with
3097: .Fl text .
3098: The
3099: .Ar option
3100: argument can be a single option or multiple options separated by commas.
1.63 jmc 3101: See also the discussion of
1.1 jsing 3102: .Fl certopt
1.63 jmc 3103: in the
1.1 jsing 3104: .Nm x509
3105: command.
3106: .It Fl set_serial Ar n
3107: Serial number to use when outputting a self-signed certificate.
3108: This may be specified as a decimal value or a hex value if preceded by
3109: .Sq 0x .
3110: It is possible to use negative serial numbers but this is not recommended.
3111: .It Fl subj Ar arg
1.63 jmc 3112: Replaces the subject field of an input request
3113: with the specified data and output the modified request.
3114: .Ar arg
3115: must be formatted as /type0=value0/type1=value1/type2=...;
1.1 jsing 3116: characters may be escaped by
3117: .Sq \e
1.63 jmc 3118: (backslash);
1.1 jsing 3119: no spaces are skipped.
3120: .It Fl subject
1.63 jmc 3121: Print the request subject (or certificate subject if
1.1 jsing 3122: .Fl x509
1.63 jmc 3123: is specified).
1.1 jsing 3124: .It Fl text
1.64 jmc 3125: Print the certificate request in plain text.
1.1 jsing 3126: .It Fl utf8
1.63 jmc 3127: Interpret field values as UTF8 strings, not ASCII.
1.1 jsing 3128: .It Fl verbose
3129: Print extra details about the operations being performed.
3130: .It Fl verify
1.63 jmc 3131: Verify the signature on the request.
1.1 jsing 3132: .It Fl x509
1.63 jmc 3133: Output a self-signed certificate instead of a certificate request.
3134: This is typically used to generate a test certificate or a self-signed root CA.
3135: The extensions added to the certificate (if any)
1.1 jsing 3136: are specified in the configuration file.
3137: Unless specified using the
3138: .Fl set_serial
1.63 jmc 3139: option, 0 is used for the serial number.
1.1 jsing 3140: .El
1.63 jmc 3141: .Pp
1.1 jsing 3142: The configuration options are specified in the
1.63 jmc 3143: .Qq req
1.1 jsing 3144: section of the configuration file.
1.63 jmc 3145: The options available are as follows:
1.1 jsing 3146: .Bl -tag -width "XXXX"
1.63 jmc 3147: .It Cm attributes
3148: The section containing any request attributes: its format
1.1 jsing 3149: is the same as
1.63 jmc 3150: .Cm distinguished_name .
3151: Typically these may contain the challengePassword or unstructuredName types.
3152: They are currently ignored by the
3153: .Nm openssl
1.1 jsing 3154: request signing utilities, but some CAs might want them.
1.63 jmc 3155: .It Cm default_bits
3156: The default key size, in bits.
3157: The default is 2048.
1.1 jsing 3158: It is used if the
3159: .Fl new
1.63 jmc 3160: option is used and can be overridden by using the
1.1 jsing 3161: .Fl newkey
3162: option.
1.63 jmc 3163: .It Cm default_keyfile
3164: The default file to write a private key to,
3165: or standard output if not specified.
3166: It can be overridden by the
1.1 jsing 3167: .Fl keyout
3168: option.
1.63 jmc 3169: .It Cm default_md
3170: The digest algorithm to use.
1.1 jsing 3171: Possible values include
1.63 jmc 3172: .Cm md5 ,
3173: .Cm sha1
1.1 jsing 3174: and
1.63 jmc 3175: .Cm sha256
3176: (the default).
3177: It can be overridden on the command line.
3178: .It Cm distinguished_name
3179: The section containing the distinguished name fields to
1.1 jsing 3180: prompt for when generating a certificate or certificate request.
1.63 jmc 3181: The format is described below.
3182: .It Cm encrypt_key
3183: If set to
3184: .Qq no
3185: and a private key is generated, it is not encrypted.
3186: It is equivalent to the
1.1 jsing 3187: .Fl nodes
1.63 jmc 3188: option.
1.1 jsing 3189: For compatibility,
1.63 jmc 3190: .Cm encrypt_rsa_key
1.1 jsing 3191: is an equivalent option.
1.63 jmc 3192: .It Cm input_password | output_password
3193: The passwords for the input private key file (if present)
3194: and the output private key file (if one will be created).
1.1 jsing 3195: The command line options
3196: .Fl passin
3197: and
3198: .Fl passout
3199: override the configuration file values.
1.63 jmc 3200: .It Cm oid_file
3201: A file containing additional OBJECT IDENTIFIERS.
1.1 jsing 3202: Each line of the file should consist of the numerical form of the
3203: object identifier, followed by whitespace, then the short name followed
3204: by whitespace and finally the long name.
1.63 jmc 3205: .It Cm oid_section
3206: Specify a section in the configuration file containing extra
1.1 jsing 3207: object identifiers.
3208: Each line should consist of the short name of the
3209: object identifier followed by
3210: .Sq =
3211: and the numerical form.
3212: The short and long names are the same when this option is used.
1.63 jmc 3213: .It Cm prompt
3214: If set to
3215: .Qq no ,
3216: it disables prompting of certificate fields
1.1 jsing 3217: and just takes values from the config file directly.
3218: It also changes the expected format of the
1.63 jmc 3219: .Cm distinguished_name
1.1 jsing 3220: and
1.63 jmc 3221: .Cm attributes
1.1 jsing 3222: sections.
1.63 jmc 3223: .It Cm req_extensions
3224: The configuration file section containing a list of
1.1 jsing 3225: extensions to add to the certificate request.
3226: It can be overridden by the
3227: .Fl reqexts
1.63 jmc 3228: option.
3229: .It Cm string_mask
3230: Limit the string types for encoding certain fields.
1.1 jsing 3231: The following values may be used, limiting strings to the indicated types:
3232: .Bl -tag -width "MASK:number"
1.63 jmc 3233: .It Cm utf8only
3234: UTF8String.
1.1 jsing 3235: This is the default, as recommended by PKIX in RFC 2459.
1.63 jmc 3236: .It Cm default
3237: PrintableString, IA5String, T61String, BMPString, UTF8String.
3238: .It Cm pkix
3239: PrintableString, IA5String, BMPString, UTF8String.
3240: Inspired by the PKIX recommendation in RFC 2459 for certificates
3241: generated before 2004, but differs by also permitting IA5String.
3242: .It Cm nombstr
3243: PrintableString, IA5String, T61String, UniversalString.
3244: A workaround for some ancient software that had problems
3245: with the variable-sized BMPString and UTF8String types.
1.1 jsing 3246: .It Cm MASK : Ns Ar number
1.63 jmc 3247: An explicit bitmask of permitted types, where
1.1 jsing 3248: .Ar number
3249: is a C-style hex, decimal, or octal number that's a bit-wise OR of
3250: .Dv B_ASN1_*
3251: values from
3252: .In openssl/asn1.h .
3253: .El
1.63 jmc 3254: .It Cm utf8
3255: If set to
3256: .Qq yes ,
1.72 jmc 3257: field values are interpreted as UTF8 strings.
1.63 jmc 3258: .It Cm x509_extensions
3259: The configuration file section containing a list of
1.1 jsing 3260: extensions to add to a certificate generated when the
3261: .Fl x509
3262: switch is used.
3263: It can be overridden by the
3264: .Fl extensions
1.72 jmc 3265: command line switch.
1.1 jsing 3266: .El
1.63 jmc 3267: .Pp
1.1 jsing 3268: There are two separate formats for the distinguished name and attribute
3269: sections.
3270: If the
3271: .Fl prompt
3272: option is set to
1.63 jmc 3273: .Qq no ,
1.72 jmc 3274: then these sections just consist of field names and values.
3275: If the
1.1 jsing 3276: .Fl prompt
3277: option is absent or not set to
1.63 jmc 3278: .Qq no ,
1.72 jmc 3279: then the file contains field prompting information of the form:
1.1 jsing 3280: .Bd -unfilled -offset indent
3281: fieldName="prompt"
3282: fieldName_default="default field value"
3283: fieldName_min= 2
3284: fieldName_max= 4
3285: .Ed
3286: .Pp
3287: .Qq fieldName
3288: is the field name being used, for example
1.63 jmc 3289: .Cm commonName
3290: (or CN).
1.1 jsing 3291: The
3292: .Qq prompt
3293: string is used to ask the user to enter the relevant details.
3294: If the user enters nothing, the default value is used;
3295: if no default value is present, the field is omitted.
3296: A field can still be omitted if a default value is present,
3297: if the user just enters the
3298: .Sq \&.
3299: character.
3300: .Pp
3301: The number of characters entered must be between the
1.63 jmc 3302: fieldName_min and fieldName_max limits:
1.1 jsing 3303: there may be additional restrictions based on the field being used
3304: (for example
1.63 jmc 3305: .Cm countryName
1.1 jsing 3306: can only ever be two characters long and must fit in a
1.63 jmc 3307: .Cm PrintableString ) .
1.1 jsing 3308: .Pp
3309: Some fields (such as
1.63 jmc 3310: .Cm organizationName )
1.1 jsing 3311: can be used more than once in a DN.
3312: This presents a problem because configuration files will
3313: not recognize the same name occurring twice.
3314: To avoid this problem, if the
1.63 jmc 3315: .Cm fieldName
1.1 jsing 3316: contains some characters followed by a full stop, they will be ignored.
3317: So, for example, a second
1.63 jmc 3318: .Cm organizationName
1.1 jsing 3319: can be input by calling it
3320: .Qq 1.organizationName .
3321: .Pp
3322: The actual permitted field names are any object identifier short or
3323: long names.
3324: These are compiled into
1.63 jmc 3325: .Nm openssl
1.1 jsing 3326: and include the usual values such as
1.63 jmc 3327: .Cm commonName , countryName , localityName , organizationName ,
1.89 jmc 3328: .Cm organizationalUnitName , stateOrProvinceName .
1.1 jsing 3329: Additionally,
1.63 jmc 3330: .Cm emailAddress
1.1 jsing 3331: is included as well as
1.63 jmc 3332: .Cm name , surname , givenName , initials
1.1 jsing 3333: and
1.63 jmc 3334: .Cm dnQualifier .
1.1 jsing 3335: .Pp
3336: Additional object identifiers can be defined with the
1.63 jmc 3337: .Cm oid_file
1.1 jsing 3338: or
1.63 jmc 3339: .Cm oid_section
1.1 jsing 3340: options in the configuration file.
3341: Any additional fields will be treated as though they were a
1.63 jmc 3342: .Cm DirectoryString .
1.1 jsing 3343: .Sh RSA
3344: .nr nS 1
3345: .Nm "openssl rsa"
1.64 jmc 3346: .Op Fl aes128 | aes192 | aes256 | des | des3
1.1 jsing 3347: .Op Fl check
3348: .Op Fl in Ar file
1.64 jmc 3349: .Op Fl inform Cm der | net | pem
1.1 jsing 3350: .Op Fl modulus
3351: .Op Fl noout
3352: .Op Fl out Ar file
1.64 jmc 3353: .Op Fl outform Cm der | net | pem
1.1 jsing 3354: .Op Fl passin Ar arg
3355: .Op Fl passout Ar arg
3356: .Op Fl pubin
3357: .Op Fl pubout
3358: .Op Fl sgckey
3359: .Op Fl text
3360: .nr nS 0
3361: .Pp
3362: The
3363: .Nm rsa
3364: command processes RSA keys.
3365: They can be converted between various forms and their components printed out.
1.64 jmc 3366: .Nm rsa
3367: uses the traditional
1.1 jsing 3368: .Nm SSLeay
3369: compatible format for private key encryption:
3370: newer applications should use the more secure PKCS#8 format using the
3371: .Nm pkcs8
3372: utility.
3373: .Pp
3374: The options are as follows:
3375: .Bl -tag -width Ds
1.64 jmc 3376: .It Fl aes128 | aes192 | aes256 | des | des3
3377: Encrypt the private key with the AES, DES,
1.1 jsing 3378: or the triple DES ciphers, respectively, before outputting it.
3379: A pass phrase is prompted for.
3380: If none of these options are specified, the key is written in plain text.
3381: This means that using the
3382: .Nm rsa
3383: utility to read in an encrypted key with no encryption option can be used
3384: to remove the pass phrase from a key, or by setting the encryption options
3385: it can be used to add or change the pass phrase.
3386: These options can only be used with PEM format output files.
3387: .It Fl check
1.64 jmc 3388: Check the consistency of an RSA private key.
1.1 jsing 3389: .It Fl in Ar file
1.64 jmc 3390: The input file to read from,
3391: or standard input if not specified.
1.1 jsing 3392: If the key is encrypted, a pass phrase will be prompted for.
1.64 jmc 3393: .It Fl inform Cm der | net | pem
3394: The input format.
1.1 jsing 3395: .It Fl noout
1.64 jmc 3396: Do not output the encoded version of the key.
1.1 jsing 3397: .It Fl modulus
1.64 jmc 3398: Print the value of the modulus of the key.
1.1 jsing 3399: .It Fl out Ar file
1.64 jmc 3400: The output file to write to,
3401: or standard output if not specified.
3402: .It Fl outform Cm der | net | pem
3403: The output format.
1.1 jsing 3404: .It Fl passin Ar arg
3405: The key password source.
3406: .It Fl passout Ar arg
3407: The output file password source.
3408: .It Fl pubin
1.64 jmc 3409: Read in a public key,
3410: not a private key.
1.1 jsing 3411: .It Fl pubout
1.64 jmc 3412: Output a public key,
3413: not a private key.
3414: Automatically set if the input is a public key.
1.1 jsing 3415: .It Fl sgckey
1.64 jmc 3416: Use the modified NET algorithm used with some versions of Microsoft IIS
3417: and SGC keys.
1.1 jsing 3418: .It Fl text
1.64 jmc 3419: Print the public/private key components in plain text.
1.1 jsing 3420: .El
3421: .Sh RSAUTL
3422: .nr nS 1
3423: .Nm "openssl rsautl"
3424: .Op Fl asn1parse
3425: .Op Fl certin
3426: .Op Fl decrypt
3427: .Op Fl encrypt
3428: .Op Fl hexdump
3429: .Op Fl in Ar file
3430: .Op Fl inkey Ar file
1.65 jmc 3431: .Op Fl keyform Cm der | pem
1.86 jsing 3432: .Op Fl oaep | pkcs | raw
1.1 jsing 3433: .Op Fl out Ar file
3434: .Op Fl pubin
3435: .Op Fl sign
3436: .Op Fl verify
3437: .nr nS 0
3438: .Pp
3439: The
3440: .Nm rsautl
3441: command can be used to sign, verify, encrypt and decrypt
3442: data using the RSA algorithm.
3443: .Pp
3444: The options are as follows:
3445: .Bl -tag -width Ds
3446: .It Fl asn1parse
3447: Asn1parse the output data; this is useful when combined with the
3448: .Fl verify
3449: option.
3450: .It Fl certin
3451: The input is a certificate containing an RSA public key.
3452: .It Fl decrypt
3453: Decrypt the input data using an RSA private key.
3454: .It Fl encrypt
3455: Encrypt the input data using an RSA public key.
3456: .It Fl hexdump
3457: Hex dump the output data.
3458: .It Fl in Ar file
1.65 jmc 3459: The input to read from,
3460: or standard input if not specified.
1.1 jsing 3461: .It Fl inkey Ar file
1.65 jmc 3462: The input key file; by default an RSA private key.
3463: .It Fl keyform Cm der | pem
1.85 tb 3464: The private key format.
1.65 jmc 3465: The default is
3466: .Cm pem .
1.86 jsing 3467: .It Fl oaep | pkcs | raw
1.1 jsing 3468: The padding to use:
1.65 jmc 3469: PKCS#1 OAEP, PKCS#1 v1.5 (the default), or no padding, respectively.
1.1 jsing 3470: For signatures, only
3471: .Fl pkcs
3472: and
3473: .Fl raw
3474: can be used.
3475: .It Fl out Ar file
1.65 jmc 3476: The output file to write to,
3477: or standard output if not specified.
1.1 jsing 3478: .It Fl pubin
3479: The input file is an RSA public key.
3480: .It Fl sign
3481: Sign the input data and output the signed result.
3482: This requires an RSA private key.
3483: .It Fl verify
3484: Verify the input data and output the recovered data.
3485: .El
3486: .Sh S_CLIENT
3487: .nr nS 1
3488: .Nm "openssl s_client"
3489: .Op Fl 4 | 6
3490: .Op Fl bugs
3491: .Op Fl CAfile Ar file
3492: .Op Fl CApath Ar directory
3493: .Op Fl cert Ar file
3494: .Op Fl check_ss_sig
3495: .Op Fl cipher Ar cipherlist
1.66 jmc 3496: .Op Fl connect Ar host Ns Op : Ns Ar port
1.1 jsing 3497: .Op Fl crl_check
3498: .Op Fl crl_check_all
3499: .Op Fl crlf
3500: .Op Fl debug
3501: .Op Fl extended_crl
1.87 jmc 3502: .Op Fl groups
1.1 jsing 3503: .Op Fl ign_eof
3504: .Op Fl ignore_critical
3505: .Op Fl issuer_checks
3506: .Op Fl key Ar keyfile
3507: .Op Fl msg
3508: .Op Fl nbio
3509: .Op Fl nbio_test
3510: .Op Fl no_ticket
3511: .Op Fl no_tls1
1.6 guenther 3512: .Op Fl no_tls1_1
3513: .Op Fl no_tls1_2
1.1 jsing 3514: .Op Fl pause
3515: .Op Fl policy_check
3516: .Op Fl prexit
1.11 bluhm 3517: .Op Fl proxy Ar host : Ns Ar port
1.1 jsing 3518: .Op Fl psk Ar key
3519: .Op Fl psk_identity Ar identity
3520: .Op Fl quiet
3521: .Op Fl reconnect
1.5 jsing 3522: .Op Fl servername Ar name
1.1 jsing 3523: .Op Fl showcerts
3524: .Op Fl starttls Ar protocol
3525: .Op Fl state
3526: .Op Fl tls1
1.31 jmc 3527: .Op Fl tls1_1
3528: .Op Fl tls1_2
1.1 jsing 3529: .Op Fl tlsextdebug
3530: .Op Fl verify Ar depth
3531: .Op Fl x509_strict
1.19 landry 3532: .Op Fl xmpphost Ar host
1.1 jsing 3533: .nr nS 0
3534: .Pp
3535: The
3536: .Nm s_client
3537: command implements a generic SSL/TLS client which connects
3538: to a remote host using SSL/TLS.
1.66 jmc 3539: .Pp
3540: If a connection is established with an SSL server, any data received
3541: from the server is displayed and any key presses will be sent to the
3542: server.
3543: When used interactively (which means neither
3544: .Fl quiet
3545: nor
3546: .Fl ign_eof
3547: have been given), the session will be renegotiated if the line begins with an
3548: .Cm R ;
3549: if the line begins with a
3550: .Cm Q
3551: or if end of file is reached, the connection will be closed down.
1.1 jsing 3552: .Pp
3553: The options are as follows:
3554: .Bl -tag -width Ds
3555: .It Fl 4
1.66 jmc 3556: Attempt connections using IPv4 only.
1.1 jsing 3557: .It Fl 6
1.66 jmc 3558: Attempt connections using IPv6 only.
1.1 jsing 3559: .It Fl bugs
1.66 jmc 3560: Enable various workarounds for buggy implementations.
1.1 jsing 3561: .It Fl CAfile Ar file
3562: A
3563: .Ar file
3564: containing trusted certificates to use during server authentication
3565: and to use when attempting to build the client certificate chain.
3566: .It Fl CApath Ar directory
3567: The
3568: .Ar directory
3569: to use for server certificate verification.
3570: This directory must be in
3571: .Qq hash format ;
3572: see
3573: .Fl verify
3574: for more information.
3575: These are also used when building the client certificate chain.
3576: .It Fl cert Ar file
3577: The certificate to use, if one is requested by the server.
3578: The default is not to use a certificate.
3579: .It Xo
3580: .Fl check_ss_sig ,
3581: .Fl crl_check ,
3582: .Fl crl_check_all ,
3583: .Fl extended_crl ,
3584: .Fl ignore_critical ,
3585: .Fl issuer_checks ,
3586: .Fl policy_check ,
3587: .Fl x509_strict
3588: .Xc
3589: Set various certificate chain validation options.
3590: See the
1.66 jmc 3591: .Nm verify
1.1 jsing 3592: command for details.
3593: .It Fl cipher Ar cipherlist
1.66 jmc 3594: Modify the cipher list sent by the client.
1.1 jsing 3595: Although the server determines which cipher suite is used, it should take
3596: the first supported cipher in the list sent by the client.
3597: See the
1.66 jmc 3598: .Nm ciphers
3599: command for more information.
3600: .It Fl connect Ar host Ns Op : Ns Ar port
3601: The
1.1 jsing 3602: .Ar host
1.66 jmc 3603: and
1.1 jsing 3604: .Ar port
3605: to connect to.
3606: If not specified, an attempt is made to connect to the local host
3607: on port 4433.
3608: Alternatively, the host and port pair may be separated using a forward-slash
1.66 jmc 3609: character,
3610: which is useful for numeric IPv6 addresses.
1.1 jsing 3611: .It Fl crlf
1.66 jmc 3612: Translate a line feed from the terminal into CR+LF,
3613: as required by some servers.
1.1 jsing 3614: .It Fl debug
1.66 jmc 3615: Print extensive debugging information, including a hex dump of all traffic.
1.87 jmc 3616: .It Fl groups Ar ecgroups
3617: Specify a colon-separated list of permitted EC curve groups.
1.1 jsing 3618: .It Fl ign_eof
1.66 jmc 3619: Inhibit shutting down the connection when end of file is reached in the input.
1.1 jsing 3620: .It Fl key Ar keyfile
3621: The private key to use.
3622: If not specified, the certificate file will be used.
3623: .It Fl msg
3624: Show all protocol messages with hex dump.
3625: .It Fl nbio
1.66 jmc 3626: Turn on non-blocking I/O.
1.1 jsing 3627: .It Fl nbio_test
1.66 jmc 3628: Test non-blocking I/O.
1.31 jmc 3629: .It Fl no_tls1 | no_tls1_1 | no_tls1_2
1.66 jmc 3630: Disable the use of TLS1.0, 1.1, and 1.2, respectively.
1.1 jsing 3631: .It Fl no_ticket
3632: Disable RFC 4507 session ticket support.
3633: .It Fl pause
1.66 jmc 3634: Pause 1 second between each read and write call.
1.1 jsing 3635: .It Fl prexit
3636: Print session information when the program exits.
3637: This will always attempt
3638: to print out information even if the connection fails.
3639: Normally, information will only be printed out once if the connection succeeds.
3640: This option is useful because the cipher in use may be renegotiated
3641: or the connection may fail because a client certificate is required or is
3642: requested only after an attempt is made to access a certain URL.
1.66 jmc 3643: Note that the output produced by this option is not always accurate
3644: because a connection might never have been established.
1.11 bluhm 3645: .It Fl proxy Ar host : Ns Ar port
3646: Use the HTTP proxy at
3647: .Ar host
3648: and
3649: .Ar port .
3650: The connection to the proxy is done in cleartext and the
3651: .Fl connect
3652: argument is given to the proxy.
3653: If not specified, localhost is used as final destination.
3654: After that, switch the connection through the proxy to the destination
3655: to TLS.
1.1 jsing 3656: .It Fl psk Ar key
3657: Use the PSK key
3658: .Ar key
3659: when using a PSK cipher suite.
3660: The key is given as a hexadecimal number without the leading 0x,
3661: for example -psk 1a2b3c4d.
3662: .It Fl psk_identity Ar identity
1.66 jmc 3663: Use the PSK
1.1 jsing 3664: .Ar identity
3665: when using a PSK cipher suite.
3666: .It Fl quiet
3667: Inhibit printing of session and certificate information.
3668: This implicitly turns on
3669: .Fl ign_eof
3670: as well.
3671: .It Fl reconnect
1.66 jmc 3672: Reconnect to the same server 5 times using the same session ID; this can
1.1 jsing 3673: be used as a test that session caching is working.
1.5 jsing 3674: .It Fl servername Ar name
3675: Include the TLS Server Name Indication (SNI) extension in the ClientHello
3676: message, using the specified server
3677: .Ar name .
1.1 jsing 3678: .It Fl showcerts
3679: Display the whole server certificate chain: normally only the server
3680: certificate itself is displayed.
3681: .It Fl starttls Ar protocol
1.66 jmc 3682: Send the protocol-specific messages to switch to TLS for communication.
1.1 jsing 3683: .Ar protocol
3684: is a keyword for the intended protocol.
3685: Currently, the supported keywords are
3686: .Qq ftp ,
3687: .Qq imap ,
3688: .Qq smtp ,
3689: .Qq pop3 ,
3690: and
3691: .Qq xmpp .
3692: .It Fl state
1.66 jmc 3693: Print the SSL session states.
1.31 jmc 3694: .It Fl tls1 | tls1_1 | tls1_2
3695: Permit only TLS1.0, 1.1, or 1.2, respectively.
1.1 jsing 3696: .It Fl tlsextdebug
1.66 jmc 3697: Print a hex dump of any TLS extensions received from the server.
1.1 jsing 3698: .It Fl verify Ar depth
1.66 jmc 3699: Turn on server certificate verification,
3700: with a maximum length of
3701: .Ar depth .
1.1 jsing 3702: Currently the verify operation continues after errors so all the problems
3703: with a certificate chain can be seen.
3704: As a side effect the connection will never fail due to a server
3705: certificate verify failure.
1.19 landry 3706: .It Fl xmpphost Ar hostname
1.66 jmc 3707: When used with
1.19 landry 3708: .Fl starttls Ar xmpp ,
1.66 jmc 3709: specify the host for the "to" attribute of the stream element.
1.19 landry 3710: If this option is not specified then the host specified with
3711: .Fl connect
3712: will be used.
1.1 jsing 3713: .El
3714: .Sh S_SERVER
3715: .nr nS 1
3716: .Nm "openssl s_server"
3717: .Op Fl accept Ar port
3718: .Op Fl bugs
3719: .Op Fl CAfile Ar file
3720: .Op Fl CApath Ar directory
3721: .Op Fl cert Ar file
3722: .Op Fl cipher Ar cipherlist
3723: .Op Fl context Ar id
3724: .Op Fl crl_check
3725: .Op Fl crl_check_all
3726: .Op Fl crlf
3727: .Op Fl dcert Ar file
3728: .Op Fl debug
3729: .Op Fl dhparam Ar file
3730: .Op Fl dkey Ar file
3731: .Op Fl hack
3732: .Op Fl HTTP
3733: .Op Fl id_prefix Ar arg
3734: .Op Fl key Ar keyfile
3735: .Op Fl msg
3736: .Op Fl nbio
3737: .Op Fl nbio_test
3738: .Op Fl no_dhe
3739: .Op Fl no_tls1
1.6 guenther 3740: .Op Fl no_tls1_1
3741: .Op Fl no_tls1_2
1.1 jsing 3742: .Op Fl no_tmp_rsa
3743: .Op Fl nocert
3744: .Op Fl psk Ar key
3745: .Op Fl psk_hint Ar hint
3746: .Op Fl quiet
3747: .Op Fl serverpref
3748: .Op Fl state
3749: .Op Fl tls1
1.31 jmc 3750: .Op Fl tls1_1
3751: .Op Fl tls1_2
1.1 jsing 3752: .Op Fl Verify Ar depth
3753: .Op Fl verify Ar depth
3754: .Op Fl WWW
3755: .Op Fl www
3756: .nr nS 0
3757: .Pp
3758: The
3759: .Nm s_server
3760: command implements a generic SSL/TLS server which listens
3761: for connections on a given port using SSL/TLS.
3762: .Pp
1.67 jmc 3763: If a connection request is established with a client and neither the
3764: .Fl www
3765: nor the
3766: .Fl WWW
3767: option has been used, then any data received
3768: from the client is displayed and any key presses are sent to the client.
3769: Certain single letter commands perform special operations:
3770: .Pp
3771: .Bl -tag -width "XXXX" -compact
3772: .It Ic P
3773: Send plain text, which should cause the client to disconnect.
3774: .It Ic Q
3775: End the current SSL connection and exit.
3776: .It Ic q
3777: End the current SSL connection, but still accept new connections.
3778: .It Ic R
3779: Renegotiate the SSL session and request a client certificate.
3780: .It Ic r
3781: Renegotiate the SSL session.
3782: .It Ic S
3783: Print out some session cache status information.
3784: .El
3785: .Pp
1.1 jsing 3786: The options are as follows:
3787: .Bl -tag -width Ds
3788: .It Fl accept Ar port
1.67 jmc 3789: Listen on TCP
1.1 jsing 3790: .Ar port
1.67 jmc 3791: for connections.
3792: The default is port 4433.
1.1 jsing 3793: .It Fl bugs
1.67 jmc 3794: Enable various workarounds for buggy implementations.
1.1 jsing 3795: .It Fl CAfile Ar file
1.67 jmc 3796: A
3797: .Ar file
3798: containing trusted certificates to use during client authentication
1.1 jsing 3799: and to use when attempting to build the server certificate chain.
3800: The list is also used in the list of acceptable client CAs passed to the
3801: client when a certificate is requested.
3802: .It Fl CApath Ar directory
3803: The
3804: .Ar directory
3805: to use for client certificate verification.
3806: This directory must be in
3807: .Qq hash format ;
3808: see
3809: .Fl verify
3810: for more information.
3811: These are also used when building the server certificate chain.
3812: .It Fl cert Ar file
1.67 jmc 3813: The certificate to use: most server's cipher suites require the use of a
3814: certificate and some require a certificate with a certain public key type.
3815: For example, the DSS cipher suites require a certificate containing a DSS
3816: (DSA) key.
1.1 jsing 3817: If not specified, the file
3818: .Pa server.pem
3819: will be used.
3820: .It Fl cipher Ar cipherlist
1.67 jmc 3821: Modify the cipher list used by the server.
1.1 jsing 3822: This allows the cipher list used by the server to be modified.
3823: When the client sends a list of supported ciphers, the first client cipher
3824: also included in the server list is used.
3825: Because the client specifies the preference order, the order of the server
3826: cipherlist is irrelevant.
3827: See the
1.67 jmc 3828: .Nm ciphers
3829: command for more information.
1.1 jsing 3830: .It Fl context Ar id
1.67 jmc 3831: Set the SSL context ID.
1.1 jsing 3832: It can be given any string value.
3833: .It Fl crl_check , crl_check_all
3834: Check the peer certificate has not been revoked by its CA.
3835: The CRLs are appended to the certificate file.
3836: .Fl crl_check_all
1.67 jmc 3837: checks all CRLs of all CAs in the chain.
1.1 jsing 3838: .It Fl crlf
1.67 jmc 3839: Translate a line feed from the terminal into CR+LF.
1.1 jsing 3840: .It Fl dcert Ar file , Fl dkey Ar file
3841: Specify an additional certificate and private key; these behave in the
3842: same manner as the
3843: .Fl cert
3844: and
3845: .Fl key
3846: options except there is no default if they are not specified
1.67 jmc 3847: (no additional certificate or key is used).
1.1 jsing 3848: By using RSA and DSS certificates and keys,
3849: a server can support clients which only support RSA or DSS cipher suites
3850: by using an appropriate certificate.
3851: .It Fl debug
1.67 jmc 3852: Print extensive debugging information, including a hex dump of all traffic.
1.1 jsing 3853: .It Fl dhparam Ar file
3854: The DH parameter file to use.
3855: The ephemeral DH cipher suites generate keys
3856: using a set of DH parameters.
3857: If not specified, an attempt is made to
3858: load the parameters from the server certificate file.
3859: If this fails, a static set of parameters hard coded into the
3860: .Nm s_server
3861: program will be used.
3862: .It Fl hack
1.67 jmc 3863: Enables a further workaround for some early Netscape SSL code.
1.1 jsing 3864: .It Fl HTTP
1.67 jmc 3865: Emulate a simple web server.
3866: Pages are resolved relative to the current directory.
3867: For example if the URL
1.1 jsing 3868: .Pa https://myhost/page.html
3869: is requested, the file
3870: .Pa ./page.html
3871: will be loaded.
3872: The files loaded are assumed to contain a complete and correct HTTP
3873: response (lines that are part of the HTTP response line and headers
3874: must end with CRLF).
3875: .It Fl id_prefix Ar arg
3876: Generate SSL/TLS session IDs prefixed by
3877: .Ar arg .
3878: This is mostly useful for testing any SSL/TLS code
1.81 jmc 3879: that wish to deal with multiple servers,
3880: when each of which might be generating a unique range of session IDs.
1.1 jsing 3881: .It Fl key Ar keyfile
3882: The private key to use.
3883: If not specified, the certificate file will be used.
3884: .It Fl msg
3885: Show all protocol messages with hex dump.
3886: .It Fl nbio
1.67 jmc 3887: Turn on non-blocking I/O.
1.1 jsing 3888: .It Fl nbio_test
1.67 jmc 3889: Test non-blocking I/O.
1.1 jsing 3890: .It Fl no_dhe
1.67 jmc 3891: Disable ephemeral DH cipher suites.
1.31 jmc 3892: .It Fl no_tls1 | no_tls1_1 | no_tls1_2
1.67 jmc 3893: Disable the use of TLS1.0, 1.1, and 1.2, respectively.
1.1 jsing 3894: .It Fl no_tmp_rsa
1.67 jmc 3895: Disable temporary RSA key generation.
1.1 jsing 3896: .It Fl nocert
1.67 jmc 3897: Do not use a certificate.
1.1 jsing 3898: This restricts the cipher suites available to the anonymous ones
1.67 jmc 3899: (currently just anonymous DH).
1.1 jsing 3900: .It Fl psk Ar key
3901: Use the PSK key
3902: .Ar key
3903: when using a PSK cipher suite.
3904: The key is given as a hexadecimal number without the leading 0x,
3905: for example -psk 1a2b3c4d.
3906: .It Fl psk_hint Ar hint
3907: Use the PSK identity hint
3908: .Ar hint
3909: when using a PSK cipher suite.
3910: .It Fl quiet
3911: Inhibit printing of session and certificate information.
3912: .It Fl serverpref
3913: Use server's cipher preferences.
3914: .It Fl state
1.67 jmc 3915: Print the SSL session states.
1.31 jmc 3916: .It Fl tls1 | tls1_1 | tls1_2
3917: Permit only TLS1.0, 1.1, or 1.2, respectively.
1.1 jsing 3918: .It Fl WWW
1.67 jmc 3919: Emulate a simple web server.
3920: Pages are resolved relative to the current directory.
3921: For example if the URL
1.1 jsing 3922: .Pa https://myhost/page.html
3923: is requested, the file
3924: .Pa ./page.html
3925: will be loaded.
3926: .It Fl www
1.67 jmc 3927: Send a status message to the client when it connects,
3928: including information about the ciphers used and various session parameters.
1.1 jsing 3929: The output is in HTML format so this option will normally be used with a
3930: web browser.
3931: .It Fl Verify Ar depth , Fl verify Ar depth
1.67 jmc 3932: Request a certificate chain from the client,
3933: with a maximum length of
3934: .Ar depth .
3935: With
3936: .Fl Verify ,
3937: the client must supply a certificate or an error occurs;
3938: with
3939: .Fl verify ,
3940: a certificate is requested but the client does not have to send one.
1.1 jsing 3941: .El
3942: .Sh S_TIME
3943: .nr nS 1
3944: .Nm "openssl s_time"
3945: .Op Fl bugs
3946: .Op Fl CAfile Ar file
3947: .Op Fl CApath Ar directory
3948: .Op Fl cert Ar file
3949: .Op Fl cipher Ar cipherlist
1.68 jmc 3950: .Op Fl connect Ar host Ns Op : Ns Ar port
1.1 jsing 3951: .Op Fl key Ar keyfile
3952: .Op Fl nbio
3953: .Op Fl new
1.20 lteo 3954: .Op Fl no_shutdown
1.1 jsing 3955: .Op Fl reuse
3956: .Op Fl time Ar seconds
3957: .Op Fl verify Ar depth
3958: .Op Fl www Ar page
3959: .nr nS 0
3960: .Pp
3961: The
1.68 jmc 3962: .Nm s_time
1.1 jsing 3963: command implements a generic SSL/TLS client which connects to a
3964: remote host using SSL/TLS.
3965: It can request a page from the server and includes
3966: the time to transfer the payload data in its timing measurements.
3967: It measures the number of connections within a given timeframe,
3968: the amount of data transferred
3969: .Pq if any ,
3970: and calculates the average time spent for one connection.
3971: .Pp
3972: The options are as follows:
3973: .Bl -tag -width Ds
3974: .It Fl bugs
1.68 jmc 3975: Enable various workarounds for buggy implementations.
1.1 jsing 3976: .It Fl CAfile Ar file
1.68 jmc 3977: A
3978: .Ar file
3979: containing trusted certificates to use during server authentication
1.1 jsing 3980: and to use when attempting to build the client certificate chain.
3981: .It Fl CApath Ar directory
3982: The directory to use for server certificate verification.
3983: This directory must be in
3984: .Qq hash format ;
3985: see
3986: .Nm verify
3987: for more information.
3988: These are also used when building the client certificate chain.
3989: .It Fl cert Ar file
3990: The certificate to use, if one is requested by the server.
3991: The default is not to use a certificate.
3992: .It Fl cipher Ar cipherlist
1.68 jmc 3993: Modify the cipher list sent by the client.
1.1 jsing 3994: Although the server determines which cipher suite is used,
3995: it should take the first supported cipher in the list sent by the client.
3996: See the
3997: .Nm ciphers
3998: command for more information.
1.68 jmc 3999: .It Fl connect Ar host Ns Op : Ns Ar port
4000: The host and port to connect to.
1.1 jsing 4001: .It Fl key Ar keyfile
4002: The private key to use.
4003: If not specified, the certificate file will be used.
4004: .It Fl nbio
1.68 jmc 4005: Turn on non-blocking I/O.
1.1 jsing 4006: .It Fl new
1.68 jmc 4007: Perform the timing test using a new session ID for each connection.
1.1 jsing 4008: If neither
4009: .Fl new
4010: nor
4011: .Fl reuse
4012: are specified,
4013: they are both on by default and executed in sequence.
1.20 lteo 4014: .It Fl no_shutdown
1.21 jmc 4015: Shut down the connection without sending a
1.68 jmc 4016: .Qq close notify
1.20 lteo 4017: shutdown alert to the server.
1.1 jsing 4018: .It Fl reuse
1.68 jmc 4019: Perform the timing test using the same session ID for each connection.
1.1 jsing 4020: If neither
4021: .Fl new
4022: nor
4023: .Fl reuse
4024: are specified,
4025: they are both on by default and executed in sequence.
4026: .It Fl time Ar seconds
1.68 jmc 4027: Limit
1.1 jsing 4028: .Nm s_time
1.68 jmc 4029: benchmarks to the number of
4030: .Ar seconds .
1.1 jsing 4031: The default is 30 seconds.
4032: .It Fl verify Ar depth
1.68 jmc 4033: Turn on server certificate verification,
4034: with a maximum length of
4035: .Ar depth .
1.1 jsing 4036: Currently the verify operation continues after errors, so all the problems
4037: with a certificate chain can be seen.
4038: As a side effect,
4039: the connection will never fail due to a server certificate verify failure.
4040: .It Fl www Ar page
1.68 jmc 4041: The page to GET from the server.
1.1 jsing 4042: A value of
4043: .Sq /
4044: gets the index.htm[l] page.
4045: If this parameter is not specified,
4046: .Nm s_time
4047: will only perform the handshake to establish SSL connections
4048: but not transfer any payload data.
4049: .El
4050: .Sh SESS_ID
4051: .nr nS 1
4052: .Nm "openssl sess_id"
4053: .Op Fl cert
4054: .Op Fl context Ar ID
4055: .Op Fl in Ar file
1.69 jmc 4056: .Op Fl inform Cm der | pem
1.1 jsing 4057: .Op Fl noout
4058: .Op Fl out Ar file
1.69 jmc 4059: .Op Fl outform Cm der | pem
1.1 jsing 4060: .Op Fl text
4061: .nr nS 0
4062: .Pp
4063: The
4064: .Nm sess_id
4065: program processes the encoded version of the SSL session structure and
4066: optionally prints out SSL session details
1.69 jmc 4067: (for example the SSL session master key)
1.72 jmc 4068: in human-readable format.
1.1 jsing 4069: .Pp
4070: The options are as follows:
4071: .Bl -tag -width Ds
4072: .It Fl cert
4073: If a certificate is present in the session,
4074: it will be output using this option;
4075: if the
4076: .Fl text
4077: option is also present, then it will be printed out in text form.
4078: .It Fl context Ar ID
1.69 jmc 4079: Set the session
1.1 jsing 4080: .Ar ID .
1.69 jmc 4081: The ID can be any string of characters.
1.1 jsing 4082: .It Fl in Ar file
1.69 jmc 4083: The input file to read from,
4084: or standard input if not specified.
4085: .It Fl inform Cm der | pem
4086: The input format.
4087: .Cm der
1.84 jmc 4088: uses an ASN.1 DER-encoded format containing session details.
1.1 jsing 4089: The precise format can vary from one version to the next.
1.69 jmc 4090: .Cm pem
4091: is the default format: it consists of the DER
1.1 jsing 4092: format base64-encoded with additional header and footer lines.
4093: .It Fl noout
1.69 jmc 4094: Do not output the encoded version of the session.
1.1 jsing 4095: .It Fl out Ar file
1.69 jmc 4096: The output file to write to,
4097: or standard output if not specified.
4098: .It Fl outform Cm der | pem
4099: The output format.
1.1 jsing 4100: .It Fl text
1.69 jmc 4101: Print the various public or private key components in plain text,
4102: in addition to the encoded version.
1.1 jsing 4103: .El
4104: .Pp
1.69 jmc 4105: The output of
4106: .Nm sess_id
4107: is composed as follows:
1.1 jsing 4108: .Pp
1.69 jmc 4109: .Bl -tag -width "Verify return code " -offset 3n -compact
4110: .It Protocol
4111: The protocol in use.
4112: .It Cipher
4113: The actual raw SSL or TLS cipher code.
4114: .It Session-ID
4115: The SSL session ID, in hex format.
4116: .It Session-ID-ctx
4117: The session ID context, in hex format.
4118: .It Master-Key
4119: The SSL session master key.
4120: .It Key-Arg
1.1 jsing 4121: The key argument; this is only used in SSL v2.
1.69 jmc 4122: .It Start Time
4123: The session start time.
1.1 jsing 4124: .Ux
4125: format.
1.69 jmc 4126: .It Timeout
4127: The timeout, in seconds.
4128: .It Verify return code
4129: The return code when a certificate is verified.
1.1 jsing 4130: .El
4131: .Pp
4132: Since the SSL session output contains the master key, it is possible to read
4133: the contents of an encrypted session using this information.
4134: Therefore appropriate security precautions
4135: should be taken if the information is being output by a
4136: .Qq real
4137: application.
4138: This is, however, strongly discouraged and should only be used for
4139: debugging purposes.
4140: .Sh SMIME
4141: .nr nS 1
4142: .Nm "openssl smime"
4143: .Oo
4144: .Fl aes128 | aes192 | aes256 | des |
4145: .Fl des3 | rc2-40 | rc2-64 | rc2-128
4146: .Oc
4147: .Op Fl binary
4148: .Op Fl CAfile Ar file
4149: .Op Fl CApath Ar directory
4150: .Op Fl certfile Ar file
4151: .Op Fl check_ss_sig
4152: .Op Fl content Ar file
4153: .Op Fl crl_check
4154: .Op Fl crl_check_all
4155: .Op Fl decrypt
4156: .Op Fl encrypt
4157: .Op Fl extended_crl
4158: .Op Fl from Ar addr
4159: .Op Fl ignore_critical
4160: .Op Fl in Ar file
4161: .Op Fl indef
1.70 jmc 4162: .Op Fl inform Cm der | pem | smime
1.1 jsing 4163: .Op Fl inkey Ar file
4164: .Op Fl issuer_checks
1.70 jmc 4165: .Op Fl keyform Cm pem
1.1 jsing 4166: .Op Fl md Ar digest
4167: .Op Fl noattr
4168: .Op Fl nocerts
4169: .Op Fl nochain
4170: .Op Fl nodetach
4171: .Op Fl noindef
4172: .Op Fl nointern
4173: .Op Fl nosigs
4174: .Op Fl noverify
4175: .Op Fl out Ar file
1.70 jmc 4176: .Op Fl outform Cm der | pem | smime
1.1 jsing 4177: .Op Fl passin Ar arg
4178: .Op Fl pk7out
4179: .Op Fl policy_check
4180: .Op Fl recip Ar file
4181: .Op Fl resign
4182: .Op Fl sign
4183: .Op Fl signer Ar file
4184: .Op Fl stream
4185: .Op Fl subject Ar s
4186: .Op Fl text
4187: .Op Fl to Ar addr
4188: .Op Fl verify
4189: .Op Fl x509_strict
4190: .Op Ar cert.pem ...
4191: .nr nS 0
4192: .Pp
4193: The
4194: .Nm smime
1.70 jmc 4195: command handles S/MIME mail.
4196: It can encrypt, decrypt, sign, and verify S/MIME messages.
4197: .Pp
4198: The MIME message must be sent without any blank lines between the
4199: headers and the output.
4200: Some mail programs will automatically add a blank line.
4201: Piping the mail directly to an MTA is one way to
4202: achieve the correct format.
4203: .Pp
4204: The supplied message to be signed or encrypted must include the necessary
4205: MIME headers or many S/MIME clients won't display it properly (if at all).
4206: Use the
4207: .Fl text
4208: option to automatically add plain text headers.
1.1 jsing 4209: .Pp
1.70 jmc 4210: A
4211: .Qq signed and encrypted
4212: message is one where a signed message is then encrypted.
4213: This can be produced by encrypting an already signed message.
1.1 jsing 4214: .Pp
1.70 jmc 4215: There are a number of operations that can be performed, as follows:
1.1 jsing 4216: .Bl -tag -width "XXXX"
4217: .It Fl decrypt
4218: Decrypt mail using the supplied certificate and private key.
1.70 jmc 4219: The input file is an encrypted mail message in MIME format.
1.1 jsing 4220: The decrypted mail is written to the output file.
4221: .It Fl encrypt
4222: Encrypt mail for the given recipient certificates.
1.70 jmc 4223: The input is the message to be encrypted.
4224: The output file is the encrypted mail, in MIME format.
1.1 jsing 4225: .It Fl pk7out
1.70 jmc 4226: Take an input message and write out a PEM-encoded PKCS#7 structure.
1.1 jsing 4227: .It Fl resign
4228: Resign a message: take an existing message and one or more new signers.
4229: .It Fl sign
4230: Sign mail using the supplied certificate and private key.
1.70 jmc 4231: The input file is the message to be signed.
4232: The signed message, in MIME format, is written to the output file.
1.1 jsing 4233: .It Fl verify
4234: Verify signed mail.
1.70 jmc 4235: The input is a signed mail message and the output is the signed data.
1.1 jsing 4236: Both clear text and opaque signing is supported.
4237: .El
4238: .Pp
1.14 jmc 4239: The remaining options are as follows:
1.1 jsing 4240: .Bl -tag -width "XXXX"
4241: .It Xo
4242: .Fl aes128 | aes192 | aes256 | des |
4243: .Fl des3 | rc2-40 | rc2-64 | rc2-128
4244: .Xc
4245: The encryption algorithm to use.
1.70 jmc 4246: 128-, 192-, or 256-bit AES, DES (56 bits), triple DES (168 bits),
1.1 jsing 4247: or 40-, 64-, or 128-bit RC2, respectively;
4248: if not specified, 40-bit RC2 is
4249: used.
4250: Only used with
4251: .Fl encrypt .
4252: .It Fl binary
4253: Normally, the input message is converted to
4254: .Qq canonical
1.70 jmc 4255: format which uses CR/LF as end of line,
4256: as required by the S/MIME specification.
1.1 jsing 4257: When this option is present no translation occurs.
1.70 jmc 4258: This is useful when handling binary data which may not be in MIME format.
1.1 jsing 4259: .It Fl CAfile Ar file
4260: A
4261: .Ar file
4262: containing trusted CA certificates; only used with
4263: .Fl verify .
4264: .It Fl CApath Ar directory
4265: A
4266: .Ar directory
4267: containing trusted CA certificates; only used with
4268: .Fl verify .
4269: This directory must be a standard certificate directory:
4270: that is, a hash of each subject name (using
4271: .Nm x509 -hash )
4272: should be linked to each certificate.
4273: .It Ar cert.pem ...
4274: One or more certificates of message recipients: used when encrypting
4275: a message.
4276: .It Fl certfile Ar file
4277: Allows additional certificates to be specified.
4278: When signing, these will be included with the message.
4279: When verifying, these will be searched for the signers' certificates.
4280: The certificates should be in PEM format.
4281: .It Xo
4282: .Fl check_ss_sig ,
4283: .Fl crl_check ,
4284: .Fl crl_check_all ,
4285: .Fl extended_crl ,
4286: .Fl ignore_critical ,
4287: .Fl issuer_checks ,
4288: .Fl policy_check ,
4289: .Fl x509_strict
4290: .Xc
4291: Set various certificate chain validation options.
4292: See the
1.70 jmc 4293: .Nm verify
1.1 jsing 4294: command for details.
4295: .It Fl content Ar file
1.70 jmc 4296: A file containing the detached content.
1.1 jsing 4297: This is only useful with the
4298: .Fl verify
1.70 jmc 4299: option,
4300: and only usable if the PKCS#7 structure is using the detached
1.1 jsing 4301: signature form where the content is not included.
1.70 jmc 4302: This option will override any content if the input format is S/MIME
4303: and it uses the multipart/signed MIME content type.
1.1 jsing 4304: .It Xo
4305: .Fl from Ar addr ,
4306: .Fl subject Ar s ,
4307: .Fl to Ar addr
4308: .Xc
4309: The relevant mail headers.
4310: These are included outside the signed
4311: portion of a message so they may be included manually.
1.70 jmc 4312: When signing, many S/MIME
1.1 jsing 4313: mail clients check that the signer's certificate email
4314: address matches the From: address.
4315: .It Fl in Ar file
1.70 jmc 4316: The input file to read from.
1.1 jsing 4317: .It Fl indef
4318: Enable streaming I/O for encoding operations.
4319: This permits single pass processing of data without
4320: the need to hold the entire contents in memory,
4321: potentially supporting very large files.
4322: Streaming is automatically set for S/MIME signing with detached
4323: data if the output format is SMIME;
4324: it is currently off by default for all other operations.
1.70 jmc 4325: .It Fl inform Cm der | pem | smime
4326: The input format.
1.1 jsing 4327: .It Fl inkey Ar file
1.70 jmc 4328: The private key to use when signing or decrypting,
4329: which must match the corresponding certificate.
1.1 jsing 4330: If this option is not specified, the private key must be included
4331: in the certificate file specified with
4332: the
4333: .Fl recip
4334: or
4335: .Fl signer
4336: file.
4337: When signing,
4338: this option can be used multiple times to specify successive keys.
1.70 jmc 4339: .It Fl keyform Cm pem
1.1 jsing 4340: Input private key format.
4341: .It Fl md Ar digest
4342: The digest algorithm to use when signing or resigning.
4343: If not present then the default digest algorithm for the signing key is used
4344: (usually SHA1).
4345: .It Fl noattr
1.70 jmc 4346: Do not include attributes.
1.1 jsing 4347: .It Fl nocerts
1.70 jmc 4348: Do not include the signer's certificate.
1.1 jsing 4349: This will reduce the size of the signed message but the verifier must
4350: have a copy of the signer's certificate available locally (passed using the
4351: .Fl certfile
4352: option, for example).
4353: .It Fl nochain
4354: Do not do chain verification of signers' certificates: that is,
4355: don't use the certificates in the signed message as untrusted CAs.
4356: .It Fl nodetach
4357: When signing a message use opaque signing: this form is more resistant
4358: to translation by mail relays but it cannot be read by mail agents that
1.70 jmc 4359: do not support S/MIME.
4360: Without this option cleartext signing with the MIME type
4361: multipart/signed is used.
1.1 jsing 4362: .It Fl noindef
1.70 jmc 4363: Disable streaming I/O where it would produce an encoding of indefinite length
4364: (currently has no effect).
1.1 jsing 4365: .It Fl nointern
1.70 jmc 4366: Only use certificates specified in the
4367: .Fl certfile .
4368: The supplied certificates can still be used as untrusted CAs.
1.1 jsing 4369: .It Fl nosigs
1.70 jmc 4370: Do not try to verify the signatures on the message.
1.1 jsing 4371: .It Fl noverify
4372: Do not verify the signer's certificate of a signed message.
4373: .It Fl out Ar file
1.70 jmc 4374: The output file to write to.
4375: .It Fl outform Cm der | pem | smime
4376: The output format.
4377: The default is smime, which writes an S/MIME format message.
4378: .Cm pem
1.1 jsing 4379: and
1.70 jmc 4380: .Cm der
4381: change this to write PEM and DER format PKCS#7 structures instead.
1.1 jsing 4382: This currently only affects the output format of the PKCS#7
4383: structure; if no PKCS#7 structure is being output (for example with
4384: .Fl verify
4385: or
4386: .Fl decrypt )
4387: this option has no effect.
4388: .It Fl passin Ar arg
4389: The key password source.
4390: .It Fl recip Ar file
4391: The recipients certificate when decrypting a message.
4392: This certificate
4393: must match one of the recipients of the message or an error occurs.
4394: .It Fl signer Ar file
4395: A signing certificate when signing or resigning a message;
4396: this option can be used multiple times if more than one signer is required.
4397: If a message is being verified, the signer's certificates will be
4398: written to this file if the verification was successful.
4399: .It Fl stream
4400: The same as
4401: .Fl indef .
4402: .It Fl text
1.70 jmc 4403: Add plain text (text/plain) MIME
1.1 jsing 4404: headers to the supplied message if encrypting or signing.
4405: If decrypting or verifying, it strips off text headers:
1.70 jmc 4406: if the decrypted or verified message is not of MIME type text/plain
4407: then an error occurs.
1.1 jsing 4408: .El
4409: .Pp
1.70 jmc 4410: The exit codes for
4411: .Nm smime
4412: are as follows:
1.1 jsing 4413: .Pp
1.70 jmc 4414: .Bl -tag -width "XXXX" -offset 3n -compact
4415: .It 0
1.1 jsing 4416: The operation was completely successful.
1.70 jmc 4417: .It 1
1.1 jsing 4418: An error occurred parsing the command options.
1.70 jmc 4419: .It 2
1.1 jsing 4420: One of the input files could not be read.
1.70 jmc 4421: .It 3
4422: An error occurred creating the file or when reading the message.
4423: .It 4
1.1 jsing 4424: An error occurred decrypting or verifying the message.
1.70 jmc 4425: .It 5
4426: An error occurred writing certificates.
1.1 jsing 4427: .El
4428: .Sh SPEED
4429: .nr nS 1
4430: .Nm "openssl speed"
1.71 jmc 4431: .Op Ar algorithm
1.1 jsing 4432: .Op Fl decrypt
4433: .Op Fl elapsed
1.71 jmc 4434: .Op Fl evp Ar algorithm
1.1 jsing 4435: .Op Fl mr
4436: .Op Fl multi Ar number
4437: .nr nS 0
4438: .Pp
4439: The
4440: .Nm speed
4441: command is used to test the performance of cryptographic algorithms.
4442: .Bl -tag -width "XXXX"
1.71 jmc 4443: .It Ar algorithm
4444: Perform the test using
4445: .Ar algorithm .
4446: The default is to test all algorithms.
1.1 jsing 4447: .It Fl decrypt
1.71 jmc 4448: Time decryption instead of encryption;
4449: must be used with
4450: .Fl evp .
1.1 jsing 4451: .It Fl elapsed
4452: Measure time in real time instead of CPU user time.
1.71 jmc 4453: .It Fl evp Ar algorithm
4454: Perform the test using one of the algorithms accepted by
4455: .Xr EVP_get_cipherbyname 3 .
1.1 jsing 4456: .It Fl mr
4457: Produce machine readable output.
4458: .It Fl multi Ar number
4459: Run
4460: .Ar number
4461: benchmarks in parallel.
4462: .El
1.77 jmc 4463: .Sh SPKAC
4464: .nr nS 1
4465: .Nm "openssl spkac"
4466: .Op Fl challenge Ar string
4467: .Op Fl in Ar file
4468: .Op Fl key Ar keyfile
4469: .Op Fl noout
4470: .Op Fl out Ar file
4471: .Op Fl passin Ar arg
4472: .Op Fl pubkey
4473: .Op Fl spkac Ar spkacname
4474: .Op Fl spksect Ar section
4475: .Op Fl verify
4476: .nr nS 0
4477: .Pp
4478: The
4479: .Nm spkac
4480: command processes signed public key and challenge (SPKAC) files.
4481: It can print out their contents, verify the signature,
4482: and produce its own SPKACs from a supplied private key.
4483: .Pp
4484: The options are as follows:
4485: .Bl -tag -width Ds
4486: .It Fl challenge Ar string
4487: The challenge string, if an SPKAC is being created.
4488: .It Fl in Ar file
4489: The input file to read from,
4490: or standard input if not specified.
4491: Ignored if the
4492: .Fl key
4493: option is used.
4494: .It Fl key Ar keyfile
4495: Create an SPKAC file using the private key in
4496: .Ar keyfile .
4497: The
4498: .Fl in , noout , spksect ,
4499: and
4500: .Fl verify
4501: options are ignored, if present.
4502: .It Fl noout
4503: Do not output the text version of the SPKAC.
4504: .It Fl out Ar file
4505: The output file to write to,
4506: or standard output if not specified.
4507: .It Fl passin Ar arg
4508: The key password source.
4509: .It Fl pubkey
4510: Output the public key of an SPKAC.
4511: .It Fl spkac Ar spkacname
4512: An alternative name for the variable containing the SPKAC.
4513: The default is "SPKAC".
4514: This option affects both generated and input SPKAC files.
4515: .It Fl spksect Ar section
4516: An alternative name for the
4517: .Ar section
4518: containing the SPKAC.
4519: .It Fl verify
4520: Verify the digital signature on the supplied SPKAC.
4521: .El
1.1 jsing 4522: .Sh TS
4523: .nr nS 1
4524: .Nm "openssl ts"
4525: .Fl query
1.29 bcook 4526: .Op Fl md4 | md5 | ripemd160 | sha1
1.1 jsing 4527: .Op Fl cert
4528: .Op Fl config Ar configfile
4529: .Op Fl data Ar file_to_hash
4530: .Op Fl digest Ar digest_bytes
4531: .Op Fl in Ar request.tsq
4532: .Op Fl no_nonce
4533: .Op Fl out Ar request.tsq
4534: .Op Fl policy Ar object_id
4535: .Op Fl text
4536: .nr nS 0
4537: .Pp
4538: .nr nS 1
4539: .Nm "openssl ts"
4540: .Fl reply
4541: .Op Fl chain Ar certs_file.pem
4542: .Op Fl config Ar configfile
4543: .Op Fl in Ar response.tsr
4544: .Op Fl inkey Ar private.pem
4545: .Op Fl out Ar response.tsr
4546: .Op Fl passin Ar arg
4547: .Op Fl policy Ar object_id
4548: .Op Fl queryfile Ar request.tsq
4549: .Op Fl section Ar tsa_section
4550: .Op Fl signer Ar tsa_cert.pem
4551: .Op Fl text
4552: .Op Fl token_in
4553: .Op Fl token_out
4554: .nr nS 0
4555: .Pp
4556: .nr nS 1
4557: .Nm "openssl ts"
4558: .Fl verify
4559: .Op Fl CAfile Ar trusted_certs.pem
4560: .Op Fl CApath Ar trusted_cert_path
4561: .Op Fl data Ar file_to_hash
4562: .Op Fl digest Ar digest_bytes
4563: .Op Fl in Ar response.tsr
4564: .Op Fl queryfile Ar request.tsq
4565: .Op Fl token_in
4566: .Op Fl untrusted Ar cert_file.pem
4567: .nr nS 0
4568: .Pp
4569: The
4570: .Nm ts
4571: command is a basic Time Stamping Authority (TSA) client and server
4572: application as specified in RFC 3161 (Time-Stamp Protocol, TSP).
4573: A TSA can be part of a PKI deployment and its role is to provide long
1.72 jmc 4574: term proof of the existence of specific data.
1.1 jsing 4575: Here is a brief description of the protocol:
4576: .Bl -enum
4577: .It
4578: The TSA client computes a one-way hash value for a data file and sends
4579: the hash to the TSA.
4580: .It
4581: The TSA attaches the current date and time to the received hash value,
4582: signs them and sends the time stamp token back to the client.
4583: By creating this token the TSA certifies the existence of the original
4584: data file at the time of response generation.
4585: .It
4586: The TSA client receives the time stamp token and verifies the
4587: signature on it.
4588: It also checks if the token contains the same hash
4589: value that it had sent to the TSA.
4590: .El
4591: .Pp
4592: There is one DER-encoded protocol data unit defined for transporting a time
4593: stamp request to the TSA and one for sending the time stamp response
4594: back to the client.
4595: The
4596: .Nm ts
4597: command has three main functions:
4598: creating a time stamp request based on a data file;
4599: creating a time stamp response based on a request;
4600: and verifying if a response corresponds
4601: to a particular request or a data file.
4602: .Pp
4603: There is no support for sending the requests/responses automatically
4604: over HTTP or TCP yet as suggested in RFC 3161.
4605: Users must send the requests either by FTP or email.
4606: .Pp
4607: The
4608: .Fl query
4609: switch can be used for creating and printing a time stamp
4610: request with the following options:
4611: .Bl -tag -width Ds
4612: .It Fl cert
1.72 jmc 4613: Expect the TSA to include its signing certificate in the response.
1.1 jsing 4614: .It Fl config Ar configfile
1.72 jmc 4615: Specify an alternative configuration file.
4616: Only the OID section is used.
1.1 jsing 4617: .It Fl data Ar file_to_hash
4618: The data file for which the time stamp request needs to be created.
1.72 jmc 4619: The default is standard input.
1.1 jsing 4620: .It Fl digest Ar digest_bytes
1.72 jmc 4621: Specify the message imprint explicitly without the data file.
1.1 jsing 4622: The imprint must be specified in a hexadecimal format,
4623: two characters per byte,
1.72 jmc 4624: the bytes optionally separated by colons.
1.1 jsing 4625: The number of bytes must match the message digest algorithm in use.
4626: .It Fl in Ar request.tsq
1.72 jmc 4627: A previously created time stamp request in DER
1.1 jsing 4628: format that will be printed into the output file.
1.72 jmc 4629: Useful for examining the content of a request in human-readable format.
1.76 jmc 4630: .It Fl md4 | md5 | ripemd160 | sha | sha1
1.1 jsing 4631: The message digest to apply to the data file.
4632: It supports all the message digest algorithms that are supported by the
4633: .Nm dgst
4634: command.
4635: The default is SHA-1.
4636: .It Fl no_nonce
1.72 jmc 4637: Specify no nonce in the request.
4638: The default, to include a 64-bit long pseudo-random nonce,
4639: is recommended to protect against replay attacks.
1.1 jsing 4640: .It Fl out Ar request.tsq
1.72 jmc 4641: The output file to write to,
4642: or standard output if not specified.
1.1 jsing 4643: .It Fl policy Ar object_id
4644: The policy that the client expects the TSA to use for creating the
4645: time stamp token.
1.72 jmc 4646: Either dotted OID notation or OID names defined
1.1 jsing 4647: in the config file can be used.
1.72 jmc 4648: If no policy is requested the TSA uses its own default policy.
1.1 jsing 4649: .It Fl text
1.72 jmc 4650: Output in human-readable text format instead of DER.
1.1 jsing 4651: .El
4652: .Pp
4653: A time stamp response (TimeStampResp) consists of a response status
4654: and the time stamp token itself (ContentInfo),
4655: if the token generation was successful.
4656: The
4657: .Fl reply
4658: command is for creating a time stamp
4659: response or time stamp token based on a request and printing the
4660: response/token in human-readable format.
4661: If
4662: .Fl token_out
4663: is not specified the output is always a time stamp response (TimeStampResp),
4664: otherwise it is a time stamp token (ContentInfo).
4665: .Bl -tag -width Ds
4666: .It Fl chain Ar certs_file.pem
1.72 jmc 4667: The collection of PEM certificates
1.1 jsing 4668: that will be included in the response
4669: in addition to the signer certificate if the
4670: .Fl cert
4671: option was used for the request.
4672: This file is supposed to contain the certificate chain
4673: for the signer certificate from its issuer upwards.
4674: The
4675: .Fl reply
4676: command does not build a certificate chain automatically.
4677: .It Fl config Ar configfile
1.72 jmc 4678: Specify an alternative configuration file.
1.1 jsing 4679: .It Fl in Ar response.tsr
1.72 jmc 4680: Specify a previously created time stamp response (or time stamp token, if
1.1 jsing 4681: .Fl token_in
1.72 jmc 4682: is also specified)
1.1 jsing 4683: in DER format that will be written to the output file.
4684: This option does not require a request;
4685: it is useful, for example,
1.72 jmc 4686: to examine the content of a response or token
4687: or to extract the time stamp token from a response.
1.1 jsing 4688: If the input is a token and the output is a time stamp response a default
1.72 jmc 4689: .Qq granted
1.1 jsing 4690: status info is added to the token.
4691: .It Fl inkey Ar private.pem
4692: The signer private key of the TSA in PEM format.
4693: Overrides the
4694: .Cm signer_key
4695: config file option.
4696: .It Fl out Ar response.tsr
4697: The response is written to this file.
4698: The format and content of the file depends on other options (see
4699: .Fl text
4700: and
4701: .Fl token_out ) .
4702: The default is stdout.
4703: .It Fl passin Ar arg
4704: The key password source.
4705: .It Fl policy Ar object_id
1.72 jmc 4706: The default policy to use for the response.
4707: Either dotted OID notation or OID names defined
4708: in the config file can be used.
4709: If no policy is requested the TSA uses its own default policy.
1.1 jsing 4710: .It Fl queryfile Ar request.tsq
1.72 jmc 4711: The file containing a DER-encoded time stamp request.
1.1 jsing 4712: .It Fl section Ar tsa_section
1.72 jmc 4713: The config file section containing the settings for response generation.
1.1 jsing 4714: .It Fl signer Ar tsa_cert.pem
1.72 jmc 4715: The PEM signer certificate of the TSA.
1.1 jsing 4716: The TSA signing certificate must have exactly one extended key usage
4717: assigned to it: timeStamping.
4718: The extended key usage must also be critical,
4719: otherwise the certificate is going to be refused.
4720: Overrides the
4721: .Cm signer_cert
4722: variable of the config file.
4723: .It Fl text
1.72 jmc 4724: Output in human-readable text format instead of DER.
1.1 jsing 4725: .It Fl token_in
1.72 jmc 4726: The input is a DER-encoded time stamp token (ContentInfo)
4727: instead of a time stamp response (TimeStampResp).
1.1 jsing 4728: .It Fl token_out
1.72 jmc 4729: The output is a time stamp token (ContentInfo)
4730: instead of a time stamp response (TimeStampResp).
1.1 jsing 4731: .El
4732: .Pp
4733: The
4734: .Fl verify
4735: command is for verifying if a time stamp response or time stamp token
4736: is valid and matches a particular time stamp request or data file.
4737: The
4738: .Fl verify
4739: command does not use the configuration file.
4740: .Bl -tag -width Ds
4741: .It Fl CAfile Ar trusted_certs.pem
1.72 jmc 4742: The file containing a set of trusted self-signed PEM CA certificates.
4743: See
1.1 jsing 4744: .Nm verify
4745: for additional details.
4746: Either this option or
4747: .Fl CApath
4748: must be specified.
4749: .It Fl CApath Ar trusted_cert_path
1.72 jmc 4750: The directory containing the trused CA certificates of the client.
4751: See
1.1 jsing 4752: .Nm verify
4753: for additional details.
4754: Either this option or
4755: .Fl CAfile
4756: must be specified.
4757: .It Fl data Ar file_to_hash
4758: The response or token must be verified against
4759: .Ar file_to_hash .
4760: The file is hashed with the message digest algorithm specified in the token.
4761: The
4762: .Fl digest
4763: and
4764: .Fl queryfile
4765: options must not be specified with this one.
4766: .It Fl digest Ar digest_bytes
4767: The response or token must be verified against the message digest specified
4768: with this option.
4769: The number of bytes must match the message digest algorithm
4770: specified in the token.
4771: The
4772: .Fl data
4773: and
4774: .Fl queryfile
4775: options must not be specified with this one.
4776: .It Fl in Ar response.tsr
4777: The time stamp response that needs to be verified, in DER format.
4778: This option in mandatory.
4779: .It Fl queryfile Ar request.tsq
4780: The original time stamp request, in DER format.
4781: The
4782: .Fl data
4783: and
4784: .Fl digest
4785: options must not be specified with this one.
4786: .It Fl token_in
1.72 jmc 4787: The input is a DER-encoded time stamp token (ContentInfo)
4788: instead of a time stamp response (TimeStampResp).
1.1 jsing 4789: .It Fl untrusted Ar cert_file.pem
1.72 jmc 4790: Additional untrusted PEM certificates which may be needed
4791: when building the certificate chain for the TSA's signing certificate.
1.1 jsing 4792: This file must contain the TSA signing certificate and
4793: all intermediate CA certificates unless the response includes them.
4794: .El
4795: .Pp
1.72 jmc 4796: Options specified on the command line always override
4797: the settings in the config file:
1.1 jsing 4798: .Bl -tag -width Ds
4799: .It Cm tsa Ar section , Cm default_tsa
4800: This is the main section and it specifies the name of another section
4801: that contains all the options for the
4802: .Fl reply
4803: option.
1.72 jmc 4804: This section can be overridden with the
1.1 jsing 4805: .Fl section
4806: command line switch.
4807: .It Cm oid_file
4808: See
4809: .Nm ca
4810: for a description.
4811: .It Cm oid_section
4812: See
4813: .Nm ca
4814: for a description.
4815: .It Cm serial
1.72 jmc 4816: The file containing the hexadecimal serial number of the
1.1 jsing 4817: last time stamp response created.
4818: This number is incremented by 1 for each response.
1.72 jmc 4819: If the file does not exist at the time of response generation
4820: a new file is created with serial number 1.
1.1 jsing 4821: This parameter is mandatory.
4822: .It Cm signer_cert
4823: TSA signing certificate, in PEM format.
4824: The same as the
4825: .Fl signer
4826: command line option.
4827: .It Cm certs
1.72 jmc 4828: A set of PEM-encoded certificates that need to be
1.1 jsing 4829: included in the response.
4830: The same as the
4831: .Fl chain
4832: command line option.
4833: .It Cm signer_key
4834: The private key of the TSA, in PEM format.
4835: The same as the
4836: .Fl inkey
4837: command line option.
4838: .It Cm default_policy
4839: The default policy to use when the request does not mandate any policy.
4840: The same as the
4841: .Fl policy
4842: command line option.
4843: .It Cm other_policies
4844: Comma separated list of policies that are also acceptable by the TSA
4845: and used only if the request explicitly specifies one of them.
4846: .It Cm digests
4847: The list of message digest algorithms that the TSA accepts.
4848: At least one algorithm must be specified.
4849: This parameter is mandatory.
4850: .It Cm accuracy
4851: The accuracy of the time source of the TSA in seconds, milliseconds
4852: and microseconds.
4853: For example, secs:1, millisecs:500, microsecs:100.
4854: If any of the components is missing,
4855: zero is assumed for that field.
4856: .It Cm clock_precision_digits
1.72 jmc 4857: The maximum number of digits, which represent the fraction of seconds,
4858: that need to be included in the time field.
1.1 jsing 4859: The trailing zeroes must be removed from the time,
1.72 jmc 4860: so there might actually be fewer digits
1.1 jsing 4861: or no fraction of seconds at all.
4862: The maximum value is 6;
4863: the default is 0.
4864: .It Cm ordering
4865: If this option is yes,
4866: the responses generated by this TSA can always be ordered,
4867: even if the time difference between two responses is less
4868: than the sum of their accuracies.
4869: The default is no.
4870: .It Cm tsa_name
4871: Set this option to yes if the subject name of the TSA must be included in
4872: the TSA name field of the response.
4873: The default is no.
4874: .It Cm ess_cert_id_chain
4875: The SignedData objects created by the TSA always contain the
4876: certificate identifier of the signing certificate in a signed
4877: attribute (see RFC 2634, Enhanced Security Services).
4878: If this option is set to yes and either the
4879: .Cm certs
4880: variable or the
4881: .Fl chain
4882: option is specified then the certificate identifiers of the chain will also
4883: be included in the SigningCertificate signed attribute.
4884: If this variable is set to no,
4885: only the signing certificate identifier is included.
4886: The default is no.
4887: .El
4888: .Sh VERIFY
4889: .nr nS 1
4890: .Nm "openssl verify"
4891: .Op Fl CAfile Ar file
4892: .Op Fl CApath Ar directory
4893: .Op Fl check_ss_sig
4894: .Op Fl crl_check
4895: .Op Fl crl_check_all
4896: .Op Fl explicit_policy
4897: .Op Fl extended_crl
4898: .Op Fl help
4899: .Op Fl ignore_critical
4900: .Op Fl inhibit_any
4901: .Op Fl inhibit_map
4902: .Op Fl issuer_checks
4903: .Op Fl policy_check
4904: .Op Fl purpose Ar purpose
4905: .Op Fl untrusted Ar file
4906: .Op Fl verbose
4907: .Op Fl x509_strict
4908: .Op Ar certificates
4909: .nr nS 0
4910: .Pp
4911: The
4912: .Nm verify
4913: command verifies certificate chains.
4914: .Pp
4915: The options are as follows:
4916: .Bl -tag -width Ds
4917: .It Fl check_ss_sig
4918: Verify the signature on the self-signed root CA.
4919: This is disabled by default
4920: because it doesn't add any security.
4921: .It Fl CAfile Ar file
4922: A
4923: .Ar file
4924: of trusted certificates.
4925: The
4926: .Ar file
4927: should contain multiple certificates in PEM format, concatenated together.
4928: .It Fl CApath Ar directory
4929: A
4930: .Ar directory
4931: of trusted certificates.
1.76 jmc 4932: The certificates, or symbolic links to them,
4933: should have names of the form
4934: .Ar hash Ns .0 ,
4935: where
4936: .Ar hash
4937: is the hashed certificate subject name
4938: (see the
1.1 jsing 4939: .Fl hash
4940: option of the
4941: .Nm x509
4942: utility).
4943: .It Fl crl_check
1.76 jmc 4944: Check end entity certificate validity by attempting to look up a valid CRL.
1.1 jsing 4945: If a valid CRL cannot be found an error occurs.
4946: .It Fl crl_check_all
1.76 jmc 4947: Check the validity of all certificates in the chain by attempting
1.1 jsing 4948: to look up valid CRLs.
4949: .It Fl explicit_policy
1.76 jmc 4950: Set policy variable require-explicit-policy (RFC 3280).
1.1 jsing 4951: .It Fl extended_crl
4952: Enable extended CRL features such as indirect CRLs and alternate CRL
4953: signing keys.
4954: .It Fl help
1.76 jmc 4955: Print a usage message.
1.1 jsing 4956: .It Fl ignore_critical
1.76 jmc 4957: Ignore critical extensions instead of rejecting the certificate.
1.1 jsing 4958: .It Fl inhibit_any
1.76 jmc 4959: Set policy variable inhibit-any-policy (RFC 3280).
1.1 jsing 4960: .It Fl inhibit_map
1.76 jmc 4961: Set policy variable inhibit-policy-mapping (RFC 3280).
1.1 jsing 4962: .It Fl issuer_checks
1.76 jmc 4963: Print diagnostics relating to searches for the issuer certificate
4964: of the current certificate
4965: showing why each candidate issuer certificate was rejected.
4966: The presence of rejection messages
4967: does not itself imply that anything is wrong:
4968: during the normal verify process several rejections may take place.
1.1 jsing 4969: .It Fl policy_check
1.76 jmc 4970: Enable certificate policy processing.
1.1 jsing 4971: .It Fl purpose Ar purpose
4972: The intended use for the certificate.
4973: Without this option no chain verification will be done.
4974: Currently accepted uses are
1.76 jmc 4975: .Cm sslclient , sslserver ,
4976: .Cm nssslserver , smimesign ,
4977: .Cm smimeencrypt , crlsign ,
4978: .Cm any ,
1.1 jsing 4979: and
1.76 jmc 4980: .Cm ocsphelper .
1.1 jsing 4981: .It Fl untrusted Ar file
4982: A
4983: .Ar file
4984: of untrusted certificates.
4985: The
4986: .Ar file
4987: should contain multiple certificates.
4988: .It Fl verbose
4989: Print extra information about the operations being performed.
4990: .It Fl x509_strict
4991: Disable workarounds for broken certificates which have to be disabled
4992: for strict X.509 compliance.
4993: .It Ar certificates
1.76 jmc 4994: One or more PEM
1.1 jsing 4995: .Ar certificates
4996: to verify.
4997: If no certificate files are included, an attempt is made to read
4998: a certificate from standard input.
1.76 jmc 4999: If the first certificate filename begins with a dash,
5000: use a lone dash to mark the last option.
1.1 jsing 5001: .El
1.76 jmc 5002: .Pp
1.1 jsing 5003: The
5004: .Nm verify
5005: program uses the same functions as the internal SSL and S/MIME verification,
1.76 jmc 5006: with one crucial difference:
5007: wherever possible an attempt is made to continue after an error,
5008: whereas normally the verify operation would halt on the first error.
1.1 jsing 5009: This allows all the problems with a certificate chain to be determined.
5010: .Pp
1.76 jmc 5011: The verify operation consists of a number of separate steps.
1.1 jsing 5012: Firstly a certificate chain is built up starting from the supplied certificate
5013: and ending in the root CA.
5014: It is an error if the whole chain cannot be built up.
5015: The chain is built up by looking up the issuer's certificate of the current
5016: certificate.
5017: If a certificate is found which is its own issuer, it is assumed
5018: to be the root CA.
5019: .Pp
1.76 jmc 5020: All certificates whose subject name matches the issuer name
1.1 jsing 5021: of the current certificate are subject to further tests.
5022: The relevant authority key identifier components of the current certificate
1.76 jmc 5023: (if present) must match the subject key identifier (if present)
5024: and issuer and serial number of the candidate issuer;
5025: in addition the
5026: .Cm keyUsage
5027: extension of the candidate issuer (if present) must permit certificate signing.
1.1 jsing 5028: .Pp
5029: The lookup first looks in the list of untrusted certificates and if no match
5030: is found the remaining lookups are from the trusted certificates.
1.76 jmc 5031: The root CA is always looked up in the trusted certificate list:
5032: if the certificate to verify is a root certificate,
5033: then an exact match must be found in the trusted list.
1.1 jsing 5034: .Pp
5035: The second operation is to check every untrusted certificate's extensions for
5036: consistency with the supplied purpose.
5037: If the
5038: .Fl purpose
5039: option is not included, then no checks are done.
5040: The supplied or
5041: .Qq leaf
5042: certificate must have extensions compatible with the supplied purpose
5043: and all other certificates must also be valid CA certificates.
5044: The precise extensions required are described in more detail in
5045: the
1.76 jmc 5046: .Nm X509
1.1 jsing 5047: section below.
5048: .Pp
5049: The third operation is to check the trust settings on the root CA.
5050: The root CA should be trusted for the supplied purpose.
1.76 jmc 5051: A certificate with no trust settings is considered to be valid for
1.1 jsing 5052: all purposes.
5053: .Pp
5054: The final operation is to check the validity of the certificate chain.
5055: The validity period is checked against the current system time and the
1.76 jmc 5056: .Cm notBefore
1.1 jsing 5057: and
1.76 jmc 5058: .Cm notAfter
1.1 jsing 5059: dates in the certificate.
5060: The certificate signatures are also checked at this point.
5061: .Pp
5062: If all operations complete successfully, the certificate is considered
5063: valid.
5064: If any operation fails then the certificate is not valid.
5065: When a verify operation fails, the output messages can be somewhat cryptic.
5066: The general form of the error message is:
1.76 jmc 5067: .Bd -literal
5068: server.pem: /C=AU/ST=Queensland/O=CryptSoft Pty Ltd/CN=Test CA (1024-bit)
5069: error 24 at 1 depth lookup:invalid CA certificate
1.1 jsing 5070: .Ed
5071: .Pp
5072: The first line contains the name of the certificate being verified, followed by
5073: the subject name of the certificate.
5074: The second line contains the error number and the depth.
5075: The depth is the number of the certificate being verified when a
5076: problem was detected starting with zero for the certificate being verified
5077: itself, then 1 for the CA that signed the certificate and so on.
5078: Finally a text version of the error number is presented.
5079: .Pp
5080: An exhaustive list of the error codes and messages is shown below; this also
5081: includes the name of the error code as defined in the header file
1.12 bentley 5082: .In openssl/x509_vfy.h .
1.76 jmc 5083: Some of the error codes are defined but never returned: these are described as
1.1 jsing 5084: .Qq unused .
5085: .Bl -tag -width "XXXX"
1.78 jmc 5086: .It 0 X509_V_OK
1.1 jsing 5087: The operation was successful.
1.78 jmc 5088: .It 2 X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT
5089: The issuer certificate of an untrusted certificate could not be found.
5090: .It 3 X509_V_ERR_UNABLE_TO_GET_CRL
1.1 jsing 5091: The CRL of a certificate could not be found.
1.78 jmc 5092: .It 4 X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE
1.1 jsing 5093: The certificate signature could not be decrypted.
1.78 jmc 5094: This means that the actual signature value could not be determined
5095: rather than it not matching the expected value.
1.1 jsing 5096: This is only meaningful for RSA keys.
1.78 jmc 5097: .It 5 X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE
5098: The CRL signature could not be decrypted.
5099: This means that the actual signature value could not be determined
5100: rather than it not matching the expected value.
1.1 jsing 5101: Unused.
1.78 jmc 5102: .It 6 X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY
1.1 jsing 5103: The public key in the certificate
1.76 jmc 5104: .Cm SubjectPublicKeyInfo
1.1 jsing 5105: could not be read.
1.78 jmc 5106: .It 7 X509_V_ERR_CERT_SIGNATURE_FAILURE
1.1 jsing 5107: The signature of the certificate is invalid.
1.78 jmc 5108: .It 8 X509_V_ERR_CRL_SIGNATURE_FAILURE
1.1 jsing 5109: The signature of the certificate is invalid.
1.78 jmc 5110: .It 9 X509_V_ERR_CERT_NOT_YET_VALID
1.1 jsing 5111: The certificate is not yet valid: the
1.76 jmc 5112: .Cm notBefore
1.1 jsing 5113: date is after the current time.
1.78 jmc 5114: .It 10 X509_V_ERR_CERT_HAS_EXPIRED
1.1 jsing 5115: The certificate has expired; that is, the
1.76 jmc 5116: .Cm notAfter
1.1 jsing 5117: date is before the current time.
1.78 jmc 5118: .It 11 X509_V_ERR_CRL_NOT_YET_VALID
1.1 jsing 5119: The CRL is not yet valid.
1.78 jmc 5120: .It 12 X509_V_ERR_CRL_HAS_EXPIRED
1.1 jsing 5121: The CRL has expired.
1.78 jmc 5122: .It 13 X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD
1.1 jsing 5123: The certificate
1.76 jmc 5124: .Cm notBefore
1.1 jsing 5125: field contains an invalid time.
1.78 jmc 5126: .It 14 X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD
1.1 jsing 5127: The certificate
1.76 jmc 5128: .Cm notAfter
1.1 jsing 5129: field contains an invalid time.
1.78 jmc 5130: .It 15 X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD
1.1 jsing 5131: The CRL
1.76 jmc 5132: .Cm lastUpdate
1.1 jsing 5133: field contains an invalid time.
1.78 jmc 5134: .It 16 X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD
1.1 jsing 5135: The CRL
1.76 jmc 5136: .Cm nextUpdate
1.1 jsing 5137: field contains an invalid time.
1.78 jmc 5138: .It 17 X509_V_ERR_OUT_OF_MEM
1.1 jsing 5139: An error occurred trying to allocate memory.
5140: This should never happen.
1.78 jmc 5141: .It 18 X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT
1.1 jsing 5142: The passed certificate is self-signed and the same certificate cannot be
5143: found in the list of trusted certificates.
1.78 jmc 5144: .It 19 X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN
1.1 jsing 5145: The certificate chain could be built up using the untrusted certificates but
5146: the root could not be found locally.
1.78 jmc 5147: .It 20 X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY
1.1 jsing 5148: The issuer certificate of a locally looked up certificate could not be found.
5149: This normally means the list of trusted certificates is not complete.
1.78 jmc 5150: .It 21 X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE
1.1 jsing 5151: No signatures could be verified because the chain contains only one
5152: certificate and it is not self-signed.
1.78 jmc 5153: .It 22 X509_V_ERR_CERT_CHAIN_TOO_LONG
1.1 jsing 5154: The certificate chain length is greater than the supplied maximum depth.
5155: Unused.
1.78 jmc 5156: .It 23 X509_V_ERR_CERT_REVOKED
1.1 jsing 5157: The certificate has been revoked.
1.78 jmc 5158: .It 24 X509_V_ERR_INVALID_CA
1.1 jsing 5159: A CA certificate is invalid.
5160: Either it is not a CA or its extensions are not consistent
5161: with the supplied purpose.
1.78 jmc 5162: .It 25 X509_V_ERR_PATH_LENGTH_EXCEEDED
1.1 jsing 5163: The
1.76 jmc 5164: .Cm basicConstraints
1.1 jsing 5165: pathlength parameter has been exceeded.
1.78 jmc 5166: .It 26 X509_V_ERR_INVALID_PURPOSE
1.1 jsing 5167: The supplied certificate cannot be used for the specified purpose.
1.78 jmc 5168: .It 27 X509_V_ERR_CERT_UNTRUSTED
1.1 jsing 5169: The root CA is not marked as trusted for the specified purpose.
1.78 jmc 5170: .It 28 X509_V_ERR_CERT_REJECTED
1.1 jsing 5171: The root CA is marked to reject the specified purpose.
1.78 jmc 5172: .It 29 X509_V_ERR_SUBJECT_ISSUER_MISMATCH
1.1 jsing 5173: The current candidate issuer certificate was rejected because its subject name
5174: did not match the issuer name of the current certificate.
5175: Only displayed when the
5176: .Fl issuer_checks
5177: option is set.
1.78 jmc 5178: .It 30 X509_V_ERR_AKID_SKID_MISMATCH
1.1 jsing 5179: The current candidate issuer certificate was rejected because its subject key
5180: identifier was present and did not match the authority key identifier current
5181: certificate.
5182: Only displayed when the
5183: .Fl issuer_checks
5184: option is set.
1.78 jmc 5185: .It 31 X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH
1.1 jsing 5186: The current candidate issuer certificate was rejected because its issuer name
5187: and serial number were present and did not match the authority key identifier
5188: of the current certificate.
5189: Only displayed when the
5190: .Fl issuer_checks
5191: option is set.
1.78 jmc 5192: .It 32 X509_V_ERR_KEYUSAGE_NO_CERTSIGN
1.1 jsing 5193: The current candidate issuer certificate was rejected because its
1.76 jmc 5194: .Cm keyUsage
1.1 jsing 5195: extension does not permit certificate signing.
1.78 jmc 5196: .It 50 X509_V_ERR_APPLICATION_VERIFICATION
1.1 jsing 5197: An application specific error.
5198: Unused.
5199: .El
5200: .Sh VERSION
5201: .Nm openssl version
5202: .Op Fl abdfopv
5203: .Pp
5204: The
5205: .Nm version
5206: command is used to print out version information about
1.79 jmc 5207: .Nm openssl .
1.1 jsing 5208: .Pp
5209: The options are as follows:
5210: .Bl -tag -width Ds
5211: .It Fl a
5212: All information: this is the same as setting all the other flags.
5213: .It Fl b
5214: The date the current version of
1.79 jmc 5215: .Nm openssl
1.1 jsing 5216: was built.
5217: .It Fl d
5218: .Ev OPENSSLDIR
5219: setting.
5220: .It Fl f
5221: Compilation flags.
5222: .It Fl o
5223: Option information: various options set when the library was built.
5224: .It Fl p
5225: Platform setting.
5226: .It Fl v
5227: The current
1.79 jmc 5228: .Nm openssl
1.1 jsing 5229: version.
5230: .El
5231: .Sh X509
5232: .nr nS 1
5233: .Nm "openssl x509"
5234: .Op Fl C
5235: .Op Fl addreject Ar arg
5236: .Op Fl addtrust Ar arg
5237: .Op Fl alias
5238: .Op Fl CA Ar file
5239: .Op Fl CAcreateserial
1.80 jmc 5240: .Op Fl CAform Cm der | pem
1.1 jsing 5241: .Op Fl CAkey Ar file
1.80 jmc 5242: .Op Fl CAkeyform Cm der | pem
1.1 jsing 5243: .Op Fl CAserial Ar file
5244: .Op Fl certopt Ar option
5245: .Op Fl checkend Ar arg
5246: .Op Fl clrext
5247: .Op Fl clrreject
5248: .Op Fl clrtrust
5249: .Op Fl dates
5250: .Op Fl days Ar arg
5251: .Op Fl email
5252: .Op Fl enddate
5253: .Op Fl extensions Ar section
5254: .Op Fl extfile Ar file
5255: .Op Fl fingerprint
5256: .Op Fl hash
5257: .Op Fl in Ar file
1.80 jmc 5258: .Op Fl inform Cm der | net | pem
1.1 jsing 5259: .Op Fl issuer
5260: .Op Fl issuer_hash
5261: .Op Fl issuer_hash_old
1.80 jmc 5262: .Op Fl keyform Cm der | pem
1.29 bcook 5263: .Op Fl md5 | sha1
1.1 jsing 5264: .Op Fl modulus
5265: .Op Fl nameopt Ar option
5266: .Op Fl noout
5267: .Op Fl ocsp_uri
5268: .Op Fl ocspid
5269: .Op Fl out Ar file
1.80 jmc 5270: .Op Fl outform Cm der | net | pem
1.1 jsing 5271: .Op Fl passin Ar arg
5272: .Op Fl pubkey
5273: .Op Fl purpose
5274: .Op Fl req
5275: .Op Fl serial
5276: .Op Fl set_serial Ar n
5277: .Op Fl setalias Ar arg
5278: .Op Fl signkey Ar file
5279: .Op Fl startdate
5280: .Op Fl subject
5281: .Op Fl subject_hash
5282: .Op Fl subject_hash_old
5283: .Op Fl text
5284: .Op Fl trustout
5285: .Op Fl x509toreq
5286: .nr nS 0
5287: .Pp
5288: The
5289: .Nm x509
5290: command is a multi-purpose certificate utility.
5291: It can be used to display certificate information, convert certificates to
5292: various forms, sign certificate requests like a
5293: .Qq mini CA ,
5294: or edit certificate trust settings.
5295: .Pp
1.80 jmc 5296: The following are x509 input, output, and general purpose options:
1.1 jsing 5297: .Bl -tag -width "XXXX"
5298: .It Fl in Ar file
1.80 jmc 5299: The input file to read from,
5300: or standard input if not specified.
5301: .It Fl inform Cm der | net | pem
5302: The input format.
1.1 jsing 5303: Normally, the command will expect an X.509 certificate,
5304: but this can change if other options such as
5305: .Fl req
5306: are present.
1.29 bcook 5307: .It Fl md5 | sha1
1.1 jsing 5308: The digest to use.
5309: This affects any signing or display option that uses a message digest,
5310: such as the
5311: .Fl fingerprint , signkey ,
5312: and
5313: .Fl CA
5314: options.
5315: If not specified, MD5 is used.
1.80 jmc 5316: SHA1 is always used with DSA keys.
1.1 jsing 5317: .It Fl out Ar file
1.80 jmc 5318: The output file to write to,
5319: or standard output if none is specified.
5320: .It Fl outform Cm der | net | pem
5321: The output format.
1.1 jsing 5322: .It Fl passin Ar arg
5323: The key password source.
5324: .El
1.80 jmc 5325: .Pp
5326: The following are x509 display options:
1.1 jsing 5327: .Bl -tag -width "XXXX"
5328: .It Fl C
1.80 jmc 5329: Output the certificate in the form of a C source file.
1.1 jsing 5330: .It Fl certopt Ar option
5331: Customise the output format used with
1.80 jmc 5332: .Fl text ,
5333: either using a list of comma-separated options or by specifying
1.1 jsing 5334: .Fl certopt
1.80 jmc 5335: multiple times.
5336: The default behaviour is to print all fields.
5337: The options are as follows:
5338: .Pp
5339: .Bl -tag -width "no_extensions" -offset indent -compact
5340: .It Cm ca_default
5341: Equivalent to
5342: .Cm no_issuer , no_pubkey , no_header ,
5343: .Cm no_version , no_sigdump ,
5344: and
5345: .Cm no_signame .
5346: .It Cm compatible
5347: Equivalent to no output options at all.
5348: .It Cm ext_default
5349: Print unsupported certificate extensions.
5350: .It Cm ext_dump
5351: Hex dump unsupported extensions.
5352: .It Cm ext_error
5353: Print an error message for unsupported certificate extensions.
5354: .It Cm ext_parse
1.84 jmc 5355: ASN.1 parse unsupported extensions.
1.80 jmc 5356: .It Cm no_aux
5357: Do not print certificate trust information.
5358: .It Cm no_extensions
5359: Do not print X509V3 extensions.
5360: .It Cm no_header
5361: Do not print header (Certificate and Data) information.
5362: .It Cm no_issuer
5363: Do not print the issuer name.
5364: .It Cm no_pubkey
5365: Do not print the public key.
5366: .It Cm no_serial
5367: Do not print the serial number.
5368: .It Cm no_sigdump
5369: Do not give a hexadecimal dump of the certificate signature.
5370: .It Cm no_signame
5371: Do not print the signature algorithm used.
5372: .It Cm no_subject
5373: Do not print the subject name.
5374: .It Cm no_validity
5375: Do not print the
5376: .Cm notBefore
5377: and
5378: .Cm notAfter
5379: (validity) fields.
5380: .It Cm no_version
5381: Do not print the version number.
5382: .El
1.1 jsing 5383: .It Fl dates
1.80 jmc 5384: Print the start and expiry date of a certificate.
1.1 jsing 5385: .It Fl email
1.80 jmc 5386: Output the email addresses, if any.
1.1 jsing 5387: .It Fl enddate
1.80 jmc 5388: Print the expiry date of the certificate; that is, the
5389: .Cm notAfter
1.1 jsing 5390: date.
5391: .It Fl fingerprint
1.80 jmc 5392: Print the digest of the DER-encoded version of the whole certificate.
1.1 jsing 5393: .It Fl hash
5394: A synonym for
1.80 jmc 5395: .Fl subject_hash .
1.1 jsing 5396: .It Fl issuer
1.80 jmc 5397: Print the issuer name.
1.1 jsing 5398: .It Fl issuer_hash
1.80 jmc 5399: Print the hash of the certificate issuer name.
1.1 jsing 5400: .It Fl issuer_hash_old
1.80 jmc 5401: Print the hash of the certificate issuer name
5402: using the older algorithm as used by
5403: .Nm openssl
1.1 jsing 5404: versions before 1.0.0.
5405: .It Fl modulus
1.80 jmc 5406: Print the value of the modulus of the public key contained in the certificate.
1.1 jsing 5407: .It Fl nameopt Ar option
1.80 jmc 5408: Customise how the subject or issuer names are displayed,
5409: either using a list of comma-separated options or by specifying
1.1 jsing 5410: .Fl nameopt
1.80 jmc 5411: multiple times.
5412: The default behaviour is to use the
5413: .Cm oneline
5414: format.
5415: The options,
5416: which can be preceded by a dash to turn them off,
5417: are as follows:
5418: .Bl -tag -width "XXXX"
5419: .It Cm align
5420: Align field values for a more readable output.
5421: Only usable with
5422: .Ar sep_multiline .
5423: .It Cm compat
5424: Use the old format,
5425: equivalent to specifying no options at all.
5426: .It Cm dn_rev
5427: Reverse the fields of the DN, as required by RFC 2253.
5428: As a side effect, this also reverses the order of multiple AVAs.
5429: .It Cm dump_all
5430: Dump all fields.
5431: When used with
5432: .Ar dump_der ,
5433: it allows the DER encoding of the structure to be unambiguously determined.
5434: .It Cm dump_der
5435: Any fields that need to be hexdumped are
5436: dumped using the DER encoding of the field.
5437: Otherwise just the content octets will be displayed.
5438: Both options use the RFC 2253 #XXXX... format.
5439: .It Cm dump_nostr
5440: Dump non-character string types
5441: (for example OCTET STRING);
5442: usually, non-character string types are displayed
5443: as though each content octet represents a single character.
5444: .It Cm dump_unknown
5445: Dump any field whose OID is not recognised by
5446: .Nm openssl .
5447: .It Cm esc_2253
5448: Escape the
5449: .Qq special
5450: characters required by RFC 2253 in a field that is
5451: .Dq \& ,+"<>; .
5452: Additionally,
5453: .Sq #
5454: is escaped at the beginning of a string
5455: and a space character at the beginning or end of a string.
5456: .It Cm esc_ctrl
5457: Escape control characters.
5458: That is, those with ASCII values less than 0x20 (space)
5459: and the delete (0x7f) character.
5460: They are escaped using the RFC 2253 \eXX notation (where XX are two hex
5461: digits representing the character value).
5462: .It Cm esc_msb
5463: Escape characters with the MSB set; that is, with ASCII values larger than
5464: 127.
5465: .It Cm multiline
5466: A multiline format.
5467: Equivalent to
5468: .Cm esc_ctrl , esc_msb , sep_multiline ,
5469: .Cm space_eq , lname ,
5470: and
5471: .Cm align .
5472: .It Cm no_type
5473: Do not attempt to interpret multibyte characters.
5474: That is, content octets are merely dumped as though one octet
5475: represents each character.
5476: This is useful for diagnostic purposes
5477: but results in rather odd looking output.
5478: .It Cm nofname , sname , lname , oid
5479: Alter how the field name is displayed:
5480: .Cm nofname
5481: does not display the field at all;
5482: .Cm sname
5483: uses the short name form (CN for
5484: .Cm commonName ,
5485: for example);
5486: .Cm lname
5487: uses the long form.
5488: .Cm oid
5489: represents the OID in numerical form and is useful for diagnostic purpose.
5490: .It Cm oneline
5491: A one line format which is more readable than
5492: .Cm RFC2253 .
5493: Equivalent to
5494: .Cm esc_2253 , esc_ctrl , esc_msb , utf8 ,
5495: .Cm dump_nostr , dump_der , use_quote , sep_comma_plus_spc ,
5496: .Cm space_eq ,
5497: and
5498: .Cm sname .
5499: .It Cm RFC2253
5500: Displays names compatible with RFC 2253.
5501: Equivalent to
5502: .Cm esc_2253 , esc_ctrl ,
5503: .Cm esc_msb , utf8 , dump_nostr , dump_unknown ,
5504: .Cm dump_der , sep_comma_plus , dn_rev ,
5505: and
5506: .Cm sname .
5507: .It Cm sep_comma_plus , sep_comma_plus_space , sep_semi_plus_space , sep_multiline
5508: Determine the field separators:
5509: the first character is between RDNs and the second between multiple AVAs
5510: (multiple AVAs are very rare and their use is discouraged).
5511: The options ending in
5512: .Qq space
5513: additionally place a space after the separator to make it more readable.
5514: .Cm sep_multiline
5515: uses a linefeed character for the RDN separator and a spaced
5516: .Sq +
5517: for the AVA separator,
5518: as well as indenting the fields by four characters.
5519: .It Cm show_type
1.84 jmc 5520: Show the type of the ASN.1 character string.
1.80 jmc 5521: The type precedes the field contents.
5522: For example
5523: .Qq BMPSTRING: Hello World .
5524: .It Cm space_eq
5525: Place spaces round the
5526: .Sq =
5527: character which follows the field name.
5528: .It Cm use_quote
5529: Escape some characters by surrounding the whole string with
5530: .Sq \&"
5531: characters.
5532: Without the option, all escaping is done with the
5533: .Sq \e
5534: character.
5535: .It Cm utf8
5536: Convert all strings to UTF8 format first, as required by RFC 2253.
5537: On a UTF8 compatible terminal,
5538: the use of this option (and not setting
5539: .Cm esc_msb )
5540: may result in the correct display of multibyte characters.
5541: Usually, multibyte characters larger than 0xff
5542: are represented using the format \eUXXXX for 16 bits and \eWXXXXXXXX
5543: for 32 bits,
5544: and any UTF8Strings are converted to their character form first.
5545: .El
1.1 jsing 5546: .It Fl noout
1.80 jmc 5547: Do not output the encoded version of the request.
1.1 jsing 5548: .It Fl ocsp_uri
1.80 jmc 5549: Print the OCSP responder addresses, if any.
1.1 jsing 5550: .It Fl ocspid
5551: Print OCSP hash values for the subject name and public key.
5552: .It Fl pubkey
1.80 jmc 5553: Print the public key.
1.1 jsing 5554: .It Fl serial
1.80 jmc 5555: Print the certificate serial number.
1.1 jsing 5556: .It Fl startdate
1.80 jmc 5557: Print the start date of the certificate; that is, the
5558: .Cm notBefore
1.1 jsing 5559: date.
5560: .It Fl subject
1.80 jmc 5561: Print the subject name.
1.1 jsing 5562: .It Fl subject_hash
1.80 jmc 5563: Print the hash of the certificate subject name.
1.1 jsing 5564: This is used in
1.80 jmc 5565: .Nm openssl
1.1 jsing 5566: to form an index to allow certificates in a directory to be looked up
5567: by subject name.
5568: .It Fl subject_hash_old
1.80 jmc 5569: Print the hash of the certificate subject name
5570: using the older algorithm as used by
5571: .Nm openssl
1.1 jsing 5572: versions before 1.0.0.
5573: .It Fl text
1.80 jmc 5574: Print the full certificate in text form.
1.1 jsing 5575: .El
5576: .Pp
1.80 jmc 5577: A trusted certificate is a certificate which has several
1.1 jsing 5578: additional pieces of information attached to it such as the permitted
1.80 jmc 5579: and prohibited uses of the certificate and an alias.
5580: When a certificate is being verified at least one certificate must be trusted.
5581: By default, a trusted certificate must be stored locally and be a root CA.
5582: The following are x509 trust settings options:
1.1 jsing 5583: .Bl -tag -width "XXXX"
5584: .It Fl addreject Ar arg
1.80 jmc 5585: Add a prohibited use.
5586: Accepts the same values as the
1.1 jsing 5587: .Fl addtrust
5588: option.
5589: .It Fl addtrust Ar arg
1.80 jmc 5590: Add a trusted certificate use.
1.1 jsing 5591: Any object name can be used here, but currently only
1.80 jmc 5592: .Cm clientAuth
5593: (SSL client use),
5594: .Cm serverAuth
5595: (SSL server use),
5596: and
5597: .Cm emailProtection
5598: (S/MIME email) are used.
1.1 jsing 5599: .It Fl alias
1.80 jmc 5600: Output the certificate alias.
1.1 jsing 5601: .It Fl clrreject
1.80 jmc 5602: Clear all the prohibited or rejected uses of the certificate.
1.1 jsing 5603: .It Fl clrtrust
1.80 jmc 5604: Clear all the permitted or trusted uses of the certificate.
1.1 jsing 5605: .It Fl purpose
1.80 jmc 5606: Perform tests on the certificate extensions.
5607: The same code is used when verifying untrusted certificates in chains,
5608: so this section is useful if a chain is rejected by the verify code.
5609: .Pp
5610: The
5611: .Cm basicConstraints
5612: extension CA flag is used to determine whether the
5613: certificate can be used as a CA.
5614: If the CA flag is true, it is a CA;
5615: if the CA flag is false, it is not a CA.
5616: All CAs should have the CA flag set to true.
5617: .Pp
5618: If the
5619: .Cm basicConstraints
5620: extension is absent, then the certificate is
5621: considered to be a possible CA;
5622: other extensions are checked according to the intended use of the certificate.
5623: A warning is given in this case because the certificate should really not
5624: be regarded as a CA.
5625: However it is allowed to be a CA to work around some broken software.
5626: .Pp
5627: If the certificate is a V1 certificate
5628: (and thus has no extensions) and it is self-signed,
5629: it is also assumed to be a CA but a warning is again given.
5630: This is to work around the problem of Verisign roots
5631: which are V1 self-signed certificates.
5632: .Pp
5633: If the
5634: .Cm keyUsage
5635: extension is present, then additional restraints are
5636: made on the uses of the certificate.
5637: A CA certificate must have the
5638: .Cm keyCertSign
5639: bit set if the
5640: .Cm keyUsage
5641: extension is present.
5642: .Pp
5643: The extended key usage extension places additional restrictions on the
5644: certificate uses.
5645: If this extension is present, whether critical or not,
5646: the key can only be used for the purposes specified.
5647: .Pp
5648: A complete description of each test is given below.
5649: The comments about
5650: .Cm basicConstraints
5651: and
5652: .Cm keyUsage
5653: and V1 certificates above apply to all CA certificates.
5654: .Bl -tag -width "XXXX"
5655: .It SSL Client
5656: The extended key usage extension must be absent or include the
5657: web client authentication OID.
5658: .Cm keyUsage
5659: must be absent or it must have the
5660: .Cm digitalSignature
5661: bit set.
5662: The Netscape certificate type must be absent
5663: or it must have the SSL client bit set.
5664: .It SSL Client CA
5665: The extended key usage extension must be absent or include the
5666: web client authentication OID.
5667: The Netscape certificate type must be absent
5668: or it must have the SSL CA bit set:
5669: this is used as a workaround if the
5670: .Cm basicConstraints
5671: extension is absent.
5672: .It SSL Server
5673: The extended key usage extension must be absent or include the
5674: web server authentication and/or one of the SGC OIDs.
5675: .Cm keyUsage
5676: must be absent or it must have the
5677: .Cm digitalSignature
5678: set, the
5679: .Cm keyEncipherment
5680: set, or both bits set.
5681: The Netscape certificate type must be absent or have the SSL server bit set.
5682: .It SSL Server CA
5683: The extended key usage extension must be absent or include the
5684: web server authentication and/or one of the SGC OIDs.
5685: The Netscape certificate type must be absent or the SSL CA bit must be set:
5686: this is used as a workaround if the
5687: .Cm basicConstraints
5688: extension is absent.
5689: .It Netscape SSL Server
5690: For Netscape SSL clients to connect to an SSL server; it must have the
5691: .Cm keyEncipherment
5692: bit set if the
5693: .Cm keyUsage
5694: extension is present.
5695: This isn't always valid because some cipher suites use the key for
5696: digital signing.
5697: Otherwise it is the same as a normal SSL server.
5698: .It Common S/MIME Client Tests
5699: The extended key usage extension must be absent or include the
5700: email protection OID.
5701: The Netscape certificate type must be absent or should have the S/MIME bit set.
5702: If the S/MIME bit is not set in Netscape certificate type, then the SSL
5703: client bit is tolerated as an alternative but a warning is shown:
5704: this is because some Verisign certificates don't set the S/MIME bit.
5705: .It S/MIME Signing
5706: In addition to the common S/MIME client tests, the
5707: .Cm digitalSignature
5708: bit must be set if the
5709: .Cm keyUsage
5710: extension is present.
5711: .It S/MIME Encryption
5712: In addition to the common S/MIME tests, the
5713: .Cm keyEncipherment
5714: bit must be set if the
5715: .Cm keyUsage
5716: extension is present.
5717: .It S/MIME CA
5718: The extended key usage extension must be absent or include the
5719: email protection OID.
5720: The Netscape certificate type must be absent
5721: or must have the S/MIME CA bit set:
5722: this is used as a workaround if the
5723: .Cm basicConstraints
5724: extension is absent.
5725: .It CRL Signing
5726: The
5727: .Cm keyUsage
5728: extension must be absent or it must have the CRL signing bit set.
5729: .It CRL Signing CA
5730: The normal CA tests apply, except the
5731: .Cm basicConstraints
5732: extension must be present.
5733: .El
1.1 jsing 5734: .It Fl setalias Ar arg
1.80 jmc 5735: Set the alias of the certificate,
5736: allowing the certificate to be referred to using a nickname,
5737: such as
1.1 jsing 5738: .Qq Steve's Certificate .
5739: .It Fl trustout
1.80 jmc 5740: Output a trusted certificate
5741: (the default if any trust settings are modified).
1.1 jsing 5742: An ordinary or trusted certificate can be input, but by default an ordinary
5743: certificate is output and any trust settings are discarded.
5744: .El
1.80 jmc 5745: .Pp
1.1 jsing 5746: The
5747: .Nm x509
1.80 jmc 5748: utility can be used to sign certificates and requests:
5749: it can thus behave like a mini CA.
5750: The following are x509 signing options:
1.1 jsing 5751: .Bl -tag -width "XXXX"
5752: .It Fl CA Ar file
1.80 jmc 5753: The CA certificate to be used for signing.
1.1 jsing 5754: When this option is present,
5755: .Nm x509
1.80 jmc 5756: behaves like a mini CA.
1.1 jsing 5757: The input file is signed by the CA using this option;
5758: that is, its issuer name is set to the subject name of the CA and it is
5759: digitally signed using the CA's private key.
5760: .Pp
5761: This option is normally combined with the
5762: .Fl req
5763: option.
5764: Without the
5765: .Fl req
5766: option, the input is a certificate which must be self-signed.
5767: .It Fl CAcreateserial
1.80 jmc 5768: Create the CA serial number file if it does not exist
5769: instead of generating an error.
5770: The file will contain the serial number
1.1 jsing 5771: .Sq 02
5772: and the certificate being signed will have
5773: .Sq 1
5774: as its serial number.
1.80 jmc 5775: .It Fl CAform Cm der | pem
1.1 jsing 5776: The format of the CA certificate file.
5777: The default is
1.80 jmc 5778: .Cm pem .
1.1 jsing 5779: .It Fl CAkey Ar file
1.80 jmc 5780: Set the CA private key to sign a certificate with.
5781: Otherwise it is assumed that the CA private key is present
5782: in the CA certificate file.
5783: .It Fl CAkeyform Cm der | pem
1.1 jsing 5784: The format of the CA private key.
5785: The default is
1.80 jmc 5786: .Cm pem .
1.1 jsing 5787: .It Fl CAserial Ar file
1.80 jmc 5788: Use the serial number in
5789: .Ar file
5790: to sign a certificate.
5791: The file should consist of one line containing an even number of hex digits
1.1 jsing 5792: with the serial number to use.
5793: After each use the serial number is incremented and written out
5794: to the file again.
5795: .Pp
5796: The default filename consists of the CA certificate file base name with
5797: .Pa .srl
5798: appended.
5799: For example, if the CA certificate file is called
5800: .Pa mycacert.pem ,
5801: it expects to find a serial number file called
5802: .Pa mycacert.srl .
5803: .It Fl checkend Ar arg
5804: Check whether the certificate expires in the next
5805: .Ar arg
5806: seconds.
5807: If so, exit with return value 1;
5808: otherwise exit with return value 0.
5809: .It Fl clrext
5810: Delete any extensions from a certificate.
5811: This option is used when a certificate is being created from another
5812: certificate (for example with the
5813: .Fl signkey
5814: or the
5815: .Fl CA
5816: options).
5817: Normally, all extensions are retained.
5818: .It Fl days Ar arg
1.80 jmc 5819: The number of days to make a certificate valid for.
1.1 jsing 5820: The default is 30 days.
5821: .It Fl extensions Ar section
5822: The section to add certificate extensions from.
5823: If this option is not specified, the extensions should either be
1.80 jmc 5824: contained in the unnamed (default) section
5825: or the default section should contain a variable called
1.1 jsing 5826: .Qq extensions
5827: which contains the section to use.
5828: .It Fl extfile Ar file
5829: File containing certificate extensions to use.
5830: If not specified, no extensions are added to the certificate.
1.80 jmc 5831: .It Fl keyform Cm der | pem
5832: The format of the private key file used in the
1.1 jsing 5833: .Fl signkey
5834: option.
5835: .It Fl req
1.80 jmc 5836: Expect a certificate request on input instead of a certificate.
1.1 jsing 5837: .It Fl set_serial Ar n
1.80 jmc 5838: The serial number to use.
1.1 jsing 5839: This option can be used with either the
5840: .Fl signkey
5841: or
5842: .Fl CA
5843: options.
5844: If used in conjunction with the
5845: .Fl CA
5846: option, the serial number file (as specified by the
5847: .Fl CAserial
5848: or
5849: .Fl CAcreateserial
5850: options) is not used.
5851: .Pp
5852: The serial number can be decimal or hex (if preceded by
5853: .Sq 0x ) .
5854: Negative serial numbers can also be specified but their use is not recommended.
5855: .It Fl signkey Ar file
1.80 jmc 5856: Self-sign
5857: .Ar file
5858: using the supplied private key.
1.1 jsing 5859: .Pp
5860: If the input file is a certificate, it sets the issuer name to the
1.80 jmc 5861: subject name (i.e. makes it self-signed),
1.1 jsing 5862: changes the public key to the supplied value,
5863: and changes the start and end dates.
5864: The start date is set to the current time and the end date is set to
5865: a value determined by the
5866: .Fl days
5867: option.
5868: Any certificate extensions are retained unless the
5869: .Fl clrext
5870: option is supplied.
5871: .Pp
5872: If the input is a certificate request, a self-signed certificate
5873: is created using the supplied private key using the subject name in
5874: the request.
5875: .It Fl x509toreq
1.80 jmc 5876: Convert a certificate into a certificate request.
1.1 jsing 5877: The
5878: .Fl signkey
5879: option is used to pass the required private key.
5880: .El
1.38 jmc 5881: .Sh COMMON NOTATION
5882: Several commands share a common syntax,
5883: as detailed below.
5884: .Pp
5885: Password arguments, typically specified using
1.33 jmc 5886: .Fl passin
5887: and
5888: .Fl passout
1.38 jmc 5889: for input and output passwords,
5890: allow passwords to be obtained from a variety of sources.
5891: Both of these options take a single argument, described below.
1.33 jmc 5892: If no password argument is given and a password is required,
5893: then the user is prompted to enter one:
5894: this will typically be read from the current terminal with echoing turned off.
1.38 jmc 5895: .Bl -tag -width "pass:password" -offset indent
5896: .It Cm pass : Ns Ar password
1.33 jmc 5897: The actual password is
5898: .Ar password .
1.38 jmc 5899: Since the password is visible to utilities,
1.33 jmc 5900: this form should only be used where security is not important.
1.38 jmc 5901: .It Cm env : Ns Ar var
1.33 jmc 5902: Obtain the password from the environment variable
5903: .Ar var .
1.38 jmc 5904: Since the environment of other processes is visible,
5905: this option should be used with caution.
5906: .It Cm file : Ns Ar path
1.33 jmc 5907: The first line of
5908: .Ar path
5909: is the password.
5910: If the same
5911: .Ar path
5912: argument is supplied to
5913: .Fl passin
5914: and
5915: .Fl passout ,
5916: then the first line will be used for the input password and the next line
5917: for the output password.
5918: .Ar path
5919: need not refer to a regular file:
5920: it could, for example, refer to a device or named pipe.
1.38 jmc 5921: .It Cm fd : Ns Ar number
1.33 jmc 5922: Read the password from the file descriptor
5923: .Ar number .
1.38 jmc 5924: This can be used to send the data via a pipe, for example.
5925: .It Cm stdin
1.33 jmc 5926: Read the password from standard input.
1.35 jmc 5927: .El
1.38 jmc 5928: .Pp
1.64 jmc 5929: Input/output formats,
1.38 jmc 5930: typically specified using
5931: .Fl inform
5932: and
5933: .Fl outform ,
1.64 jmc 5934: indicate the format being read from or written to.
1.38 jmc 5935: The argument is case insensitive.
5936: .Pp
5937: .Bl -tag -width Ds -offset indent -compact
5938: .It Cm der
5939: Distinguished Encoding Rules (DER)
5940: is a binary format.
1.64 jmc 5941: .It Cm net
5942: Insecure legacy format.
1.38 jmc 5943: .It Cm pem
5944: Privacy Enhanced Mail (PEM)
5945: is base64-encoded.
1.70 jmc 5946: .It Cm smime
5947: An SMIME format message.
1.38 jmc 5948: .It Cm txt
5949: Plain ASCII text.
5950: .El
1.35 jmc 5951: .Sh ENVIRONMENT
5952: The following environment variables affect the execution of
5953: .Nm openssl :
1.38 jmc 5954: .Bl -tag -width "/etc/ssl/openssl.cnf"
1.35 jmc 5955: .It Ev OPENSSL_CONF
5956: The location of the master configuration file.
1.33 jmc 5957: .El
1.1 jsing 5958: .Sh FILES
5959: .Bl -tag -width "/etc/ssl/openssl.cnf" -compact
1.17 sobrado 5960: .It Pa /etc/ssl/
1.1 jsing 5961: Default config directory for
5962: .Nm openssl .
1.17 sobrado 5963: .It Pa /etc/ssl/lib/
1.1 jsing 5964: Unused.
1.17 sobrado 5965: .It Pa /etc/ssl/private/
1.1 jsing 5966: Default private key directory.
1.17 sobrado 5967: .It Pa /etc/ssl/openssl.cnf
1.1 jsing 5968: Default configuration file for
5969: .Nm openssl .
1.17 sobrado 5970: .It Pa /etc/ssl/x509v3.cnf
1.1 jsing 5971: Default configuration file for
5972: .Nm x509
5973: certificates.
5974: .El
5975: .Sh SEE ALSO
1.74 jmc 5976: .Xr acme-client 1 ,
1.26 jmc 5977: .Xr nc 1 ,
1.90 schwarze 5978: .Xr openssl.cnf 5 ,
5979: .Xr x509v3.cnf 5 ,
1.1 jsing 5980: .Xr ssl 8 ,
5981: .Xr starttls 8
5982: .Sh STANDARDS
5983: .Rs
5984: .%A T. Dierks
5985: .%A C. Allen
5986: .%D January 1999
5987: .%R RFC 2246
5988: .%T The TLS Protocol Version 1.0
5989: .Re
5990: .Pp
5991: .Rs
5992: .%A M. Wahl
5993: .%A S. Killie
5994: .%A T. Howes
5995: .%D December 1997
5996: .%R RFC 2253
5997: .%T Lightweight Directory Access Protocol (v3): UTF-8 String Representation of Distinguished Names
5998: .Re
5999: .Pp
6000: .Rs
6001: .%A B. Kaliski
6002: .%D March 1998
6003: .%R RFC 2315
6004: .%T PKCS #7: Cryptographic Message Syntax Version 1.5
6005: .Re
6006: .Pp
6007: .Rs
6008: .%A R. Housley
6009: .%A W. Ford
6010: .%A W. Polk
6011: .%A D. Solo
6012: .%D January 1999
6013: .%R RFC 2459
6014: .%T Internet X.509 Public Key Infrastructure Certificate and CRL Profile
6015: .Re
6016: .Pp
6017: .Rs
6018: .%A M. Myers
6019: .%A R. Ankney
6020: .%A A. Malpani
6021: .%A S. Galperin
6022: .%A C. Adams
6023: .%D June 1999
6024: .%R RFC 2560
6025: .%T X.509 Internet Public Key Infrastructure Online Certificate Status Protocol \(en OCSP
6026: .Re
6027: .Pp
6028: .Rs
6029: .%A R. Housley
6030: .%D June 1999
6031: .%R RFC 2630
6032: .%T Cryptographic Message Syntax
6033: .Re
6034: .Pp
6035: .Rs
6036: .%A P. Chown
6037: .%D June 2002
6038: .%R RFC 3268
1.24 jmc 6039: .%T Advanced Encryption Standard (AES) Ciphersuites for Transport Layer Security (TLS)
1.1 jsing 6040: .Re