Annotation of src/usr.bin/openssl/openssl.1, Revision 1.98
1.98 ! naddy 1: .\" $OpenBSD: openssl.1,v 1.97 2019/01/18 07:11:51 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.97 jmc 113: .Dd $Mdocdate: January 18 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,
3075: or standard output if not spceified.
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.86 jsing 3421: .Op Fl oaep | pkcs | raw
1.1 jsing 3422: .Op Fl out Ar file
3423: .Op Fl pubin
3424: .Op Fl sign
3425: .Op Fl verify
3426: .nr nS 0
3427: .Pp
3428: The
3429: .Nm rsautl
3430: command can be used to sign, verify, encrypt and decrypt
3431: data using the RSA algorithm.
3432: .Pp
3433: The options are as follows:
3434: .Bl -tag -width Ds
3435: .It Fl asn1parse
3436: Asn1parse the output data; this is useful when combined with the
3437: .Fl verify
3438: option.
3439: .It Fl certin
3440: The input is a certificate containing an RSA public key.
3441: .It Fl decrypt
3442: Decrypt the input data using an RSA private key.
3443: .It Fl encrypt
3444: Encrypt the input data using an RSA public key.
3445: .It Fl hexdump
3446: Hex dump the output data.
3447: .It Fl in Ar file
1.65 jmc 3448: The input to read from,
3449: or standard input if not specified.
1.1 jsing 3450: .It Fl inkey Ar file
1.65 jmc 3451: The input key file; by default an RSA private key.
3452: .It Fl keyform Cm der | pem
1.85 tb 3453: The private key format.
1.65 jmc 3454: The default is
3455: .Cm pem .
1.86 jsing 3456: .It Fl oaep | pkcs | raw
1.1 jsing 3457: The padding to use:
1.65 jmc 3458: PKCS#1 OAEP, PKCS#1 v1.5 (the default), or no padding, respectively.
1.1 jsing 3459: For signatures, only
3460: .Fl pkcs
3461: and
3462: .Fl raw
3463: can be used.
3464: .It Fl out Ar file
1.65 jmc 3465: The output file to write to,
3466: or standard output if not specified.
1.1 jsing 3467: .It Fl pubin
3468: The input file is an RSA public key.
3469: .It Fl sign
3470: Sign the input data and output the signed result.
3471: This requires an RSA private key.
3472: .It Fl verify
3473: Verify the input data and output the recovered data.
3474: .El
3475: .Sh S_CLIENT
3476: .nr nS 1
3477: .Nm "openssl s_client"
3478: .Op Fl 4 | 6
3479: .Op Fl bugs
3480: .Op Fl CAfile Ar file
3481: .Op Fl CApath Ar directory
3482: .Op Fl cert Ar file
3483: .Op Fl check_ss_sig
3484: .Op Fl cipher Ar cipherlist
1.66 jmc 3485: .Op Fl connect Ar host Ns Op : Ns Ar port
1.1 jsing 3486: .Op Fl crl_check
3487: .Op Fl crl_check_all
3488: .Op Fl crlf
3489: .Op Fl debug
3490: .Op Fl extended_crl
1.87 jmc 3491: .Op Fl groups
1.1 jsing 3492: .Op Fl ign_eof
3493: .Op Fl ignore_critical
3494: .Op Fl issuer_checks
3495: .Op Fl key Ar keyfile
3496: .Op Fl msg
3497: .Op Fl nbio
3498: .Op Fl nbio_test
3499: .Op Fl no_ticket
3500: .Op Fl no_tls1
1.6 guenther 3501: .Op Fl no_tls1_1
3502: .Op Fl no_tls1_2
1.1 jsing 3503: .Op Fl pause
3504: .Op Fl policy_check
3505: .Op Fl prexit
1.11 bluhm 3506: .Op Fl proxy Ar host : Ns Ar port
1.1 jsing 3507: .Op Fl psk Ar key
3508: .Op Fl psk_identity Ar identity
3509: .Op Fl quiet
3510: .Op Fl reconnect
1.5 jsing 3511: .Op Fl servername Ar name
1.1 jsing 3512: .Op Fl showcerts
3513: .Op Fl starttls Ar protocol
3514: .Op Fl state
3515: .Op Fl tls1
1.31 jmc 3516: .Op Fl tls1_1
3517: .Op Fl tls1_2
1.1 jsing 3518: .Op Fl tlsextdebug
3519: .Op Fl verify Ar depth
3520: .Op Fl x509_strict
1.19 landry 3521: .Op Fl xmpphost Ar host
1.1 jsing 3522: .nr nS 0
3523: .Pp
3524: The
3525: .Nm s_client
3526: command implements a generic SSL/TLS client which connects
3527: to a remote host using SSL/TLS.
1.66 jmc 3528: .Pp
3529: If a connection is established with an SSL server, any data received
3530: from the server is displayed and any key presses will be sent to the
3531: server.
3532: When used interactively (which means neither
3533: .Fl quiet
3534: nor
3535: .Fl ign_eof
3536: have been given), the session will be renegotiated if the line begins with an
3537: .Cm R ;
3538: if the line begins with a
3539: .Cm Q
3540: or if end of file is reached, the connection will be closed down.
1.1 jsing 3541: .Pp
3542: The options are as follows:
3543: .Bl -tag -width Ds
3544: .It Fl 4
1.66 jmc 3545: Attempt connections using IPv4 only.
1.1 jsing 3546: .It Fl 6
1.66 jmc 3547: Attempt connections using IPv6 only.
1.1 jsing 3548: .It Fl bugs
1.66 jmc 3549: Enable various workarounds for buggy implementations.
1.1 jsing 3550: .It Fl CAfile Ar file
3551: A
3552: .Ar file
3553: containing trusted certificates to use during server authentication
3554: and to use when attempting to build the client certificate chain.
3555: .It Fl CApath Ar directory
3556: The
3557: .Ar directory
3558: to use for server certificate verification.
3559: This directory must be in
3560: .Qq hash format ;
3561: see
3562: .Fl verify
3563: for more information.
3564: These are also used when building the client certificate chain.
3565: .It Fl cert Ar file
3566: The certificate to use, if one is requested by the server.
3567: The default is not to use a certificate.
3568: .It Xo
3569: .Fl check_ss_sig ,
3570: .Fl crl_check ,
3571: .Fl crl_check_all ,
3572: .Fl extended_crl ,
3573: .Fl ignore_critical ,
3574: .Fl issuer_checks ,
3575: .Fl policy_check ,
3576: .Fl x509_strict
3577: .Xc
3578: Set various certificate chain validation options.
3579: See the
1.66 jmc 3580: .Nm verify
1.1 jsing 3581: command for details.
3582: .It Fl cipher Ar cipherlist
1.66 jmc 3583: Modify the cipher list sent by the client.
1.1 jsing 3584: Although the server determines which cipher suite is used, it should take
3585: the first supported cipher in the list sent by the client.
3586: See the
1.66 jmc 3587: .Nm ciphers
3588: command for more information.
3589: .It Fl connect Ar host Ns Op : Ns Ar port
3590: The
1.1 jsing 3591: .Ar host
1.66 jmc 3592: and
1.1 jsing 3593: .Ar port
3594: to connect to.
3595: If not specified, an attempt is made to connect to the local host
3596: on port 4433.
3597: Alternatively, the host and port pair may be separated using a forward-slash
1.66 jmc 3598: character,
3599: which is useful for numeric IPv6 addresses.
1.1 jsing 3600: .It Fl crlf
1.66 jmc 3601: Translate a line feed from the terminal into CR+LF,
3602: as required by some servers.
1.1 jsing 3603: .It Fl debug
1.66 jmc 3604: Print extensive debugging information, including a hex dump of all traffic.
1.87 jmc 3605: .It Fl groups Ar ecgroups
3606: Specify a colon-separated list of permitted EC curve groups.
1.1 jsing 3607: .It Fl ign_eof
1.66 jmc 3608: Inhibit shutting down the connection when end of file is reached in the input.
1.1 jsing 3609: .It Fl key Ar keyfile
3610: The private key to use.
3611: If not specified, the certificate file will be used.
3612: .It Fl msg
3613: Show all protocol messages with hex dump.
3614: .It Fl nbio
1.66 jmc 3615: Turn on non-blocking I/O.
1.1 jsing 3616: .It Fl nbio_test
1.66 jmc 3617: Test non-blocking I/O.
1.31 jmc 3618: .It Fl no_tls1 | no_tls1_1 | no_tls1_2
1.66 jmc 3619: Disable the use of TLS1.0, 1.1, and 1.2, respectively.
1.1 jsing 3620: .It Fl no_ticket
3621: Disable RFC 4507 session ticket support.
3622: .It Fl pause
1.66 jmc 3623: Pause 1 second between each read and write call.
1.1 jsing 3624: .It Fl prexit
3625: Print session information when the program exits.
3626: This will always attempt
3627: to print out information even if the connection fails.
3628: Normally, information will only be printed out once if the connection succeeds.
3629: This option is useful because the cipher in use may be renegotiated
3630: or the connection may fail because a client certificate is required or is
3631: requested only after an attempt is made to access a certain URL.
1.66 jmc 3632: Note that the output produced by this option is not always accurate
3633: because a connection might never have been established.
1.11 bluhm 3634: .It Fl proxy Ar host : Ns Ar port
3635: Use the HTTP proxy at
3636: .Ar host
3637: and
3638: .Ar port .
3639: The connection to the proxy is done in cleartext and the
3640: .Fl connect
3641: argument is given to the proxy.
3642: If not specified, localhost is used as final destination.
3643: After that, switch the connection through the proxy to the destination
3644: to TLS.
1.1 jsing 3645: .It Fl psk Ar key
3646: Use the PSK key
3647: .Ar key
3648: when using a PSK cipher suite.
3649: The key is given as a hexadecimal number without the leading 0x,
3650: for example -psk 1a2b3c4d.
3651: .It Fl psk_identity Ar identity
1.66 jmc 3652: Use the PSK
1.1 jsing 3653: .Ar identity
3654: when using a PSK cipher suite.
3655: .It Fl quiet
3656: Inhibit printing of session and certificate information.
3657: This implicitly turns on
3658: .Fl ign_eof
3659: as well.
3660: .It Fl reconnect
1.66 jmc 3661: Reconnect to the same server 5 times using the same session ID; this can
1.1 jsing 3662: be used as a test that session caching is working.
1.5 jsing 3663: .It Fl servername Ar name
3664: Include the TLS Server Name Indication (SNI) extension in the ClientHello
3665: message, using the specified server
3666: .Ar name .
1.1 jsing 3667: .It Fl showcerts
3668: Display the whole server certificate chain: normally only the server
3669: certificate itself is displayed.
3670: .It Fl starttls Ar protocol
1.66 jmc 3671: Send the protocol-specific messages to switch to TLS for communication.
1.1 jsing 3672: .Ar protocol
3673: is a keyword for the intended protocol.
3674: Currently, the supported keywords are
3675: .Qq ftp ,
3676: .Qq imap ,
3677: .Qq smtp ,
3678: .Qq pop3 ,
3679: and
3680: .Qq xmpp .
3681: .It Fl state
1.66 jmc 3682: Print the SSL session states.
1.31 jmc 3683: .It Fl tls1 | tls1_1 | tls1_2
3684: Permit only TLS1.0, 1.1, or 1.2, respectively.
1.1 jsing 3685: .It Fl tlsextdebug
1.66 jmc 3686: Print a hex dump of any TLS extensions received from the server.
1.1 jsing 3687: .It Fl verify Ar depth
1.66 jmc 3688: Turn on server certificate verification,
3689: with a maximum length of
3690: .Ar depth .
1.1 jsing 3691: Currently the verify operation continues after errors so all the problems
3692: with a certificate chain can be seen.
3693: As a side effect the connection will never fail due to a server
3694: certificate verify failure.
1.19 landry 3695: .It Fl xmpphost Ar hostname
1.66 jmc 3696: When used with
1.19 landry 3697: .Fl starttls Ar xmpp ,
1.66 jmc 3698: specify the host for the "to" attribute of the stream element.
1.19 landry 3699: If this option is not specified then the host specified with
3700: .Fl connect
3701: will be used.
1.1 jsing 3702: .El
3703: .Sh S_SERVER
3704: .nr nS 1
3705: .Nm "openssl s_server"
3706: .Op Fl accept Ar port
3707: .Op Fl bugs
3708: .Op Fl CAfile Ar file
3709: .Op Fl CApath Ar directory
3710: .Op Fl cert Ar file
3711: .Op Fl cipher Ar cipherlist
3712: .Op Fl context Ar id
3713: .Op Fl crl_check
3714: .Op Fl crl_check_all
3715: .Op Fl crlf
3716: .Op Fl dcert Ar file
3717: .Op Fl debug
3718: .Op Fl dhparam Ar file
3719: .Op Fl dkey Ar file
3720: .Op Fl hack
3721: .Op Fl HTTP
3722: .Op Fl id_prefix Ar arg
3723: .Op Fl key Ar keyfile
3724: .Op Fl msg
3725: .Op Fl nbio
3726: .Op Fl nbio_test
3727: .Op Fl no_dhe
3728: .Op Fl no_tls1
1.6 guenther 3729: .Op Fl no_tls1_1
3730: .Op Fl no_tls1_2
1.1 jsing 3731: .Op Fl no_tmp_rsa
3732: .Op Fl nocert
3733: .Op Fl psk Ar key
3734: .Op Fl psk_hint Ar hint
3735: .Op Fl quiet
3736: .Op Fl serverpref
3737: .Op Fl state
3738: .Op Fl tls1
1.31 jmc 3739: .Op Fl tls1_1
3740: .Op Fl tls1_2
1.1 jsing 3741: .Op Fl Verify Ar depth
3742: .Op Fl verify Ar depth
3743: .Op Fl WWW
3744: .Op Fl www
3745: .nr nS 0
3746: .Pp
3747: The
3748: .Nm s_server
3749: command implements a generic SSL/TLS server which listens
3750: for connections on a given port using SSL/TLS.
3751: .Pp
1.67 jmc 3752: If a connection request is established with a client and neither the
3753: .Fl www
3754: nor the
3755: .Fl WWW
3756: option has been used, then any data received
3757: from the client is displayed and any key presses are sent to the client.
3758: Certain single letter commands perform special operations:
3759: .Pp
3760: .Bl -tag -width "XXXX" -compact
3761: .It Ic P
3762: Send plain text, which should cause the client to disconnect.
3763: .It Ic Q
3764: End the current SSL connection and exit.
3765: .It Ic q
3766: End the current SSL connection, but still accept new connections.
3767: .It Ic R
3768: Renegotiate the SSL session and request a client certificate.
3769: .It Ic r
3770: Renegotiate the SSL session.
3771: .It Ic S
3772: Print out some session cache status information.
3773: .El
3774: .Pp
1.1 jsing 3775: The options are as follows:
3776: .Bl -tag -width Ds
3777: .It Fl accept Ar port
1.67 jmc 3778: Listen on TCP
1.1 jsing 3779: .Ar port
1.67 jmc 3780: for connections.
3781: The default is port 4433.
1.1 jsing 3782: .It Fl bugs
1.67 jmc 3783: Enable various workarounds for buggy implementations.
1.1 jsing 3784: .It Fl CAfile Ar file
1.67 jmc 3785: A
3786: .Ar file
3787: containing trusted certificates to use during client authentication
1.1 jsing 3788: and to use when attempting to build the server certificate chain.
3789: The list is also used in the list of acceptable client CAs passed to the
3790: client when a certificate is requested.
3791: .It Fl CApath Ar directory
3792: The
3793: .Ar directory
3794: to use for client certificate verification.
3795: This directory must be in
3796: .Qq hash format ;
3797: see
3798: .Fl verify
3799: for more information.
3800: These are also used when building the server certificate chain.
3801: .It Fl cert Ar file
1.67 jmc 3802: The certificate to use: most server's cipher suites require the use of a
3803: certificate and some require a certificate with a certain public key type.
3804: For example, the DSS cipher suites require a certificate containing a DSS
3805: (DSA) key.
1.1 jsing 3806: If not specified, the file
3807: .Pa server.pem
3808: will be used.
3809: .It Fl cipher Ar cipherlist
1.67 jmc 3810: Modify the cipher list used by the server.
1.1 jsing 3811: This allows the cipher list used by the server to be modified.
3812: When the client sends a list of supported ciphers, the first client cipher
3813: also included in the server list is used.
3814: Because the client specifies the preference order, the order of the server
3815: cipherlist is irrelevant.
3816: See the
1.67 jmc 3817: .Nm ciphers
3818: command for more information.
1.1 jsing 3819: .It Fl context Ar id
1.67 jmc 3820: Set the SSL context ID.
1.1 jsing 3821: It can be given any string value.
3822: .It Fl crl_check , crl_check_all
3823: Check the peer certificate has not been revoked by its CA.
3824: The CRLs are appended to the certificate file.
3825: .Fl crl_check_all
1.67 jmc 3826: checks all CRLs of all CAs in the chain.
1.1 jsing 3827: .It Fl crlf
1.67 jmc 3828: Translate a line feed from the terminal into CR+LF.
1.1 jsing 3829: .It Fl dcert Ar file , Fl dkey Ar file
3830: Specify an additional certificate and private key; these behave in the
3831: same manner as the
3832: .Fl cert
3833: and
3834: .Fl key
3835: options except there is no default if they are not specified
1.67 jmc 3836: (no additional certificate or key is used).
1.1 jsing 3837: By using RSA and DSS certificates and keys,
3838: a server can support clients which only support RSA or DSS cipher suites
3839: by using an appropriate certificate.
3840: .It Fl debug
1.67 jmc 3841: Print extensive debugging information, including a hex dump of all traffic.
1.1 jsing 3842: .It Fl dhparam Ar file
3843: The DH parameter file to use.
3844: The ephemeral DH cipher suites generate keys
3845: using a set of DH parameters.
3846: If not specified, an attempt is made to
3847: load the parameters from the server certificate file.
3848: If this fails, a static set of parameters hard coded into the
3849: .Nm s_server
3850: program will be used.
3851: .It Fl hack
1.67 jmc 3852: Enables a further workaround for some early Netscape SSL code.
1.1 jsing 3853: .It Fl HTTP
1.67 jmc 3854: Emulate a simple web server.
3855: Pages are resolved relative to the current directory.
3856: For example if the URL
1.1 jsing 3857: .Pa https://myhost/page.html
3858: is requested, the file
3859: .Pa ./page.html
3860: will be loaded.
3861: The files loaded are assumed to contain a complete and correct HTTP
3862: response (lines that are part of the HTTP response line and headers
3863: must end with CRLF).
3864: .It Fl id_prefix Ar arg
3865: Generate SSL/TLS session IDs prefixed by
3866: .Ar arg .
3867: This is mostly useful for testing any SSL/TLS code
1.81 jmc 3868: that wish to deal with multiple servers,
3869: when each of which might be generating a unique range of session IDs.
1.1 jsing 3870: .It Fl key Ar keyfile
3871: The private key to use.
3872: If not specified, the certificate file will be used.
3873: .It Fl msg
3874: Show all protocol messages with hex dump.
3875: .It Fl nbio
1.67 jmc 3876: Turn on non-blocking I/O.
1.1 jsing 3877: .It Fl nbio_test
1.67 jmc 3878: Test non-blocking I/O.
1.1 jsing 3879: .It Fl no_dhe
1.67 jmc 3880: Disable ephemeral DH cipher suites.
1.31 jmc 3881: .It Fl no_tls1 | no_tls1_1 | no_tls1_2
1.67 jmc 3882: Disable the use of TLS1.0, 1.1, and 1.2, respectively.
1.1 jsing 3883: .It Fl no_tmp_rsa
1.67 jmc 3884: Disable temporary RSA key generation.
1.1 jsing 3885: .It Fl nocert
1.67 jmc 3886: Do not use a certificate.
1.1 jsing 3887: This restricts the cipher suites available to the anonymous ones
1.67 jmc 3888: (currently just anonymous DH).
1.1 jsing 3889: .It Fl psk Ar key
3890: Use the PSK key
3891: .Ar key
3892: when using a PSK cipher suite.
3893: The key is given as a hexadecimal number without the leading 0x,
3894: for example -psk 1a2b3c4d.
3895: .It Fl psk_hint Ar hint
3896: Use the PSK identity hint
3897: .Ar hint
3898: when using a PSK cipher suite.
3899: .It Fl quiet
3900: Inhibit printing of session and certificate information.
3901: .It Fl serverpref
3902: Use server's cipher preferences.
3903: .It Fl state
1.67 jmc 3904: Print the SSL session states.
1.31 jmc 3905: .It Fl tls1 | tls1_1 | tls1_2
3906: Permit only TLS1.0, 1.1, or 1.2, respectively.
1.1 jsing 3907: .It Fl WWW
1.67 jmc 3908: Emulate a simple web server.
3909: Pages are resolved relative to the current directory.
3910: For example if the URL
1.1 jsing 3911: .Pa https://myhost/page.html
3912: is requested, the file
3913: .Pa ./page.html
3914: will be loaded.
3915: .It Fl www
1.67 jmc 3916: Send a status message to the client when it connects,
3917: including information about the ciphers used and various session parameters.
1.1 jsing 3918: The output is in HTML format so this option will normally be used with a
3919: web browser.
3920: .It Fl Verify Ar depth , Fl verify Ar depth
1.67 jmc 3921: Request a certificate chain from the client,
3922: with a maximum length of
3923: .Ar depth .
3924: With
3925: .Fl Verify ,
3926: the client must supply a certificate or an error occurs;
3927: with
3928: .Fl verify ,
3929: a certificate is requested but the client does not have to send one.
1.1 jsing 3930: .El
3931: .Sh S_TIME
3932: .nr nS 1
3933: .Nm "openssl s_time"
3934: .Op Fl bugs
3935: .Op Fl CAfile Ar file
3936: .Op Fl CApath Ar directory
3937: .Op Fl cert Ar file
3938: .Op Fl cipher Ar cipherlist
1.68 jmc 3939: .Op Fl connect Ar host Ns Op : Ns Ar port
1.1 jsing 3940: .Op Fl key Ar keyfile
3941: .Op Fl nbio
3942: .Op Fl new
1.20 lteo 3943: .Op Fl no_shutdown
1.1 jsing 3944: .Op Fl reuse
3945: .Op Fl time Ar seconds
3946: .Op Fl verify Ar depth
3947: .Op Fl www Ar page
3948: .nr nS 0
3949: .Pp
3950: The
1.68 jmc 3951: .Nm s_time
1.1 jsing 3952: command implements a generic SSL/TLS client which connects to a
3953: remote host using SSL/TLS.
3954: It can request a page from the server and includes
3955: the time to transfer the payload data in its timing measurements.
3956: It measures the number of connections within a given timeframe,
3957: the amount of data transferred
3958: .Pq if any ,
3959: and calculates the average time spent for one connection.
3960: .Pp
3961: The options are as follows:
3962: .Bl -tag -width Ds
3963: .It Fl bugs
1.68 jmc 3964: Enable various workarounds for buggy implementations.
1.1 jsing 3965: .It Fl CAfile Ar file
1.68 jmc 3966: A
3967: .Ar file
3968: containing trusted certificates to use during server authentication
1.1 jsing 3969: and to use when attempting to build the client certificate chain.
3970: .It Fl CApath Ar directory
3971: The directory to use for server certificate verification.
3972: This directory must be in
3973: .Qq hash format ;
3974: see
3975: .Nm verify
3976: for more information.
3977: These are also used when building the client certificate chain.
3978: .It Fl cert Ar file
3979: The certificate to use, if one is requested by the server.
3980: The default is not to use a certificate.
3981: .It Fl cipher Ar cipherlist
1.68 jmc 3982: Modify the cipher list sent by the client.
1.1 jsing 3983: Although the server determines which cipher suite is used,
3984: it should take the first supported cipher in the list sent by the client.
3985: See the
3986: .Nm ciphers
3987: command for more information.
1.68 jmc 3988: .It Fl connect Ar host Ns Op : Ns Ar port
3989: The host and port to connect to.
1.1 jsing 3990: .It Fl key Ar keyfile
3991: The private key to use.
3992: If not specified, the certificate file will be used.
3993: .It Fl nbio
1.68 jmc 3994: Turn on non-blocking I/O.
1.1 jsing 3995: .It Fl new
1.68 jmc 3996: Perform the timing test using a new session ID for each connection.
1.1 jsing 3997: If neither
3998: .Fl new
3999: nor
4000: .Fl reuse
4001: are specified,
4002: they are both on by default and executed in sequence.
1.20 lteo 4003: .It Fl no_shutdown
1.21 jmc 4004: Shut down the connection without sending a
1.68 jmc 4005: .Qq close notify
1.20 lteo 4006: shutdown alert to the server.
1.1 jsing 4007: .It Fl reuse
1.68 jmc 4008: Perform the timing test using the same session ID for each connection.
1.1 jsing 4009: If neither
4010: .Fl new
4011: nor
4012: .Fl reuse
4013: are specified,
4014: they are both on by default and executed in sequence.
4015: .It Fl time Ar seconds
1.68 jmc 4016: Limit
1.1 jsing 4017: .Nm s_time
1.68 jmc 4018: benchmarks to the number of
4019: .Ar seconds .
1.1 jsing 4020: The default is 30 seconds.
4021: .It Fl verify Ar depth
1.68 jmc 4022: Turn on server certificate verification,
4023: with a maximum length of
4024: .Ar depth .
1.1 jsing 4025: Currently the verify operation continues after errors, so all the problems
4026: with a certificate chain can be seen.
4027: As a side effect,
4028: the connection will never fail due to a server certificate verify failure.
4029: .It Fl www Ar page
1.68 jmc 4030: The page to GET from the server.
1.1 jsing 4031: A value of
4032: .Sq /
4033: gets the index.htm[l] page.
4034: If this parameter is not specified,
4035: .Nm s_time
4036: will only perform the handshake to establish SSL connections
4037: but not transfer any payload data.
4038: .El
4039: .Sh SESS_ID
4040: .nr nS 1
4041: .Nm "openssl sess_id"
4042: .Op Fl cert
4043: .Op Fl context Ar ID
4044: .Op Fl in Ar file
1.69 jmc 4045: .Op Fl inform Cm der | pem
1.1 jsing 4046: .Op Fl noout
4047: .Op Fl out Ar file
1.69 jmc 4048: .Op Fl outform Cm der | pem
1.1 jsing 4049: .Op Fl text
4050: .nr nS 0
4051: .Pp
4052: The
4053: .Nm sess_id
4054: program processes the encoded version of the SSL session structure and
4055: optionally prints out SSL session details
1.69 jmc 4056: (for example the SSL session master key)
1.72 jmc 4057: in human-readable format.
1.1 jsing 4058: .Pp
4059: The options are as follows:
4060: .Bl -tag -width Ds
4061: .It Fl cert
4062: If a certificate is present in the session,
4063: it will be output using this option;
4064: if the
4065: .Fl text
4066: option is also present, then it will be printed out in text form.
4067: .It Fl context Ar ID
1.69 jmc 4068: Set the session
1.1 jsing 4069: .Ar ID .
1.69 jmc 4070: The ID can be any string of characters.
1.1 jsing 4071: .It Fl in Ar file
1.69 jmc 4072: The input file to read from,
4073: or standard input if not specified.
4074: .It Fl inform Cm der | pem
4075: The input format.
4076: .Cm der
1.84 jmc 4077: uses an ASN.1 DER-encoded format containing session details.
1.1 jsing 4078: The precise format can vary from one version to the next.
1.69 jmc 4079: .Cm pem
4080: is the default format: it consists of the DER
1.1 jsing 4081: format base64-encoded with additional header and footer lines.
4082: .It Fl noout
1.69 jmc 4083: Do not output the encoded version of the session.
1.1 jsing 4084: .It Fl out Ar file
1.69 jmc 4085: The output file to write to,
4086: or standard output if not specified.
4087: .It Fl outform Cm der | pem
4088: The output format.
1.1 jsing 4089: .It Fl text
1.69 jmc 4090: Print the various public or private key components in plain text,
4091: in addition to the encoded version.
1.1 jsing 4092: .El
4093: .Pp
1.69 jmc 4094: The output of
4095: .Nm sess_id
4096: is composed as follows:
1.1 jsing 4097: .Pp
1.69 jmc 4098: .Bl -tag -width "Verify return code " -offset 3n -compact
4099: .It Protocol
4100: The protocol in use.
4101: .It Cipher
4102: The actual raw SSL or TLS cipher code.
4103: .It Session-ID
4104: The SSL session ID, in hex format.
4105: .It Session-ID-ctx
4106: The session ID context, in hex format.
4107: .It Master-Key
4108: The SSL session master key.
4109: .It Key-Arg
1.1 jsing 4110: The key argument; this is only used in SSL v2.
1.69 jmc 4111: .It Start Time
4112: The session start time.
1.1 jsing 4113: .Ux
4114: format.
1.69 jmc 4115: .It Timeout
4116: The timeout, in seconds.
4117: .It Verify return code
4118: The return code when a certificate is verified.
1.1 jsing 4119: .El
4120: .Pp
4121: Since the SSL session output contains the master key, it is possible to read
4122: the contents of an encrypted session using this information.
4123: Therefore appropriate security precautions
4124: should be taken if the information is being output by a
4125: .Qq real
4126: application.
4127: This is, however, strongly discouraged and should only be used for
4128: debugging purposes.
4129: .Sh SMIME
4130: .nr nS 1
4131: .Nm "openssl smime"
4132: .Oo
4133: .Fl aes128 | aes192 | aes256 | des |
4134: .Fl des3 | rc2-40 | rc2-64 | rc2-128
4135: .Oc
4136: .Op Fl binary
4137: .Op Fl CAfile Ar file
4138: .Op Fl CApath Ar directory
4139: .Op Fl certfile Ar file
4140: .Op Fl check_ss_sig
4141: .Op Fl content Ar file
4142: .Op Fl crl_check
4143: .Op Fl crl_check_all
4144: .Op Fl decrypt
4145: .Op Fl encrypt
4146: .Op Fl extended_crl
4147: .Op Fl from Ar addr
4148: .Op Fl ignore_critical
4149: .Op Fl in Ar file
4150: .Op Fl indef
1.70 jmc 4151: .Op Fl inform Cm der | pem | smime
1.1 jsing 4152: .Op Fl inkey Ar file
4153: .Op Fl issuer_checks
1.70 jmc 4154: .Op Fl keyform Cm pem
1.1 jsing 4155: .Op Fl md Ar digest
4156: .Op Fl noattr
4157: .Op Fl nocerts
4158: .Op Fl nochain
4159: .Op Fl nodetach
4160: .Op Fl noindef
4161: .Op Fl nointern
4162: .Op Fl nosigs
4163: .Op Fl noverify
4164: .Op Fl out Ar file
1.70 jmc 4165: .Op Fl outform Cm der | pem | smime
1.1 jsing 4166: .Op Fl passin Ar arg
4167: .Op Fl pk7out
4168: .Op Fl policy_check
4169: .Op Fl recip Ar file
4170: .Op Fl resign
4171: .Op Fl sign
4172: .Op Fl signer Ar file
4173: .Op Fl stream
4174: .Op Fl subject Ar s
4175: .Op Fl text
4176: .Op Fl to Ar addr
4177: .Op Fl verify
4178: .Op Fl x509_strict
4179: .Op Ar cert.pem ...
4180: .nr nS 0
4181: .Pp
4182: The
4183: .Nm smime
1.70 jmc 4184: command handles S/MIME mail.
4185: It can encrypt, decrypt, sign, and verify S/MIME messages.
4186: .Pp
4187: The MIME message must be sent without any blank lines between the
4188: headers and the output.
4189: Some mail programs will automatically add a blank line.
4190: Piping the mail directly to an MTA is one way to
4191: achieve the correct format.
4192: .Pp
4193: The supplied message to be signed or encrypted must include the necessary
4194: MIME headers or many S/MIME clients won't display it properly (if at all).
4195: Use the
4196: .Fl text
4197: option to automatically add plain text headers.
1.1 jsing 4198: .Pp
1.70 jmc 4199: A
4200: .Qq signed and encrypted
4201: message is one where a signed message is then encrypted.
4202: This can be produced by encrypting an already signed message.
1.1 jsing 4203: .Pp
1.70 jmc 4204: There are a number of operations that can be performed, as follows:
1.1 jsing 4205: .Bl -tag -width "XXXX"
4206: .It Fl decrypt
4207: Decrypt mail using the supplied certificate and private key.
1.70 jmc 4208: The input file is an encrypted mail message in MIME format.
1.1 jsing 4209: The decrypted mail is written to the output file.
4210: .It Fl encrypt
4211: Encrypt mail for the given recipient certificates.
1.70 jmc 4212: The input is the message to be encrypted.
4213: The output file is the encrypted mail, in MIME format.
1.1 jsing 4214: .It Fl pk7out
1.70 jmc 4215: Take an input message and write out a PEM-encoded PKCS#7 structure.
1.1 jsing 4216: .It Fl resign
4217: Resign a message: take an existing message and one or more new signers.
4218: .It Fl sign
4219: Sign mail using the supplied certificate and private key.
1.70 jmc 4220: The input file is the message to be signed.
4221: The signed message, in MIME format, is written to the output file.
1.1 jsing 4222: .It Fl verify
4223: Verify signed mail.
1.70 jmc 4224: The input is a signed mail message and the output is the signed data.
1.1 jsing 4225: Both clear text and opaque signing is supported.
4226: .El
4227: .Pp
1.14 jmc 4228: The remaining options are as follows:
1.1 jsing 4229: .Bl -tag -width "XXXX"
4230: .It Xo
4231: .Fl aes128 | aes192 | aes256 | des |
4232: .Fl des3 | rc2-40 | rc2-64 | rc2-128
4233: .Xc
4234: The encryption algorithm to use.
1.70 jmc 4235: 128-, 192-, or 256-bit AES, DES (56 bits), triple DES (168 bits),
1.1 jsing 4236: or 40-, 64-, or 128-bit RC2, respectively;
4237: if not specified, 40-bit RC2 is
4238: used.
4239: Only used with
4240: .Fl encrypt .
4241: .It Fl binary
4242: Normally, the input message is converted to
4243: .Qq canonical
1.70 jmc 4244: format which uses CR/LF as end of line,
4245: as required by the S/MIME specification.
1.1 jsing 4246: When this option is present no translation occurs.
1.70 jmc 4247: This is useful when handling binary data which may not be in MIME format.
1.1 jsing 4248: .It Fl CAfile Ar file
4249: A
4250: .Ar file
4251: containing trusted CA certificates; only used with
4252: .Fl verify .
4253: .It Fl CApath Ar directory
4254: A
4255: .Ar directory
4256: containing trusted CA certificates; only used with
4257: .Fl verify .
4258: This directory must be a standard certificate directory:
4259: that is, a hash of each subject name (using
4260: .Nm x509 -hash )
4261: should be linked to each certificate.
4262: .It Ar cert.pem ...
4263: One or more certificates of message recipients: used when encrypting
4264: a message.
4265: .It Fl certfile Ar file
4266: Allows additional certificates to be specified.
4267: When signing, these will be included with the message.
4268: When verifying, these will be searched for the signers' certificates.
4269: The certificates should be in PEM format.
4270: .It Xo
4271: .Fl check_ss_sig ,
4272: .Fl crl_check ,
4273: .Fl crl_check_all ,
4274: .Fl extended_crl ,
4275: .Fl ignore_critical ,
4276: .Fl issuer_checks ,
4277: .Fl policy_check ,
4278: .Fl x509_strict
4279: .Xc
4280: Set various certificate chain validation options.
4281: See the
1.70 jmc 4282: .Nm verify
1.1 jsing 4283: command for details.
4284: .It Fl content Ar file
1.70 jmc 4285: A file containing the detached content.
1.1 jsing 4286: This is only useful with the
4287: .Fl verify
1.70 jmc 4288: option,
4289: and only usable if the PKCS#7 structure is using the detached
1.1 jsing 4290: signature form where the content is not included.
1.70 jmc 4291: This option will override any content if the input format is S/MIME
4292: and it uses the multipart/signed MIME content type.
1.1 jsing 4293: .It Xo
4294: .Fl from Ar addr ,
4295: .Fl subject Ar s ,
4296: .Fl to Ar addr
4297: .Xc
4298: The relevant mail headers.
4299: These are included outside the signed
4300: portion of a message so they may be included manually.
1.70 jmc 4301: When signing, many S/MIME
1.1 jsing 4302: mail clients check that the signer's certificate email
4303: address matches the From: address.
4304: .It Fl in Ar file
1.70 jmc 4305: The input file to read from.
1.1 jsing 4306: .It Fl indef
4307: Enable streaming I/O for encoding operations.
4308: This permits single pass processing of data without
4309: the need to hold the entire contents in memory,
4310: potentially supporting very large files.
4311: Streaming is automatically set for S/MIME signing with detached
4312: data if the output format is SMIME;
4313: it is currently off by default for all other operations.
1.70 jmc 4314: .It Fl inform Cm der | pem | smime
4315: The input format.
1.1 jsing 4316: .It Fl inkey Ar file
1.70 jmc 4317: The private key to use when signing or decrypting,
4318: which must match the corresponding certificate.
1.1 jsing 4319: If this option is not specified, the private key must be included
4320: in the certificate file specified with
4321: the
4322: .Fl recip
4323: or
4324: .Fl signer
4325: file.
4326: When signing,
4327: this option can be used multiple times to specify successive keys.
1.70 jmc 4328: .It Fl keyform Cm pem
1.1 jsing 4329: Input private key format.
4330: .It Fl md Ar digest
4331: The digest algorithm to use when signing or resigning.
4332: If not present then the default digest algorithm for the signing key is used
4333: (usually SHA1).
4334: .It Fl noattr
1.70 jmc 4335: Do not include attributes.
1.1 jsing 4336: .It Fl nocerts
1.70 jmc 4337: Do not include the signer's certificate.
1.1 jsing 4338: This will reduce the size of the signed message but the verifier must
4339: have a copy of the signer's certificate available locally (passed using the
4340: .Fl certfile
4341: option, for example).
4342: .It Fl nochain
4343: Do not do chain verification of signers' certificates: that is,
4344: don't use the certificates in the signed message as untrusted CAs.
4345: .It Fl nodetach
4346: When signing a message use opaque signing: this form is more resistant
4347: to translation by mail relays but it cannot be read by mail agents that
1.70 jmc 4348: do not support S/MIME.
4349: Without this option cleartext signing with the MIME type
4350: multipart/signed is used.
1.1 jsing 4351: .It Fl noindef
1.70 jmc 4352: Disable streaming I/O where it would produce an encoding of indefinite length
4353: (currently has no effect).
1.1 jsing 4354: .It Fl nointern
1.70 jmc 4355: Only use certificates specified in the
4356: .Fl certfile .
4357: The supplied certificates can still be used as untrusted CAs.
1.1 jsing 4358: .It Fl nosigs
1.70 jmc 4359: Do not try to verify the signatures on the message.
1.1 jsing 4360: .It Fl noverify
4361: Do not verify the signer's certificate of a signed message.
4362: .It Fl out Ar file
1.70 jmc 4363: The output file to write to.
4364: .It Fl outform Cm der | pem | smime
4365: The output format.
4366: The default is smime, which writes an S/MIME format message.
4367: .Cm pem
1.1 jsing 4368: and
1.70 jmc 4369: .Cm der
4370: change this to write PEM and DER format PKCS#7 structures instead.
1.1 jsing 4371: This currently only affects the output format of the PKCS#7
4372: structure; if no PKCS#7 structure is being output (for example with
4373: .Fl verify
4374: or
4375: .Fl decrypt )
4376: this option has no effect.
4377: .It Fl passin Ar arg
4378: The key password source.
4379: .It Fl recip Ar file
4380: The recipients certificate when decrypting a message.
4381: This certificate
4382: must match one of the recipients of the message or an error occurs.
4383: .It Fl signer Ar file
4384: A signing certificate when signing or resigning a message;
4385: this option can be used multiple times if more than one signer is required.
4386: If a message is being verified, the signer's certificates will be
4387: written to this file if the verification was successful.
4388: .It Fl stream
4389: The same as
4390: .Fl indef .
4391: .It Fl text
1.70 jmc 4392: Add plain text (text/plain) MIME
1.1 jsing 4393: headers to the supplied message if encrypting or signing.
4394: If decrypting or verifying, it strips off text headers:
1.70 jmc 4395: if the decrypted or verified message is not of MIME type text/plain
4396: then an error occurs.
1.1 jsing 4397: .El
4398: .Pp
1.70 jmc 4399: The exit codes for
4400: .Nm smime
4401: are as follows:
1.1 jsing 4402: .Pp
1.70 jmc 4403: .Bl -tag -width "XXXX" -offset 3n -compact
4404: .It 0
1.1 jsing 4405: The operation was completely successful.
1.70 jmc 4406: .It 1
1.1 jsing 4407: An error occurred parsing the command options.
1.70 jmc 4408: .It 2
1.1 jsing 4409: One of the input files could not be read.
1.70 jmc 4410: .It 3
4411: An error occurred creating the file or when reading the message.
4412: .It 4
1.1 jsing 4413: An error occurred decrypting or verifying the message.
1.70 jmc 4414: .It 5
4415: An error occurred writing certificates.
1.1 jsing 4416: .El
4417: .Sh SPEED
4418: .nr nS 1
4419: .Nm "openssl speed"
1.71 jmc 4420: .Op Ar algorithm
1.1 jsing 4421: .Op Fl decrypt
4422: .Op Fl elapsed
1.71 jmc 4423: .Op Fl evp Ar algorithm
1.1 jsing 4424: .Op Fl mr
4425: .Op Fl multi Ar number
4426: .nr nS 0
4427: .Pp
4428: The
4429: .Nm speed
4430: command is used to test the performance of cryptographic algorithms.
4431: .Bl -tag -width "XXXX"
1.71 jmc 4432: .It Ar algorithm
4433: Perform the test using
4434: .Ar algorithm .
4435: The default is to test all algorithms.
1.1 jsing 4436: .It Fl decrypt
1.71 jmc 4437: Time decryption instead of encryption;
4438: must be used with
4439: .Fl evp .
1.1 jsing 4440: .It Fl elapsed
4441: Measure time in real time instead of CPU user time.
1.71 jmc 4442: .It Fl evp Ar algorithm
4443: Perform the test using one of the algorithms accepted by
4444: .Xr EVP_get_cipherbyname 3 .
1.1 jsing 4445: .It Fl mr
4446: Produce machine readable output.
4447: .It Fl multi Ar number
4448: Run
4449: .Ar number
4450: benchmarks in parallel.
4451: .El
1.77 jmc 4452: .Sh SPKAC
4453: .nr nS 1
4454: .Nm "openssl spkac"
4455: .Op Fl challenge Ar string
4456: .Op Fl in Ar file
4457: .Op Fl key Ar keyfile
4458: .Op Fl noout
4459: .Op Fl out Ar file
4460: .Op Fl passin Ar arg
4461: .Op Fl pubkey
4462: .Op Fl spkac Ar spkacname
4463: .Op Fl spksect Ar section
4464: .Op Fl verify
4465: .nr nS 0
4466: .Pp
4467: The
4468: .Nm spkac
4469: command processes signed public key and challenge (SPKAC) files.
4470: It can print out their contents, verify the signature,
4471: and produce its own SPKACs from a supplied private key.
4472: .Pp
4473: The options are as follows:
4474: .Bl -tag -width Ds
4475: .It Fl challenge Ar string
4476: The challenge string, if an SPKAC is being created.
4477: .It Fl in Ar file
4478: The input file to read from,
4479: or standard input if not specified.
4480: Ignored if the
4481: .Fl key
4482: option is used.
4483: .It Fl key Ar keyfile
4484: Create an SPKAC file using the private key in
4485: .Ar keyfile .
4486: The
4487: .Fl in , noout , spksect ,
4488: and
4489: .Fl verify
4490: options are ignored, if present.
4491: .It Fl noout
4492: Do not output the text version of the SPKAC.
4493: .It Fl out Ar file
4494: The output file to write to,
4495: or standard output if not specified.
4496: .It Fl passin Ar arg
4497: The key password source.
4498: .It Fl pubkey
4499: Output the public key of an SPKAC.
4500: .It Fl spkac Ar spkacname
4501: An alternative name for the variable containing the SPKAC.
4502: The default is "SPKAC".
4503: This option affects both generated and input SPKAC files.
4504: .It Fl spksect Ar section
4505: An alternative name for the
4506: .Ar section
4507: containing the SPKAC.
4508: .It Fl verify
4509: Verify the digital signature on the supplied SPKAC.
4510: .El
1.1 jsing 4511: .Sh TS
4512: .nr nS 1
4513: .Nm "openssl ts"
4514: .Fl query
1.29 bcook 4515: .Op Fl md4 | md5 | ripemd160 | sha1
1.1 jsing 4516: .Op Fl cert
4517: .Op Fl config Ar configfile
4518: .Op Fl data Ar file_to_hash
4519: .Op Fl digest Ar digest_bytes
4520: .Op Fl in Ar request.tsq
4521: .Op Fl no_nonce
4522: .Op Fl out Ar request.tsq
4523: .Op Fl policy Ar object_id
4524: .Op Fl text
4525: .nr nS 0
4526: .Pp
4527: .nr nS 1
4528: .Nm "openssl ts"
4529: .Fl reply
4530: .Op Fl chain Ar certs_file.pem
4531: .Op Fl config Ar configfile
4532: .Op Fl in Ar response.tsr
4533: .Op Fl inkey Ar private.pem
4534: .Op Fl out Ar response.tsr
4535: .Op Fl passin Ar arg
4536: .Op Fl policy Ar object_id
4537: .Op Fl queryfile Ar request.tsq
4538: .Op Fl section Ar tsa_section
4539: .Op Fl signer Ar tsa_cert.pem
4540: .Op Fl text
4541: .Op Fl token_in
4542: .Op Fl token_out
4543: .nr nS 0
4544: .Pp
4545: .nr nS 1
4546: .Nm "openssl ts"
4547: .Fl verify
4548: .Op Fl CAfile Ar trusted_certs.pem
4549: .Op Fl CApath Ar trusted_cert_path
4550: .Op Fl data Ar file_to_hash
4551: .Op Fl digest Ar digest_bytes
4552: .Op Fl in Ar response.tsr
4553: .Op Fl queryfile Ar request.tsq
4554: .Op Fl token_in
4555: .Op Fl untrusted Ar cert_file.pem
4556: .nr nS 0
4557: .Pp
4558: The
4559: .Nm ts
4560: command is a basic Time Stamping Authority (TSA) client and server
4561: application as specified in RFC 3161 (Time-Stamp Protocol, TSP).
4562: A TSA can be part of a PKI deployment and its role is to provide long
1.72 jmc 4563: term proof of the existence of specific data.
1.1 jsing 4564: Here is a brief description of the protocol:
4565: .Bl -enum
4566: .It
4567: The TSA client computes a one-way hash value for a data file and sends
4568: the hash to the TSA.
4569: .It
4570: The TSA attaches the current date and time to the received hash value,
4571: signs them and sends the time stamp token back to the client.
4572: By creating this token the TSA certifies the existence of the original
4573: data file at the time of response generation.
4574: .It
4575: The TSA client receives the time stamp token and verifies the
4576: signature on it.
4577: It also checks if the token contains the same hash
4578: value that it had sent to the TSA.
4579: .El
4580: .Pp
4581: There is one DER-encoded protocol data unit defined for transporting a time
4582: stamp request to the TSA and one for sending the time stamp response
4583: back to the client.
4584: The
4585: .Nm ts
4586: command has three main functions:
4587: creating a time stamp request based on a data file;
4588: creating a time stamp response based on a request;
4589: and verifying if a response corresponds
4590: to a particular request or a data file.
4591: .Pp
4592: There is no support for sending the requests/responses automatically
4593: over HTTP or TCP yet as suggested in RFC 3161.
4594: Users must send the requests either by FTP or email.
4595: .Pp
4596: The
4597: .Fl query
4598: switch can be used for creating and printing a time stamp
4599: request with the following options:
4600: .Bl -tag -width Ds
4601: .It Fl cert
1.72 jmc 4602: Expect the TSA to include its signing certificate in the response.
1.1 jsing 4603: .It Fl config Ar configfile
1.72 jmc 4604: Specify an alternative configuration file.
4605: Only the OID section is used.
1.1 jsing 4606: .It Fl data Ar file_to_hash
4607: The data file for which the time stamp request needs to be created.
1.72 jmc 4608: The default is standard input.
1.1 jsing 4609: .It Fl digest Ar digest_bytes
1.72 jmc 4610: Specify the message imprint explicitly without the data file.
1.1 jsing 4611: The imprint must be specified in a hexadecimal format,
4612: two characters per byte,
1.72 jmc 4613: the bytes optionally separated by colons.
1.1 jsing 4614: The number of bytes must match the message digest algorithm in use.
4615: .It Fl in Ar request.tsq
1.72 jmc 4616: A previously created time stamp request in DER
1.1 jsing 4617: format that will be printed into the output file.
1.72 jmc 4618: Useful for examining the content of a request in human-readable format.
1.76 jmc 4619: .It Fl md4 | md5 | ripemd160 | sha | sha1
1.1 jsing 4620: The message digest to apply to the data file.
4621: It supports all the message digest algorithms that are supported by the
4622: .Nm dgst
4623: command.
4624: The default is SHA-1.
4625: .It Fl no_nonce
1.72 jmc 4626: Specify no nonce in the request.
4627: The default, to include a 64-bit long pseudo-random nonce,
4628: is recommended to protect against replay attacks.
1.1 jsing 4629: .It Fl out Ar request.tsq
1.72 jmc 4630: The output file to write to,
4631: or standard output if not specified.
1.1 jsing 4632: .It Fl policy Ar object_id
4633: The policy that the client expects the TSA to use for creating the
4634: time stamp token.
1.72 jmc 4635: Either dotted OID notation or OID names defined
1.1 jsing 4636: in the config file can be used.
1.72 jmc 4637: If no policy is requested the TSA uses its own default policy.
1.1 jsing 4638: .It Fl text
1.72 jmc 4639: Output in human-readable text format instead of DER.
1.1 jsing 4640: .El
4641: .Pp
4642: A time stamp response (TimeStampResp) consists of a response status
4643: and the time stamp token itself (ContentInfo),
4644: if the token generation was successful.
4645: The
4646: .Fl reply
4647: command is for creating a time stamp
4648: response or time stamp token based on a request and printing the
4649: response/token in human-readable format.
4650: If
4651: .Fl token_out
4652: is not specified the output is always a time stamp response (TimeStampResp),
4653: otherwise it is a time stamp token (ContentInfo).
4654: .Bl -tag -width Ds
4655: .It Fl chain Ar certs_file.pem
1.72 jmc 4656: The collection of PEM certificates
1.1 jsing 4657: that will be included in the response
4658: in addition to the signer certificate if the
4659: .Fl cert
4660: option was used for the request.
4661: This file is supposed to contain the certificate chain
4662: for the signer certificate from its issuer upwards.
4663: The
4664: .Fl reply
4665: command does not build a certificate chain automatically.
4666: .It Fl config Ar configfile
1.72 jmc 4667: Specify an alternative configuration file.
1.1 jsing 4668: .It Fl in Ar response.tsr
1.72 jmc 4669: Specify a previously created time stamp response (or time stamp token, if
1.1 jsing 4670: .Fl token_in
1.72 jmc 4671: is also specified)
1.1 jsing 4672: in DER format that will be written to the output file.
4673: This option does not require a request;
4674: it is useful, for example,
1.72 jmc 4675: to examine the content of a response or token
4676: or to extract the time stamp token from a response.
1.1 jsing 4677: If the input is a token and the output is a time stamp response a default
1.72 jmc 4678: .Qq granted
1.1 jsing 4679: status info is added to the token.
4680: .It Fl inkey Ar private.pem
4681: The signer private key of the TSA in PEM format.
4682: Overrides the
4683: .Cm signer_key
4684: config file option.
4685: .It Fl out Ar response.tsr
4686: The response is written to this file.
4687: The format and content of the file depends on other options (see
4688: .Fl text
4689: and
4690: .Fl token_out ) .
4691: The default is stdout.
4692: .It Fl passin Ar arg
4693: The key password source.
4694: .It Fl policy Ar object_id
1.72 jmc 4695: The default policy to use for the response.
4696: Either dotted OID notation or OID names defined
4697: in the config file can be used.
4698: If no policy is requested the TSA uses its own default policy.
1.1 jsing 4699: .It Fl queryfile Ar request.tsq
1.72 jmc 4700: The file containing a DER-encoded time stamp request.
1.1 jsing 4701: .It Fl section Ar tsa_section
1.72 jmc 4702: The config file section containing the settings for response generation.
1.1 jsing 4703: .It Fl signer Ar tsa_cert.pem
1.72 jmc 4704: The PEM signer certificate of the TSA.
1.1 jsing 4705: The TSA signing certificate must have exactly one extended key usage
4706: assigned to it: timeStamping.
4707: The extended key usage must also be critical,
4708: otherwise the certificate is going to be refused.
4709: Overrides the
4710: .Cm signer_cert
4711: variable of the config file.
4712: .It Fl text
1.72 jmc 4713: Output in human-readable text format instead of DER.
1.1 jsing 4714: .It Fl token_in
1.72 jmc 4715: The input is a DER-encoded time stamp token (ContentInfo)
4716: instead of a time stamp response (TimeStampResp).
1.1 jsing 4717: .It Fl token_out
1.72 jmc 4718: The output is a time stamp token (ContentInfo)
4719: instead of a time stamp response (TimeStampResp).
1.1 jsing 4720: .El
4721: .Pp
4722: The
4723: .Fl verify
4724: command is for verifying if a time stamp response or time stamp token
4725: is valid and matches a particular time stamp request or data file.
4726: The
4727: .Fl verify
4728: command does not use the configuration file.
4729: .Bl -tag -width Ds
4730: .It Fl CAfile Ar trusted_certs.pem
1.72 jmc 4731: The file containing a set of trusted self-signed PEM CA certificates.
4732: See
1.1 jsing 4733: .Nm verify
4734: for additional details.
4735: Either this option or
4736: .Fl CApath
4737: must be specified.
4738: .It Fl CApath Ar trusted_cert_path
1.72 jmc 4739: The directory containing the trused CA certificates of the client.
4740: See
1.1 jsing 4741: .Nm verify
4742: for additional details.
4743: Either this option or
4744: .Fl CAfile
4745: must be specified.
4746: .It Fl data Ar file_to_hash
4747: The response or token must be verified against
4748: .Ar file_to_hash .
4749: The file is hashed with the message digest algorithm specified in the token.
4750: The
4751: .Fl digest
4752: and
4753: .Fl queryfile
4754: options must not be specified with this one.
4755: .It Fl digest Ar digest_bytes
4756: The response or token must be verified against the message digest specified
4757: with this option.
4758: The number of bytes must match the message digest algorithm
4759: specified in the token.
4760: The
4761: .Fl data
4762: and
4763: .Fl queryfile
4764: options must not be specified with this one.
4765: .It Fl in Ar response.tsr
4766: The time stamp response that needs to be verified, in DER format.
4767: This option in mandatory.
4768: .It Fl queryfile Ar request.tsq
4769: The original time stamp request, in DER format.
4770: The
4771: .Fl data
4772: and
4773: .Fl digest
4774: options must not be specified with this one.
4775: .It Fl token_in
1.72 jmc 4776: The input is a DER-encoded time stamp token (ContentInfo)
4777: instead of a time stamp response (TimeStampResp).
1.1 jsing 4778: .It Fl untrusted Ar cert_file.pem
1.72 jmc 4779: Additional untrusted PEM certificates which may be needed
4780: when building the certificate chain for the TSA's signing certificate.
1.1 jsing 4781: This file must contain the TSA signing certificate and
4782: all intermediate CA certificates unless the response includes them.
4783: .El
4784: .Pp
1.72 jmc 4785: Options specified on the command line always override
4786: the settings in the config file:
1.1 jsing 4787: .Bl -tag -width Ds
4788: .It Cm tsa Ar section , Cm default_tsa
4789: This is the main section and it specifies the name of another section
4790: that contains all the options for the
4791: .Fl reply
4792: option.
1.72 jmc 4793: This section can be overridden with the
1.1 jsing 4794: .Fl section
4795: command line switch.
4796: .It Cm oid_file
4797: See
4798: .Nm ca
4799: for a description.
4800: .It Cm oid_section
4801: See
4802: .Nm ca
4803: for a description.
4804: .It Cm serial
1.72 jmc 4805: The file containing the hexadecimal serial number of the
1.1 jsing 4806: last time stamp response created.
4807: This number is incremented by 1 for each response.
1.72 jmc 4808: If the file does not exist at the time of response generation
4809: a new file is created with serial number 1.
1.1 jsing 4810: This parameter is mandatory.
4811: .It Cm signer_cert
4812: TSA signing certificate, in PEM format.
4813: The same as the
4814: .Fl signer
4815: command line option.
4816: .It Cm certs
1.72 jmc 4817: A set of PEM-encoded certificates that need to be
1.1 jsing 4818: included in the response.
4819: The same as the
4820: .Fl chain
4821: command line option.
4822: .It Cm signer_key
4823: The private key of the TSA, in PEM format.
4824: The same as the
4825: .Fl inkey
4826: command line option.
4827: .It Cm default_policy
4828: The default policy to use when the request does not mandate any policy.
4829: The same as the
4830: .Fl policy
4831: command line option.
4832: .It Cm other_policies
4833: Comma separated list of policies that are also acceptable by the TSA
4834: and used only if the request explicitly specifies one of them.
4835: .It Cm digests
4836: The list of message digest algorithms that the TSA accepts.
4837: At least one algorithm must be specified.
4838: This parameter is mandatory.
4839: .It Cm accuracy
4840: The accuracy of the time source of the TSA in seconds, milliseconds
4841: and microseconds.
4842: For example, secs:1, millisecs:500, microsecs:100.
4843: If any of the components is missing,
4844: zero is assumed for that field.
4845: .It Cm clock_precision_digits
1.72 jmc 4846: The maximum number of digits, which represent the fraction of seconds,
4847: that need to be included in the time field.
1.1 jsing 4848: The trailing zeroes must be removed from the time,
1.72 jmc 4849: so there might actually be fewer digits
1.1 jsing 4850: or no fraction of seconds at all.
4851: The maximum value is 6;
4852: the default is 0.
4853: .It Cm ordering
4854: If this option is yes,
4855: the responses generated by this TSA can always be ordered,
4856: even if the time difference between two responses is less
4857: than the sum of their accuracies.
4858: The default is no.
4859: .It Cm tsa_name
4860: Set this option to yes if the subject name of the TSA must be included in
4861: the TSA name field of the response.
4862: The default is no.
4863: .It Cm ess_cert_id_chain
4864: The SignedData objects created by the TSA always contain the
4865: certificate identifier of the signing certificate in a signed
4866: attribute (see RFC 2634, Enhanced Security Services).
4867: If this option is set to yes and either the
4868: .Cm certs
4869: variable or the
4870: .Fl chain
4871: option is specified then the certificate identifiers of the chain will also
4872: be included in the SigningCertificate signed attribute.
4873: If this variable is set to no,
4874: only the signing certificate identifier is included.
4875: The default is no.
4876: .El
4877: .Sh VERIFY
4878: .nr nS 1
4879: .Nm "openssl verify"
4880: .Op Fl CAfile Ar file
4881: .Op Fl CApath Ar directory
4882: .Op Fl check_ss_sig
4883: .Op Fl crl_check
4884: .Op Fl crl_check_all
4885: .Op Fl explicit_policy
4886: .Op Fl extended_crl
4887: .Op Fl help
4888: .Op Fl ignore_critical
4889: .Op Fl inhibit_any
4890: .Op Fl inhibit_map
4891: .Op Fl issuer_checks
4892: .Op Fl policy_check
4893: .Op Fl purpose Ar purpose
4894: .Op Fl untrusted Ar file
4895: .Op Fl verbose
4896: .Op Fl x509_strict
4897: .Op Ar certificates
4898: .nr nS 0
4899: .Pp
4900: The
4901: .Nm verify
4902: command verifies certificate chains.
4903: .Pp
4904: The options are as follows:
4905: .Bl -tag -width Ds
4906: .It Fl check_ss_sig
4907: Verify the signature on the self-signed root CA.
4908: This is disabled by default
4909: because it doesn't add any security.
4910: .It Fl CAfile Ar file
4911: A
4912: .Ar file
4913: of trusted certificates.
4914: The
4915: .Ar file
4916: should contain multiple certificates in PEM format, concatenated together.
4917: .It Fl CApath Ar directory
4918: A
4919: .Ar directory
4920: of trusted certificates.
1.76 jmc 4921: The certificates, or symbolic links to them,
4922: should have names of the form
4923: .Ar hash Ns .0 ,
4924: where
4925: .Ar hash
4926: is the hashed certificate subject name
4927: (see the
1.1 jsing 4928: .Fl hash
4929: option of the
4930: .Nm x509
4931: utility).
4932: .It Fl crl_check
1.76 jmc 4933: Check end entity certificate validity by attempting to look up a valid CRL.
1.1 jsing 4934: If a valid CRL cannot be found an error occurs.
4935: .It Fl crl_check_all
1.76 jmc 4936: Check the validity of all certificates in the chain by attempting
1.1 jsing 4937: to look up valid CRLs.
4938: .It Fl explicit_policy
1.76 jmc 4939: Set policy variable require-explicit-policy (RFC 3280).
1.1 jsing 4940: .It Fl extended_crl
4941: Enable extended CRL features such as indirect CRLs and alternate CRL
4942: signing keys.
4943: .It Fl help
1.76 jmc 4944: Print a usage message.
1.1 jsing 4945: .It Fl ignore_critical
1.76 jmc 4946: Ignore critical extensions instead of rejecting the certificate.
1.1 jsing 4947: .It Fl inhibit_any
1.76 jmc 4948: Set policy variable inhibit-any-policy (RFC 3280).
1.1 jsing 4949: .It Fl inhibit_map
1.76 jmc 4950: Set policy variable inhibit-policy-mapping (RFC 3280).
1.1 jsing 4951: .It Fl issuer_checks
1.76 jmc 4952: Print diagnostics relating to searches for the issuer certificate
4953: of the current certificate
4954: showing why each candidate issuer certificate was rejected.
4955: The presence of rejection messages
4956: does not itself imply that anything is wrong:
4957: during the normal verify process several rejections may take place.
1.1 jsing 4958: .It Fl policy_check
1.76 jmc 4959: Enable certificate policy processing.
1.1 jsing 4960: .It Fl purpose Ar purpose
4961: The intended use for the certificate.
4962: Without this option no chain verification will be done.
4963: Currently accepted uses are
1.76 jmc 4964: .Cm sslclient , sslserver ,
4965: .Cm nssslserver , smimesign ,
4966: .Cm smimeencrypt , crlsign ,
4967: .Cm any ,
1.1 jsing 4968: and
1.76 jmc 4969: .Cm ocsphelper .
1.1 jsing 4970: .It Fl untrusted Ar file
4971: A
4972: .Ar file
4973: of untrusted certificates.
4974: The
4975: .Ar file
4976: should contain multiple certificates.
4977: .It Fl verbose
4978: Print extra information about the operations being performed.
4979: .It Fl x509_strict
4980: Disable workarounds for broken certificates which have to be disabled
4981: for strict X.509 compliance.
4982: .It Ar certificates
1.76 jmc 4983: One or more PEM
1.1 jsing 4984: .Ar certificates
4985: to verify.
4986: If no certificate files are included, an attempt is made to read
4987: a certificate from standard input.
1.76 jmc 4988: If the first certificate filename begins with a dash,
4989: use a lone dash to mark the last option.
1.1 jsing 4990: .El
1.76 jmc 4991: .Pp
1.1 jsing 4992: The
4993: .Nm verify
4994: program uses the same functions as the internal SSL and S/MIME verification,
1.76 jmc 4995: with one crucial difference:
4996: wherever possible an attempt is made to continue after an error,
4997: whereas normally the verify operation would halt on the first error.
1.1 jsing 4998: This allows all the problems with a certificate chain to be determined.
4999: .Pp
1.76 jmc 5000: The verify operation consists of a number of separate steps.
1.1 jsing 5001: Firstly a certificate chain is built up starting from the supplied certificate
5002: and ending in the root CA.
5003: It is an error if the whole chain cannot be built up.
5004: The chain is built up by looking up the issuer's certificate of the current
5005: certificate.
5006: If a certificate is found which is its own issuer, it is assumed
5007: to be the root CA.
5008: .Pp
1.76 jmc 5009: All certificates whose subject name matches the issuer name
1.1 jsing 5010: of the current certificate are subject to further tests.
5011: The relevant authority key identifier components of the current certificate
1.76 jmc 5012: (if present) must match the subject key identifier (if present)
5013: and issuer and serial number of the candidate issuer;
5014: in addition the
5015: .Cm keyUsage
5016: extension of the candidate issuer (if present) must permit certificate signing.
1.1 jsing 5017: .Pp
5018: The lookup first looks in the list of untrusted certificates and if no match
5019: is found the remaining lookups are from the trusted certificates.
1.76 jmc 5020: The root CA is always looked up in the trusted certificate list:
5021: if the certificate to verify is a root certificate,
5022: then an exact match must be found in the trusted list.
1.1 jsing 5023: .Pp
5024: The second operation is to check every untrusted certificate's extensions for
5025: consistency with the supplied purpose.
5026: If the
5027: .Fl purpose
5028: option is not included, then no checks are done.
5029: The supplied or
5030: .Qq leaf
5031: certificate must have extensions compatible with the supplied purpose
5032: and all other certificates must also be valid CA certificates.
5033: The precise extensions required are described in more detail in
5034: the
1.76 jmc 5035: .Nm X509
1.1 jsing 5036: section below.
5037: .Pp
5038: The third operation is to check the trust settings on the root CA.
5039: The root CA should be trusted for the supplied purpose.
1.76 jmc 5040: A certificate with no trust settings is considered to be valid for
1.1 jsing 5041: all purposes.
5042: .Pp
5043: The final operation is to check the validity of the certificate chain.
5044: The validity period is checked against the current system time and the
1.76 jmc 5045: .Cm notBefore
1.1 jsing 5046: and
1.76 jmc 5047: .Cm notAfter
1.1 jsing 5048: dates in the certificate.
5049: The certificate signatures are also checked at this point.
5050: .Pp
5051: If all operations complete successfully, the certificate is considered
5052: valid.
5053: If any operation fails then the certificate is not valid.
5054: When a verify operation fails, the output messages can be somewhat cryptic.
5055: The general form of the error message is:
1.76 jmc 5056: .Bd -literal
5057: server.pem: /C=AU/ST=Queensland/O=CryptSoft Pty Ltd/CN=Test CA (1024-bit)
5058: error 24 at 1 depth lookup:invalid CA certificate
1.1 jsing 5059: .Ed
5060: .Pp
5061: The first line contains the name of the certificate being verified, followed by
5062: the subject name of the certificate.
5063: The second line contains the error number and the depth.
5064: The depth is the number of the certificate being verified when a
5065: problem was detected starting with zero for the certificate being verified
5066: itself, then 1 for the CA that signed the certificate and so on.
5067: Finally a text version of the error number is presented.
5068: .Pp
5069: An exhaustive list of the error codes and messages is shown below; this also
5070: includes the name of the error code as defined in the header file
1.12 bentley 5071: .In openssl/x509_vfy.h .
1.76 jmc 5072: Some of the error codes are defined but never returned: these are described as
1.1 jsing 5073: .Qq unused .
5074: .Bl -tag -width "XXXX"
1.78 jmc 5075: .It 0 X509_V_OK
1.1 jsing 5076: The operation was successful.
1.78 jmc 5077: .It 2 X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT
5078: The issuer certificate of an untrusted certificate could not be found.
5079: .It 3 X509_V_ERR_UNABLE_TO_GET_CRL
1.1 jsing 5080: The CRL of a certificate could not be found.
1.78 jmc 5081: .It 4 X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE
1.1 jsing 5082: The certificate signature could not be decrypted.
1.78 jmc 5083: This means that the actual signature value could not be determined
5084: rather than it not matching the expected value.
1.1 jsing 5085: This is only meaningful for RSA keys.
1.78 jmc 5086: .It 5 X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE
5087: The CRL signature could not be decrypted.
5088: This means that the actual signature value could not be determined
5089: rather than it not matching the expected value.
1.1 jsing 5090: Unused.
1.78 jmc 5091: .It 6 X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY
1.1 jsing 5092: The public key in the certificate
1.76 jmc 5093: .Cm SubjectPublicKeyInfo
1.1 jsing 5094: could not be read.
1.78 jmc 5095: .It 7 X509_V_ERR_CERT_SIGNATURE_FAILURE
1.1 jsing 5096: The signature of the certificate is invalid.
1.78 jmc 5097: .It 8 X509_V_ERR_CRL_SIGNATURE_FAILURE
1.1 jsing 5098: The signature of the certificate is invalid.
1.78 jmc 5099: .It 9 X509_V_ERR_CERT_NOT_YET_VALID
1.1 jsing 5100: The certificate is not yet valid: the
1.76 jmc 5101: .Cm notBefore
1.1 jsing 5102: date is after the current time.
1.78 jmc 5103: .It 10 X509_V_ERR_CERT_HAS_EXPIRED
1.1 jsing 5104: The certificate has expired; that is, the
1.76 jmc 5105: .Cm notAfter
1.1 jsing 5106: date is before the current time.
1.78 jmc 5107: .It 11 X509_V_ERR_CRL_NOT_YET_VALID
1.1 jsing 5108: The CRL is not yet valid.
1.78 jmc 5109: .It 12 X509_V_ERR_CRL_HAS_EXPIRED
1.1 jsing 5110: The CRL has expired.
1.78 jmc 5111: .It 13 X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD
1.1 jsing 5112: The certificate
1.76 jmc 5113: .Cm notBefore
1.1 jsing 5114: field contains an invalid time.
1.78 jmc 5115: .It 14 X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD
1.1 jsing 5116: The certificate
1.76 jmc 5117: .Cm notAfter
1.1 jsing 5118: field contains an invalid time.
1.78 jmc 5119: .It 15 X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD
1.1 jsing 5120: The CRL
1.76 jmc 5121: .Cm lastUpdate
1.1 jsing 5122: field contains an invalid time.
1.78 jmc 5123: .It 16 X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD
1.1 jsing 5124: The CRL
1.76 jmc 5125: .Cm nextUpdate
1.1 jsing 5126: field contains an invalid time.
1.78 jmc 5127: .It 17 X509_V_ERR_OUT_OF_MEM
1.1 jsing 5128: An error occurred trying to allocate memory.
5129: This should never happen.
1.78 jmc 5130: .It 18 X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT
1.1 jsing 5131: The passed certificate is self-signed and the same certificate cannot be
5132: found in the list of trusted certificates.
1.78 jmc 5133: .It 19 X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN
1.1 jsing 5134: The certificate chain could be built up using the untrusted certificates but
5135: the root could not be found locally.
1.78 jmc 5136: .It 20 X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY
1.1 jsing 5137: The issuer certificate of a locally looked up certificate could not be found.
5138: This normally means the list of trusted certificates is not complete.
1.78 jmc 5139: .It 21 X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE
1.1 jsing 5140: No signatures could be verified because the chain contains only one
5141: certificate and it is not self-signed.
1.78 jmc 5142: .It 22 X509_V_ERR_CERT_CHAIN_TOO_LONG
1.1 jsing 5143: The certificate chain length is greater than the supplied maximum depth.
5144: Unused.
1.78 jmc 5145: .It 23 X509_V_ERR_CERT_REVOKED
1.1 jsing 5146: The certificate has been revoked.
1.78 jmc 5147: .It 24 X509_V_ERR_INVALID_CA
1.1 jsing 5148: A CA certificate is invalid.
5149: Either it is not a CA or its extensions are not consistent
5150: with the supplied purpose.
1.78 jmc 5151: .It 25 X509_V_ERR_PATH_LENGTH_EXCEEDED
1.1 jsing 5152: The
1.76 jmc 5153: .Cm basicConstraints
1.1 jsing 5154: pathlength parameter has been exceeded.
1.78 jmc 5155: .It 26 X509_V_ERR_INVALID_PURPOSE
1.1 jsing 5156: The supplied certificate cannot be used for the specified purpose.
1.78 jmc 5157: .It 27 X509_V_ERR_CERT_UNTRUSTED
1.1 jsing 5158: The root CA is not marked as trusted for the specified purpose.
1.78 jmc 5159: .It 28 X509_V_ERR_CERT_REJECTED
1.1 jsing 5160: The root CA is marked to reject the specified purpose.
1.78 jmc 5161: .It 29 X509_V_ERR_SUBJECT_ISSUER_MISMATCH
1.1 jsing 5162: The current candidate issuer certificate was rejected because its subject name
5163: did not match the issuer name of the current certificate.
5164: Only displayed when the
5165: .Fl issuer_checks
5166: option is set.
1.78 jmc 5167: .It 30 X509_V_ERR_AKID_SKID_MISMATCH
1.1 jsing 5168: The current candidate issuer certificate was rejected because its subject key
5169: identifier was present and did not match the authority key identifier current
5170: certificate.
5171: Only displayed when the
5172: .Fl issuer_checks
5173: option is set.
1.78 jmc 5174: .It 31 X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH
1.1 jsing 5175: The current candidate issuer certificate was rejected because its issuer name
5176: and serial number were present and did not match the authority key identifier
5177: of the current certificate.
5178: Only displayed when the
5179: .Fl issuer_checks
5180: option is set.
1.78 jmc 5181: .It 32 X509_V_ERR_KEYUSAGE_NO_CERTSIGN
1.1 jsing 5182: The current candidate issuer certificate was rejected because its
1.76 jmc 5183: .Cm keyUsage
1.1 jsing 5184: extension does not permit certificate signing.
1.78 jmc 5185: .It 50 X509_V_ERR_APPLICATION_VERIFICATION
1.1 jsing 5186: An application specific error.
5187: Unused.
5188: .El
5189: .Sh VERSION
5190: .Nm openssl version
5191: .Op Fl abdfopv
5192: .Pp
5193: The
5194: .Nm version
5195: command is used to print out version information about
1.79 jmc 5196: .Nm openssl .
1.1 jsing 5197: .Pp
5198: The options are as follows:
5199: .Bl -tag -width Ds
5200: .It Fl a
5201: All information: this is the same as setting all the other flags.
5202: .It Fl b
5203: The date the current version of
1.79 jmc 5204: .Nm openssl
1.1 jsing 5205: was built.
5206: .It Fl d
5207: .Ev OPENSSLDIR
5208: setting.
5209: .It Fl f
5210: Compilation flags.
5211: .It Fl o
5212: Option information: various options set when the library was built.
5213: .It Fl p
5214: Platform setting.
5215: .It Fl v
5216: The current
1.79 jmc 5217: .Nm openssl
1.1 jsing 5218: version.
5219: .El
5220: .Sh X509
5221: .nr nS 1
5222: .Nm "openssl x509"
5223: .Op Fl C
5224: .Op Fl addreject Ar arg
5225: .Op Fl addtrust Ar arg
5226: .Op Fl alias
5227: .Op Fl CA Ar file
5228: .Op Fl CAcreateserial
1.80 jmc 5229: .Op Fl CAform Cm der | pem
1.1 jsing 5230: .Op Fl CAkey Ar file
1.80 jmc 5231: .Op Fl CAkeyform Cm der | pem
1.1 jsing 5232: .Op Fl CAserial Ar file
5233: .Op Fl certopt Ar option
5234: .Op Fl checkend Ar arg
5235: .Op Fl clrext
5236: .Op Fl clrreject
5237: .Op Fl clrtrust
5238: .Op Fl dates
5239: .Op Fl days Ar arg
5240: .Op Fl email
5241: .Op Fl enddate
5242: .Op Fl extensions Ar section
5243: .Op Fl extfile Ar file
5244: .Op Fl fingerprint
5245: .Op Fl hash
5246: .Op Fl in Ar file
1.80 jmc 5247: .Op Fl inform Cm der | net | pem
1.1 jsing 5248: .Op Fl issuer
5249: .Op Fl issuer_hash
5250: .Op Fl issuer_hash_old
1.80 jmc 5251: .Op Fl keyform Cm der | pem
1.29 bcook 5252: .Op Fl md5 | sha1
1.1 jsing 5253: .Op Fl modulus
5254: .Op Fl nameopt Ar option
5255: .Op Fl noout
5256: .Op Fl ocsp_uri
5257: .Op Fl ocspid
5258: .Op Fl out Ar file
1.80 jmc 5259: .Op Fl outform Cm der | net | pem
1.1 jsing 5260: .Op Fl passin Ar arg
5261: .Op Fl pubkey
5262: .Op Fl purpose
5263: .Op Fl req
5264: .Op Fl serial
5265: .Op Fl set_serial Ar n
5266: .Op Fl setalias Ar arg
5267: .Op Fl signkey Ar file
5268: .Op Fl startdate
5269: .Op Fl subject
5270: .Op Fl subject_hash
5271: .Op Fl subject_hash_old
5272: .Op Fl text
5273: .Op Fl trustout
5274: .Op Fl x509toreq
5275: .nr nS 0
5276: .Pp
5277: The
5278: .Nm x509
5279: command is a multi-purpose certificate utility.
5280: It can be used to display certificate information, convert certificates to
5281: various forms, sign certificate requests like a
5282: .Qq mini CA ,
5283: or edit certificate trust settings.
5284: .Pp
1.80 jmc 5285: The following are x509 input, output, and general purpose options:
1.1 jsing 5286: .Bl -tag -width "XXXX"
5287: .It Fl in Ar file
1.80 jmc 5288: The input file to read from,
5289: or standard input if not specified.
5290: .It Fl inform Cm der | net | pem
5291: The input format.
1.1 jsing 5292: Normally, the command will expect an X.509 certificate,
5293: but this can change if other options such as
5294: .Fl req
5295: are present.
1.29 bcook 5296: .It Fl md5 | sha1
1.1 jsing 5297: The digest to use.
5298: This affects any signing or display option that uses a message digest,
5299: such as the
5300: .Fl fingerprint , signkey ,
5301: and
5302: .Fl CA
5303: options.
5304: If not specified, MD5 is used.
1.80 jmc 5305: SHA1 is always used with DSA keys.
1.1 jsing 5306: .It Fl out Ar file
1.80 jmc 5307: The output file to write to,
5308: or standard output if none is specified.
5309: .It Fl outform Cm der | net | pem
5310: The output format.
1.1 jsing 5311: .It Fl passin Ar arg
5312: The key password source.
5313: .El
1.80 jmc 5314: .Pp
5315: The following are x509 display options:
1.1 jsing 5316: .Bl -tag -width "XXXX"
5317: .It Fl C
1.80 jmc 5318: Output the certificate in the form of a C source file.
1.1 jsing 5319: .It Fl certopt Ar option
5320: Customise the output format used with
1.80 jmc 5321: .Fl text ,
5322: either using a list of comma-separated options or by specifying
1.1 jsing 5323: .Fl certopt
1.80 jmc 5324: multiple times.
5325: The default behaviour is to print all fields.
5326: The options are as follows:
5327: .Pp
5328: .Bl -tag -width "no_extensions" -offset indent -compact
5329: .It Cm ca_default
5330: Equivalent to
5331: .Cm no_issuer , no_pubkey , no_header ,
5332: .Cm no_version , no_sigdump ,
5333: and
5334: .Cm no_signame .
5335: .It Cm compatible
5336: Equivalent to no output options at all.
5337: .It Cm ext_default
5338: Print unsupported certificate extensions.
5339: .It Cm ext_dump
5340: Hex dump unsupported extensions.
5341: .It Cm ext_error
5342: Print an error message for unsupported certificate extensions.
5343: .It Cm ext_parse
1.84 jmc 5344: ASN.1 parse unsupported extensions.
1.80 jmc 5345: .It Cm no_aux
5346: Do not print certificate trust information.
5347: .It Cm no_extensions
5348: Do not print X509V3 extensions.
5349: .It Cm no_header
5350: Do not print header (Certificate and Data) information.
5351: .It Cm no_issuer
5352: Do not print the issuer name.
5353: .It Cm no_pubkey
5354: Do not print the public key.
5355: .It Cm no_serial
5356: Do not print the serial number.
5357: .It Cm no_sigdump
5358: Do not give a hexadecimal dump of the certificate signature.
5359: .It Cm no_signame
5360: Do not print the signature algorithm used.
5361: .It Cm no_subject
5362: Do not print the subject name.
5363: .It Cm no_validity
5364: Do not print the
5365: .Cm notBefore
5366: and
5367: .Cm notAfter
5368: (validity) fields.
5369: .It Cm no_version
5370: Do not print the version number.
5371: .El
1.1 jsing 5372: .It Fl dates
1.80 jmc 5373: Print the start and expiry date of a certificate.
1.1 jsing 5374: .It Fl email
1.80 jmc 5375: Output the email addresses, if any.
1.1 jsing 5376: .It Fl enddate
1.80 jmc 5377: Print the expiry date of the certificate; that is, the
5378: .Cm notAfter
1.1 jsing 5379: date.
5380: .It Fl fingerprint
1.80 jmc 5381: Print the digest of the DER-encoded version of the whole certificate.
1.1 jsing 5382: .It Fl hash
5383: A synonym for
1.80 jmc 5384: .Fl subject_hash .
1.1 jsing 5385: .It Fl issuer
1.80 jmc 5386: Print the issuer name.
1.1 jsing 5387: .It Fl issuer_hash
1.80 jmc 5388: Print the hash of the certificate issuer name.
1.1 jsing 5389: .It Fl issuer_hash_old
1.80 jmc 5390: Print the hash of the certificate issuer name
5391: using the older algorithm as used by
5392: .Nm openssl
1.1 jsing 5393: versions before 1.0.0.
5394: .It Fl modulus
1.80 jmc 5395: Print the value of the modulus of the public key contained in the certificate.
1.1 jsing 5396: .It Fl nameopt Ar option
1.80 jmc 5397: Customise how the subject or issuer names are displayed,
5398: either using a list of comma-separated options or by specifying
1.1 jsing 5399: .Fl nameopt
1.80 jmc 5400: multiple times.
5401: The default behaviour is to use the
5402: .Cm oneline
5403: format.
5404: The options,
5405: which can be preceded by a dash to turn them off,
5406: are as follows:
5407: .Bl -tag -width "XXXX"
5408: .It Cm align
5409: Align field values for a more readable output.
5410: Only usable with
5411: .Ar sep_multiline .
5412: .It Cm compat
5413: Use the old format,
5414: equivalent to specifying no options at all.
5415: .It Cm dn_rev
5416: Reverse the fields of the DN, as required by RFC 2253.
5417: As a side effect, this also reverses the order of multiple AVAs.
5418: .It Cm dump_all
5419: Dump all fields.
5420: When used with
5421: .Ar dump_der ,
5422: it allows the DER encoding of the structure to be unambiguously determined.
5423: .It Cm dump_der
5424: Any fields that need to be hexdumped are
5425: dumped using the DER encoding of the field.
5426: Otherwise just the content octets will be displayed.
5427: Both options use the RFC 2253 #XXXX... format.
5428: .It Cm dump_nostr
5429: Dump non-character string types
5430: (for example OCTET STRING);
5431: usually, non-character string types are displayed
5432: as though each content octet represents a single character.
5433: .It Cm dump_unknown
5434: Dump any field whose OID is not recognised by
5435: .Nm openssl .
5436: .It Cm esc_2253
5437: Escape the
5438: .Qq special
5439: characters required by RFC 2253 in a field that is
5440: .Dq \& ,+"<>; .
5441: Additionally,
5442: .Sq #
5443: is escaped at the beginning of a string
5444: and a space character at the beginning or end of a string.
5445: .It Cm esc_ctrl
5446: Escape control characters.
5447: That is, those with ASCII values less than 0x20 (space)
5448: and the delete (0x7f) character.
5449: They are escaped using the RFC 2253 \eXX notation (where XX are two hex
5450: digits representing the character value).
5451: .It Cm esc_msb
5452: Escape characters with the MSB set; that is, with ASCII values larger than
5453: 127.
5454: .It Cm multiline
5455: A multiline format.
5456: Equivalent to
5457: .Cm esc_ctrl , esc_msb , sep_multiline ,
5458: .Cm space_eq , lname ,
5459: and
5460: .Cm align .
5461: .It Cm no_type
5462: Do not attempt to interpret multibyte characters.
5463: That is, content octets are merely dumped as though one octet
5464: represents each character.
5465: This is useful for diagnostic purposes
5466: but results in rather odd looking output.
5467: .It Cm nofname , sname , lname , oid
5468: Alter how the field name is displayed:
5469: .Cm nofname
5470: does not display the field at all;
5471: .Cm sname
5472: uses the short name form (CN for
5473: .Cm commonName ,
5474: for example);
5475: .Cm lname
5476: uses the long form.
5477: .Cm oid
5478: represents the OID in numerical form and is useful for diagnostic purpose.
5479: .It Cm oneline
5480: A one line format which is more readable than
5481: .Cm RFC2253 .
5482: Equivalent to
5483: .Cm esc_2253 , esc_ctrl , esc_msb , utf8 ,
5484: .Cm dump_nostr , dump_der , use_quote , sep_comma_plus_spc ,
5485: .Cm space_eq ,
5486: and
5487: .Cm sname .
5488: .It Cm RFC2253
5489: Displays names compatible with RFC 2253.
5490: Equivalent to
5491: .Cm esc_2253 , esc_ctrl ,
5492: .Cm esc_msb , utf8 , dump_nostr , dump_unknown ,
5493: .Cm dump_der , sep_comma_plus , dn_rev ,
5494: and
5495: .Cm sname .
5496: .It Cm sep_comma_plus , sep_comma_plus_space , sep_semi_plus_space , sep_multiline
5497: Determine the field separators:
5498: the first character is between RDNs and the second between multiple AVAs
5499: (multiple AVAs are very rare and their use is discouraged).
5500: The options ending in
5501: .Qq space
5502: additionally place a space after the separator to make it more readable.
5503: .Cm sep_multiline
5504: uses a linefeed character for the RDN separator and a spaced
5505: .Sq +
5506: for the AVA separator,
5507: as well as indenting the fields by four characters.
5508: .It Cm show_type
1.84 jmc 5509: Show the type of the ASN.1 character string.
1.80 jmc 5510: The type precedes the field contents.
5511: For example
5512: .Qq BMPSTRING: Hello World .
5513: .It Cm space_eq
5514: Place spaces round the
5515: .Sq =
5516: character which follows the field name.
5517: .It Cm use_quote
5518: Escape some characters by surrounding the whole string with
5519: .Sq \&"
5520: characters.
5521: Without the option, all escaping is done with the
5522: .Sq \e
5523: character.
5524: .It Cm utf8
5525: Convert all strings to UTF8 format first, as required by RFC 2253.
5526: On a UTF8 compatible terminal,
5527: the use of this option (and not setting
5528: .Cm esc_msb )
5529: may result in the correct display of multibyte characters.
5530: Usually, multibyte characters larger than 0xff
5531: are represented using the format \eUXXXX for 16 bits and \eWXXXXXXXX
5532: for 32 bits,
5533: and any UTF8Strings are converted to their character form first.
5534: .El
1.1 jsing 5535: .It Fl noout
1.80 jmc 5536: Do not output the encoded version of the request.
1.1 jsing 5537: .It Fl ocsp_uri
1.80 jmc 5538: Print the OCSP responder addresses, if any.
1.1 jsing 5539: .It Fl ocspid
5540: Print OCSP hash values for the subject name and public key.
5541: .It Fl pubkey
1.80 jmc 5542: Print the public key.
1.1 jsing 5543: .It Fl serial
1.80 jmc 5544: Print the certificate serial number.
1.1 jsing 5545: .It Fl startdate
1.80 jmc 5546: Print the start date of the certificate; that is, the
5547: .Cm notBefore
1.1 jsing 5548: date.
5549: .It Fl subject
1.80 jmc 5550: Print the subject name.
1.1 jsing 5551: .It Fl subject_hash
1.80 jmc 5552: Print the hash of the certificate subject name.
1.1 jsing 5553: This is used in
1.80 jmc 5554: .Nm openssl
1.1 jsing 5555: to form an index to allow certificates in a directory to be looked up
5556: by subject name.
5557: .It Fl subject_hash_old
1.80 jmc 5558: Print the hash of the certificate subject name
5559: using the older algorithm as used by
5560: .Nm openssl
1.1 jsing 5561: versions before 1.0.0.
5562: .It Fl text
1.80 jmc 5563: Print the full certificate in text form.
1.1 jsing 5564: .El
5565: .Pp
1.80 jmc 5566: A trusted certificate is a certificate which has several
1.1 jsing 5567: additional pieces of information attached to it such as the permitted
1.80 jmc 5568: and prohibited uses of the certificate and an alias.
5569: When a certificate is being verified at least one certificate must be trusted.
5570: By default, a trusted certificate must be stored locally and be a root CA.
5571: The following are x509 trust settings options:
1.1 jsing 5572: .Bl -tag -width "XXXX"
5573: .It Fl addreject Ar arg
1.80 jmc 5574: Add a prohibited use.
5575: Accepts the same values as the
1.1 jsing 5576: .Fl addtrust
5577: option.
5578: .It Fl addtrust Ar arg
1.80 jmc 5579: Add a trusted certificate use.
1.1 jsing 5580: Any object name can be used here, but currently only
1.80 jmc 5581: .Cm clientAuth
5582: (SSL client use),
5583: .Cm serverAuth
5584: (SSL server use),
5585: and
5586: .Cm emailProtection
5587: (S/MIME email) are used.
1.1 jsing 5588: .It Fl alias
1.80 jmc 5589: Output the certificate alias.
1.1 jsing 5590: .It Fl clrreject
1.80 jmc 5591: Clear all the prohibited or rejected uses of the certificate.
1.1 jsing 5592: .It Fl clrtrust
1.80 jmc 5593: Clear all the permitted or trusted uses of the certificate.
1.1 jsing 5594: .It Fl purpose
1.80 jmc 5595: Perform tests on the certificate extensions.
5596: The same code is used when verifying untrusted certificates in chains,
5597: so this section is useful if a chain is rejected by the verify code.
5598: .Pp
5599: The
5600: .Cm basicConstraints
5601: extension CA flag is used to determine whether the
5602: certificate can be used as a CA.
5603: If the CA flag is true, it is a CA;
5604: if the CA flag is false, it is not a CA.
5605: All CAs should have the CA flag set to true.
5606: .Pp
5607: If the
5608: .Cm basicConstraints
5609: extension is absent, then the certificate is
5610: considered to be a possible CA;
5611: other extensions are checked according to the intended use of the certificate.
5612: A warning is given in this case because the certificate should really not
5613: be regarded as a CA.
5614: However it is allowed to be a CA to work around some broken software.
5615: .Pp
5616: If the certificate is a V1 certificate
5617: (and thus has no extensions) and it is self-signed,
5618: it is also assumed to be a CA but a warning is again given.
5619: This is to work around the problem of Verisign roots
5620: which are V1 self-signed certificates.
5621: .Pp
5622: If the
5623: .Cm keyUsage
5624: extension is present, then additional restraints are
5625: made on the uses of the certificate.
5626: A CA certificate must have the
5627: .Cm keyCertSign
5628: bit set if the
5629: .Cm keyUsage
5630: extension is present.
5631: .Pp
5632: The extended key usage extension places additional restrictions on the
5633: certificate uses.
5634: If this extension is present, whether critical or not,
5635: the key can only be used for the purposes specified.
5636: .Pp
5637: A complete description of each test is given below.
5638: The comments about
5639: .Cm basicConstraints
5640: and
5641: .Cm keyUsage
5642: and V1 certificates above apply to all CA certificates.
5643: .Bl -tag -width "XXXX"
5644: .It SSL Client
5645: The extended key usage extension must be absent or include the
5646: web client authentication OID.
5647: .Cm keyUsage
5648: must be absent or it must have the
5649: .Cm digitalSignature
5650: bit set.
5651: The Netscape certificate type must be absent
5652: or it must have the SSL client bit set.
5653: .It SSL Client CA
5654: The extended key usage extension must be absent or include the
5655: web client authentication OID.
5656: The Netscape certificate type must be absent
5657: or it must have the SSL CA bit set:
5658: this is used as a workaround if the
5659: .Cm basicConstraints
5660: extension is absent.
5661: .It SSL Server
5662: The extended key usage extension must be absent or include the
5663: web server authentication and/or one of the SGC OIDs.
5664: .Cm keyUsage
5665: must be absent or it must have the
5666: .Cm digitalSignature
5667: set, the
5668: .Cm keyEncipherment
5669: set, or both bits set.
5670: The Netscape certificate type must be absent or have the SSL server bit set.
5671: .It SSL Server CA
5672: The extended key usage extension must be absent or include the
5673: web server authentication and/or one of the SGC OIDs.
5674: The Netscape certificate type must be absent or the SSL CA bit must be set:
5675: this is used as a workaround if the
5676: .Cm basicConstraints
5677: extension is absent.
5678: .It Netscape SSL Server
5679: For Netscape SSL clients to connect to an SSL server; it must have the
5680: .Cm keyEncipherment
5681: bit set if the
5682: .Cm keyUsage
5683: extension is present.
5684: This isn't always valid because some cipher suites use the key for
5685: digital signing.
5686: Otherwise it is the same as a normal SSL server.
5687: .It Common S/MIME Client Tests
5688: The extended key usage extension must be absent or include the
5689: email protection OID.
5690: The Netscape certificate type must be absent or should have the S/MIME bit set.
5691: If the S/MIME bit is not set in Netscape certificate type, then the SSL
5692: client bit is tolerated as an alternative but a warning is shown:
5693: this is because some Verisign certificates don't set the S/MIME bit.
5694: .It S/MIME Signing
5695: In addition to the common S/MIME client tests, the
5696: .Cm digitalSignature
5697: bit must be set if the
5698: .Cm keyUsage
5699: extension is present.
5700: .It S/MIME Encryption
5701: In addition to the common S/MIME tests, the
5702: .Cm keyEncipherment
5703: bit must be set if the
5704: .Cm keyUsage
5705: extension is present.
5706: .It S/MIME CA
5707: The extended key usage extension must be absent or include the
5708: email protection OID.
5709: The Netscape certificate type must be absent
5710: or must have the S/MIME CA bit set:
5711: this is used as a workaround if the
5712: .Cm basicConstraints
5713: extension is absent.
5714: .It CRL Signing
5715: The
5716: .Cm keyUsage
5717: extension must be absent or it must have the CRL signing bit set.
5718: .It CRL Signing CA
5719: The normal CA tests apply, except the
5720: .Cm basicConstraints
5721: extension must be present.
5722: .El
1.1 jsing 5723: .It Fl setalias Ar arg
1.80 jmc 5724: Set the alias of the certificate,
5725: allowing the certificate to be referred to using a nickname,
5726: such as
1.1 jsing 5727: .Qq Steve's Certificate .
5728: .It Fl trustout
1.80 jmc 5729: Output a trusted certificate
5730: (the default if any trust settings are modified).
1.1 jsing 5731: An ordinary or trusted certificate can be input, but by default an ordinary
5732: certificate is output and any trust settings are discarded.
5733: .El
1.80 jmc 5734: .Pp
1.1 jsing 5735: The
5736: .Nm x509
1.80 jmc 5737: utility can be used to sign certificates and requests:
5738: it can thus behave like a mini CA.
5739: The following are x509 signing options:
1.1 jsing 5740: .Bl -tag -width "XXXX"
5741: .It Fl CA Ar file
1.80 jmc 5742: The CA certificate to be used for signing.
1.1 jsing 5743: When this option is present,
5744: .Nm x509
1.80 jmc 5745: behaves like a mini CA.
1.1 jsing 5746: The input file is signed by the CA using this option;
5747: that is, its issuer name is set to the subject name of the CA and it is
5748: digitally signed using the CA's private key.
5749: .Pp
5750: This option is normally combined with the
5751: .Fl req
5752: option.
5753: Without the
5754: .Fl req
5755: option, the input is a certificate which must be self-signed.
5756: .It Fl CAcreateserial
1.80 jmc 5757: Create the CA serial number file if it does not exist
5758: instead of generating an error.
5759: The file will contain the serial number
1.1 jsing 5760: .Sq 02
5761: and the certificate being signed will have
5762: .Sq 1
5763: as its serial number.
1.80 jmc 5764: .It Fl CAform Cm der | pem
1.1 jsing 5765: The format of the CA certificate file.
5766: The default is
1.80 jmc 5767: .Cm pem .
1.1 jsing 5768: .It Fl CAkey Ar file
1.80 jmc 5769: Set the CA private key to sign a certificate with.
5770: Otherwise it is assumed that the CA private key is present
5771: in the CA certificate file.
5772: .It Fl CAkeyform Cm der | pem
1.1 jsing 5773: The format of the CA private key.
5774: The default is
1.80 jmc 5775: .Cm pem .
1.1 jsing 5776: .It Fl CAserial Ar file
1.80 jmc 5777: Use the serial number in
5778: .Ar file
5779: to sign a certificate.
5780: The file should consist of one line containing an even number of hex digits
1.1 jsing 5781: with the serial number to use.
5782: After each use the serial number is incremented and written out
5783: to the file again.
5784: .Pp
5785: The default filename consists of the CA certificate file base name with
5786: .Pa .srl
5787: appended.
5788: For example, if the CA certificate file is called
5789: .Pa mycacert.pem ,
5790: it expects to find a serial number file called
5791: .Pa mycacert.srl .
5792: .It Fl checkend Ar arg
5793: Check whether the certificate expires in the next
5794: .Ar arg
5795: seconds.
5796: If so, exit with return value 1;
5797: otherwise exit with return value 0.
5798: .It Fl clrext
5799: Delete any extensions from a certificate.
5800: This option is used when a certificate is being created from another
5801: certificate (for example with the
5802: .Fl signkey
5803: or the
5804: .Fl CA
5805: options).
5806: Normally, all extensions are retained.
5807: .It Fl days Ar arg
1.80 jmc 5808: The number of days to make a certificate valid for.
1.1 jsing 5809: The default is 30 days.
5810: .It Fl extensions Ar section
5811: The section to add certificate extensions from.
5812: If this option is not specified, the extensions should either be
1.80 jmc 5813: contained in the unnamed (default) section
5814: or the default section should contain a variable called
1.1 jsing 5815: .Qq extensions
5816: which contains the section to use.
5817: .It Fl extfile Ar file
5818: File containing certificate extensions to use.
5819: If not specified, no extensions are added to the certificate.
1.80 jmc 5820: .It Fl keyform Cm der | pem
5821: The format of the private key file used in the
1.1 jsing 5822: .Fl signkey
5823: option.
5824: .It Fl req
1.80 jmc 5825: Expect a certificate request on input instead of a certificate.
1.1 jsing 5826: .It Fl set_serial Ar n
1.80 jmc 5827: The serial number to use.
1.1 jsing 5828: This option can be used with either the
5829: .Fl signkey
5830: or
5831: .Fl CA
5832: options.
5833: If used in conjunction with the
5834: .Fl CA
5835: option, the serial number file (as specified by the
5836: .Fl CAserial
5837: or
5838: .Fl CAcreateserial
5839: options) is not used.
5840: .Pp
5841: The serial number can be decimal or hex (if preceded by
5842: .Sq 0x ) .
5843: Negative serial numbers can also be specified but their use is not recommended.
5844: .It Fl signkey Ar file
1.80 jmc 5845: Self-sign
5846: .Ar file
5847: using the supplied private key.
1.1 jsing 5848: .Pp
5849: If the input file is a certificate, it sets the issuer name to the
1.80 jmc 5850: subject name (i.e. makes it self-signed),
1.1 jsing 5851: changes the public key to the supplied value,
5852: and changes the start and end dates.
5853: The start date is set to the current time and the end date is set to
5854: a value determined by the
5855: .Fl days
5856: option.
5857: Any certificate extensions are retained unless the
5858: .Fl clrext
5859: option is supplied.
5860: .Pp
5861: If the input is a certificate request, a self-signed certificate
5862: is created using the supplied private key using the subject name in
5863: the request.
5864: .It Fl x509toreq
1.80 jmc 5865: Convert a certificate into a certificate request.
1.1 jsing 5866: The
5867: .Fl signkey
5868: option is used to pass the required private key.
5869: .El
1.38 jmc 5870: .Sh COMMON NOTATION
5871: Several commands share a common syntax,
5872: as detailed below.
5873: .Pp
5874: Password arguments, typically specified using
1.33 jmc 5875: .Fl passin
5876: and
5877: .Fl passout
1.38 jmc 5878: for input and output passwords,
5879: allow passwords to be obtained from a variety of sources.
5880: Both of these options take a single argument, described below.
1.33 jmc 5881: If no password argument is given and a password is required,
5882: then the user is prompted to enter one:
5883: this will typically be read from the current terminal with echoing turned off.
1.38 jmc 5884: .Bl -tag -width "pass:password" -offset indent
5885: .It Cm pass : Ns Ar password
1.33 jmc 5886: The actual password is
5887: .Ar password .
1.38 jmc 5888: Since the password is visible to utilities,
1.33 jmc 5889: this form should only be used where security is not important.
1.38 jmc 5890: .It Cm env : Ns Ar var
1.33 jmc 5891: Obtain the password from the environment variable
5892: .Ar var .
1.38 jmc 5893: Since the environment of other processes is visible,
5894: this option should be used with caution.
5895: .It Cm file : Ns Ar path
1.33 jmc 5896: The first line of
5897: .Ar path
5898: is the password.
5899: If the same
5900: .Ar path
5901: argument is supplied to
5902: .Fl passin
5903: and
5904: .Fl passout ,
5905: then the first line will be used for the input password and the next line
5906: for the output password.
5907: .Ar path
5908: need not refer to a regular file:
5909: it could, for example, refer to a device or named pipe.
1.38 jmc 5910: .It Cm fd : Ns Ar number
1.33 jmc 5911: Read the password from the file descriptor
5912: .Ar number .
1.38 jmc 5913: This can be used to send the data via a pipe, for example.
5914: .It Cm stdin
1.33 jmc 5915: Read the password from standard input.
1.35 jmc 5916: .El
1.38 jmc 5917: .Pp
1.64 jmc 5918: Input/output formats,
1.38 jmc 5919: typically specified using
5920: .Fl inform
5921: and
5922: .Fl outform ,
1.64 jmc 5923: indicate the format being read from or written to.
1.38 jmc 5924: The argument is case insensitive.
5925: .Pp
5926: .Bl -tag -width Ds -offset indent -compact
5927: .It Cm der
5928: Distinguished Encoding Rules (DER)
5929: is a binary format.
1.64 jmc 5930: .It Cm net
5931: Insecure legacy format.
1.38 jmc 5932: .It Cm pem
5933: Privacy Enhanced Mail (PEM)
5934: is base64-encoded.
1.70 jmc 5935: .It Cm smime
5936: An SMIME format message.
1.38 jmc 5937: .It Cm txt
5938: Plain ASCII text.
5939: .El
1.35 jmc 5940: .Sh ENVIRONMENT
5941: The following environment variables affect the execution of
5942: .Nm openssl :
1.38 jmc 5943: .Bl -tag -width "/etc/ssl/openssl.cnf"
1.35 jmc 5944: .It Ev OPENSSL_CONF
5945: The location of the master configuration file.
1.33 jmc 5946: .El
1.1 jsing 5947: .Sh FILES
5948: .Bl -tag -width "/etc/ssl/openssl.cnf" -compact
1.17 sobrado 5949: .It Pa /etc/ssl/
1.1 jsing 5950: Default config directory for
5951: .Nm openssl .
1.17 sobrado 5952: .It Pa /etc/ssl/lib/
1.1 jsing 5953: Unused.
1.17 sobrado 5954: .It Pa /etc/ssl/private/
1.1 jsing 5955: Default private key directory.
1.17 sobrado 5956: .It Pa /etc/ssl/openssl.cnf
1.1 jsing 5957: Default configuration file for
5958: .Nm openssl .
1.17 sobrado 5959: .It Pa /etc/ssl/x509v3.cnf
1.1 jsing 5960: Default configuration file for
5961: .Nm x509
5962: certificates.
5963: .El
5964: .Sh SEE ALSO
1.74 jmc 5965: .Xr acme-client 1 ,
1.26 jmc 5966: .Xr nc 1 ,
1.90 schwarze 5967: .Xr openssl.cnf 5 ,
5968: .Xr x509v3.cnf 5 ,
1.1 jsing 5969: .Xr ssl 8 ,
5970: .Xr starttls 8
5971: .Sh STANDARDS
5972: .Rs
5973: .%A T. Dierks
5974: .%A C. Allen
5975: .%D January 1999
5976: .%R RFC 2246
5977: .%T The TLS Protocol Version 1.0
5978: .Re
5979: .Pp
5980: .Rs
5981: .%A M. Wahl
5982: .%A S. Killie
5983: .%A T. Howes
5984: .%D December 1997
5985: .%R RFC 2253
5986: .%T Lightweight Directory Access Protocol (v3): UTF-8 String Representation of Distinguished Names
5987: .Re
5988: .Pp
5989: .Rs
5990: .%A B. Kaliski
5991: .%D March 1998
5992: .%R RFC 2315
5993: .%T PKCS #7: Cryptographic Message Syntax Version 1.5
5994: .Re
5995: .Pp
5996: .Rs
5997: .%A R. Housley
5998: .%A W. Ford
5999: .%A W. Polk
6000: .%A D. Solo
6001: .%D January 1999
6002: .%R RFC 2459
6003: .%T Internet X.509 Public Key Infrastructure Certificate and CRL Profile
6004: .Re
6005: .Pp
6006: .Rs
6007: .%A M. Myers
6008: .%A R. Ankney
6009: .%A A. Malpani
6010: .%A S. Galperin
6011: .%A C. Adams
6012: .%D June 1999
6013: .%R RFC 2560
6014: .%T X.509 Internet Public Key Infrastructure Online Certificate Status Protocol \(en OCSP
6015: .Re
6016: .Pp
6017: .Rs
6018: .%A R. Housley
6019: .%D June 1999
6020: .%R RFC 2630
6021: .%T Cryptographic Message Syntax
6022: .Re
6023: .Pp
6024: .Rs
6025: .%A P. Chown
6026: .%D June 2002
6027: .%R RFC 3268
1.24 jmc 6028: .%T Advanced Encryption Standard (AES) Ciphersuites for Transport Layer Security (TLS)
1.1 jsing 6029: .Re