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