Annotation of src/usr.bin/openssl/openssl.1, Revision 1.138
1.138 ! tb 1: .\" $OpenBSD: openssl.1,v 1.137 2022/03/31 17:27:26 naddy 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.138 ! tb 113: .Dd $Mdocdate: March 31 2022 $
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.
1.120 kn 203: .Tg asn1parse
1.1 jsing 204: .Sh ASN1PARSE
1.114 jmc 205: .Bl -hang -width "openssl asn1parse"
206: .It Nm openssl asn1parse
207: .Bk -words
1.1 jsing 208: .Op Fl i
209: .Op Fl dlimit Ar number
210: .Op Fl dump
211: .Op Fl genconf Ar file
212: .Op Fl genstr Ar str
213: .Op Fl in Ar file
1.34 jmc 214: .Op Fl inform Cm der | pem | txt
1.1 jsing 215: .Op Fl length Ar number
216: .Op Fl noout
217: .Op Fl offset Ar number
218: .Op Fl oid Ar file
219: .Op Fl out Ar file
220: .Op Fl strparse Ar offset
1.114 jmc 221: .Ek
222: .El
1.1 jsing 223: .Pp
224: The
225: .Nm asn1parse
226: command is a diagnostic utility that can parse ASN.1 structures.
227: It can also be used to extract data from ASN.1 formatted data.
228: .Pp
229: The options are as follows:
230: .Bl -tag -width Ds
231: .It Fl dlimit Ar number
232: Dump the first
233: .Ar number
234: bytes of unknown data in hex form.
235: .It Fl dump
236: Dump unknown data in hex form.
237: .It Fl genconf Ar file , Fl genstr Ar str
238: Generate encoded data based on string
239: .Ar str ,
240: file
241: .Ar file ,
1.34 jmc 242: or both, using the format described in
243: .Xr ASN1_generate_nconf 3 .
1.1 jsing 244: If only
245: .Ar file
246: is present then the string is obtained from the default section
247: using the name
248: .Dq asn1 .
1.84 jmc 249: The encoded data is passed through the ASN.1 parser and printed out as
1.1 jsing 250: though it came from a file;
251: the contents can thus be examined and written to a file using the
252: .Fl out
253: option.
254: .It Fl i
1.34 jmc 255: Indent the output according to the
1.1 jsing 256: .Qq depth
257: of the structures.
258: .It Fl in Ar file
1.41 jmc 259: The input file to read from, or standard input if not specified.
1.34 jmc 260: .It Fl inform Cm der | pem | txt
1.1 jsing 261: The input format.
262: .It Fl length Ar number
1.34 jmc 263: Number of bytes to parse; the default is until end of file.
1.1 jsing 264: .It Fl noout
1.46 jmc 265: Do not output the parsed version of the input file.
1.1 jsing 266: .It Fl offset Ar number
1.34 jmc 267: Starting offset to begin parsing; the default is start of file.
1.1 jsing 268: .It Fl oid Ar file
269: A file containing additional object identifiers
270: .Pq OIDs .
271: If an OID
272: .Pq object identifier
273: is not part of
1.34 jmc 274: .Nm openssl Ns 's
1.137 naddy 275: internal table, it will be represented in
1.1 jsing 276: numerical form
277: .Pq for example 1.2.3.4 .
1.34 jmc 278: .Pp
1.1 jsing 279: Each line consists of three columns:
280: the first column is the OID in numerical format and should be followed by
281: whitespace.
282: The second column is the
1.34 jmc 283: .Qq short name ,
1.1 jsing 284: which is a single word followed by whitespace.
285: The final column is the rest of the line and is the
286: .Qq long name .
287: .Nm asn1parse
288: displays the long name.
1.34 jmc 289: .It Fl out Ar file
290: The DER-encoded output file; the default is no encoded output
291: (useful when combined with
292: .Fl strparse ) .
293: .It Fl strparse Ar offset
294: Parse the content octets of the ASN.1 object starting at
295: .Ar offset .
296: This option can be used multiple times to
297: .Qq drill down
298: into a nested structure.
299: .El
1.120 kn 300: .Tg ca
1.1 jsing 301: .Sh CA
1.114 jmc 302: .Bl -hang -width "openssl ca"
303: .It Nm openssl ca
304: .Bk -words
1.1 jsing 305: .Op Fl batch
306: .Op Fl cert Ar file
307: .Op Fl config Ar file
1.91 schwarze 308: .Op Fl create_serial
1.1 jsing 309: .Op Fl crl_CA_compromise Ar time
310: .Op Fl crl_compromise Ar time
311: .Op Fl crl_hold Ar instruction
312: .Op Fl crl_reason Ar reason
313: .Op Fl crldays Ar days
314: .Op Fl crlexts Ar section
315: .Op Fl crlhours Ar hours
1.103 inoguchi 316: .Op Fl crlsec Ar seconds
1.1 jsing 317: .Op Fl days Ar arg
318: .Op Fl enddate Ar date
319: .Op Fl extensions Ar section
1.103 inoguchi 320: .Op Fl extfile Ar file
1.1 jsing 321: .Op Fl gencrl
322: .Op Fl in Ar file
323: .Op Fl infiles
1.91 schwarze 324: .Op Fl key Ar password
1.103 inoguchi 325: .Op Fl keyfile Ar file
1.91 schwarze 326: .Op Fl keyform Cm pem | der
1.103 inoguchi 327: .Op Fl md Ar alg
1.1 jsing 328: .Op Fl msie_hack
1.107 inoguchi 329: .Op Fl multivalue-rdn
1.1 jsing 330: .Op Fl name Ar section
331: .Op Fl noemailDN
332: .Op Fl notext
333: .Op Fl out Ar file
1.103 inoguchi 334: .Op Fl outdir Ar directory
1.1 jsing 335: .Op Fl passin Ar arg
336: .Op Fl policy Ar arg
337: .Op Fl preserveDN
338: .Op Fl revoke Ar file
1.91 schwarze 339: .Op Fl selfsign
1.103 inoguchi 340: .Op Fl sigopt Ar nm:v
1.1 jsing 341: .Op Fl spkac Ar file
342: .Op Fl ss_cert Ar file
343: .Op Fl startdate Ar date
344: .Op Fl status Ar serial
345: .Op Fl subj Ar arg
346: .Op Fl updatedb
1.91 schwarze 347: .Op Fl utf8
1.1 jsing 348: .Op Fl verbose
1.114 jmc 349: .Ek
350: .El
1.1 jsing 351: .Pp
352: The
353: .Nm ca
1.35 jmc 354: command is a minimal certificate authority (CA) application.
1.1 jsing 355: It can be used to sign certificate requests in a variety of forms
1.35 jmc 356: and generate certificate revocation lists (CRLs).
1.1 jsing 357: It also maintains a text database of issued certificates and their status.
358: .Pp
1.35 jmc 359: The options relevant to CAs are as follows:
1.1 jsing 360: .Bl -tag -width "XXXX"
361: .It Fl batch
1.41 jmc 362: Batch mode.
1.1 jsing 363: In this mode no questions will be asked
364: and all certificates will be certified automatically.
365: .It Fl cert Ar file
366: The CA certificate file.
367: .It Fl config Ar file
1.72 jmc 368: Specify an alternative configuration file.
1.91 schwarze 369: .It Fl create_serial
370: If reading the serial from the text file as specified in the
371: configuration fails, create a new random serial to be used as the
372: next serial number.
1.1 jsing 373: .It Fl days Ar arg
374: The number of days to certify the certificate for.
375: .It Fl enddate Ar date
1.41 jmc 376: Set the expiry date.
1.88 jmc 377: The format of the date is [YY]YYMMDDHHMMSSZ,
378: with all four year digits required for dates from 2050 onwards.
1.1 jsing 379: .It Fl extensions Ar section
380: The section of the configuration file containing certificate extensions
381: to be added when a certificate is issued (defaults to
1.35 jmc 382: .Cm x509_extensions
1.1 jsing 383: unless the
384: .Fl extfile
385: option is used).
386: If no extension section is present, a V1 certificate is created.
387: If the extension section is present
388: .Pq even if it is empty ,
389: then a V3 certificate is created.
1.91 schwarze 390: See the
391: .Xr x509v3.cnf 5
392: manual page for details of the extension section format.
1.1 jsing 393: .It Fl extfile Ar file
394: An additional configuration
395: .Ar file
396: to read certificate extensions from
397: (using the default section unless the
398: .Fl extensions
399: option is also used).
400: .It Fl in Ar file
401: An input
402: .Ar file
403: containing a single certificate request to be signed by the CA.
404: .It Fl infiles
405: If present, this should be the last option; all subsequent arguments
406: are assumed to be the names of files containing certificate requests.
1.91 schwarze 407: .It Fl key Ar password
408: The
409: .Fa password
410: used to encrypt the private key.
1.35 jmc 411: Since on some systems the command line arguments are visible,
412: this option should be used with caution.
1.1 jsing 413: .It Fl keyfile Ar file
414: The private key to sign requests with.
1.91 schwarze 415: .It Fl keyform Cm pem | der
1.1 jsing 416: Private key file format.
1.91 schwarze 417: The default is
418: .Cm pem .
1.1 jsing 419: .It Fl md Ar alg
420: The message digest to use.
421: Possible values include
422: .Ar md5
423: and
424: .Ar sha1 .
425: This option also applies to CRLs.
426: .It Fl msie_hack
427: This is a legacy option to make
428: .Nm ca
429: work with very old versions of the IE certificate enrollment control
430: .Qq certenr3 .
431: It used UniversalStrings for almost everything.
432: Since the old control has various security bugs,
433: its use is strongly discouraged.
434: The newer control
435: .Qq Xenroll
436: does not need this option.
1.107 inoguchi 437: .It Fl multivalue-rdn
1.91 schwarze 438: This option causes the
439: .Fl subj
440: argument to be interpreted with full support for multivalued RDNs,
441: for example
442: .Qq "/DC=org/DC=OpenSSL/DC=users/UID=123456+CN=John Doe" .
443: If
1.107 inoguchi 444: .Fl multivalue-rdn
1.91 schwarze 445: is not used, the UID value is set to
446: .Qq "123456+CN=John Doe" .
1.1 jsing 447: .It Fl name Ar section
448: Specifies the configuration file
449: .Ar section
450: to use (overrides
451: .Cm default_ca
452: in the
453: .Cm ca
454: section).
455: .It Fl noemailDN
456: The DN of a certificate can contain the EMAIL field if present in the
1.30 mmcc 457: request DN, however it is good policy just having the email set into
1.1 jsing 458: the
1.35 jmc 459: .Cm altName
1.1 jsing 460: extension of the certificate.
461: When this option is set, the EMAIL field is removed from the certificate's
462: subject and set only in the, eventually present, extensions.
463: The
464: .Ar email_in_dn
465: keyword can be used in the configuration file to enable this behaviour.
466: .It Fl notext
467: Don't output the text form of a certificate to the output file.
468: .It Fl out Ar file
469: The output file to output certificates to.
470: The default is standard output.
1.91 schwarze 471: The certificate details will also be printed out to this file in
472: PEM format, except that
473: .Fl spkac
474: outputs DER format.
1.1 jsing 475: .It Fl outdir Ar directory
476: The
477: .Ar directory
478: to output certificates to.
479: The certificate will be written to a file consisting of the
480: serial number in hex with
481: .Qq .pem
482: appended.
483: .It Fl passin Ar arg
484: The key password source.
485: .It Fl policy Ar arg
1.41 jmc 486: Define the CA
1.1 jsing 487: .Qq policy
488: to use.
1.35 jmc 489: The policy section in the configuration file
490: consists of a set of variables corresponding to certificate DN fields.
491: The values may be one of
492: .Qq match
493: (the value must match the same field in the CA certificate),
494: .Qq supplied
495: (the value must be present), or
496: .Qq optional
497: (the value may be present).
498: Any fields not mentioned in the policy section
499: are silently deleted, unless the
500: .Fl preserveDN
501: option is set,
502: but this can be regarded more of a quirk than intended behaviour.
1.1 jsing 503: .It Fl preserveDN
504: Normally, the DN order of a certificate is the same as the order of the
505: fields in the relevant policy section.
506: When this option is set, the order is the same as the request.
507: This is largely for compatibility with the older IE enrollment control
508: which would only accept certificates if their DNs matched the order of the
509: request.
510: This is not needed for Xenroll.
1.91 schwarze 511: .It Fl selfsign
512: Indicates the issued certificates are to be signed with the key the
513: certificate requests were signed with, given with
514: .Fl keyfile .
515: Certificate requests signed with a different key are ignored.
516: If
517: .Fl gencrl ,
518: .Fl spkac ,
519: or
520: .Fl ss_cert
521: are given,
522: .Fl selfsign
523: is ignored.
524: .Pp
525: A consequence of using
526: .Fl selfsign
527: is that the self-signed certificate appears among the entries in
528: the certificate database (see the configuration option
529: .Cm database )
530: and uses the same serial number counter as all other certificates
531: signed with the self-signed certificate.
1.103 inoguchi 532: .It Fl sigopt Ar nm:v
533: Pass options to the signature algorithm during sign or certify operations.
534: The names and values of these options are algorithm-specific.
1.1 jsing 535: .It Fl spkac Ar file
536: A file containing a single Netscape signed public key and challenge,
537: and additional field values to be signed by the CA.
1.35 jmc 538: This will usually come from the
539: KEYGEN tag in an HTML form to create a new private key.
540: It is, however, possible to create SPKACs using the
541: .Nm spkac
542: utility.
543: .Pp
544: The file should contain the variable SPKAC set to the value of
545: the SPKAC and also the required DN components as name value pairs.
546: If it's necessary to include the same component twice,
547: then it can be preceded by a number and a
548: .Sq \&. .
1.1 jsing 549: .It Fl ss_cert Ar file
550: A single self-signed certificate to be signed by the CA.
551: .It Fl startdate Ar date
1.41 jmc 552: Set the start date.
1.88 jmc 553: The format of the date is [YY]YYMMDDHHMMSSZ,
554: with all four year digits required for dates from 2050 onwards.
1.91 schwarze 555: .It Fl subj Ar arg
556: Supersedes the subject name given in the request.
557: The
558: .Ar arg
559: must be formatted as
560: .Sm off
561: .Pf / Ar type0 Ns = Ar value0 Ns / Ar type 1 Ns = Ar value 1 Ns /
562: .Ar type2 Ns = Ar ... ;
563: .Sm on
564: characters may be escaped by
565: .Sq \e
566: .Pq backslash ,
567: no spaces are skipped.
568: .It Fl utf8
569: Interpret field values read from a terminal or obtained from a
570: configuration file as UTF-8 strings.
571: By default, they are interpreted as ASCII.
1.1 jsing 572: .It Fl verbose
1.41 jmc 573: Print extra details about the operations being performed.
1.1 jsing 574: .El
1.35 jmc 575: .Pp
576: The options relevant to CRLs are as follows:
1.1 jsing 577: .Bl -tag -width "XXXX"
578: .It Fl crl_CA_compromise Ar time
579: This is the same as
580: .Fl crl_compromise ,
581: except the revocation reason is set to CACompromise.
582: .It Fl crl_compromise Ar time
1.41 jmc 583: Set the revocation reason to keyCompromise and the compromise time to
1.1 jsing 584: .Ar time .
585: .Ar time
586: should be in GeneralizedTime format, i.e. YYYYMMDDHHMMSSZ.
587: .It Fl crl_hold Ar instruction
1.41 jmc 588: Set the CRL revocation reason code to certificateHold and the hold
1.1 jsing 589: instruction to
590: .Ar instruction
591: which must be an OID.
592: Although any OID can be used, only holdInstructionNone
593: (the use of which is discouraged by RFC 2459), holdInstructionCallIssuer or
594: holdInstructionReject will normally be used.
595: .It Fl crl_reason Ar reason
596: Revocation reason, where
597: .Ar reason
598: is one of:
599: unspecified, keyCompromise, CACompromise, affiliationChanged, superseded,
600: cessationOfOperation, certificateHold or removeFromCRL.
601: The matching of
602: .Ar reason
603: is case insensitive.
604: Setting any revocation reason will make the CRL v2.
605: In practice, removeFromCRL is not particularly useful because it is only used
606: in delta CRLs which are not currently implemented.
1.103 inoguchi 607: .It Fl crldays Ar days
1.1 jsing 608: The number of days before the next CRL is due.
609: This is the days from now to place in the CRL
1.35 jmc 610: .Cm nextUpdate
1.1 jsing 611: field.
612: .It Fl crlexts Ar section
613: The
614: .Ar section
615: of the configuration file containing CRL extensions to include.
616: If no CRL extension section is present then a V1 CRL is created;
617: if the CRL extension section is present
1.81 jmc 618: (even if it is empty)
1.1 jsing 619: then a V2 CRL is created.
1.81 jmc 620: The CRL extensions specified are CRL extensions and not CRL entry extensions.
621: It should be noted that some software can't handle V2 CRLs.
1.91 schwarze 622: See the
623: .Xr x509v3.cnf 5
624: manual page for details of the extension section format.
1.103 inoguchi 625: .It Fl crlhours Ar hours
1.1 jsing 626: The number of hours before the next CRL is due.
1.103 inoguchi 627: .It Fl crlsec Ar seconds
628: The number of seconds before the next CRL is due.
1.1 jsing 629: .It Fl gencrl
1.41 jmc 630: Generate a CRL based on information in the index file.
1.1 jsing 631: .It Fl revoke Ar file
632: A
633: .Ar file
634: containing a certificate to revoke.
1.91 schwarze 635: .It Fl status Ar serial
636: Show the status of the certificate with serial number
637: .Ar serial .
638: .It Fl updatedb
639: Update the database index to purge expired certificates.
1.1 jsing 640: .El
641: .Pp
1.35 jmc 642: Many of the options can be set in the
643: .Cm ca
644: section of the configuration file
645: (or in the default section of the configuration file),
646: specified using
647: .Cm default_ca
648: or
649: .Fl name .
650: The options
651: .Cm preserve
652: and
653: .Cm msie_hack
654: are read directly from the
655: .Cm ca
656: section.
1.1 jsing 657: .Pp
658: Many of the configuration file options are identical to command line
659: options.
660: Where the option is present in the configuration file and the command line,
661: the command line value is used.
662: Where an option is described as mandatory, then it must be present in
663: the configuration file or the command line equivalent
664: .Pq if any
665: used.
666: .Bl -tag -width "XXXX"
1.35 jmc 667: .It Cm certificate
1.1 jsing 668: The same as
669: .Fl cert .
670: It gives the file containing the CA certificate.
671: Mandatory.
1.35 jmc 672: .It Cm copy_extensions
1.1 jsing 673: Determines how extensions in certificate requests should be handled.
674: If set to
1.35 jmc 675: .Cm none
1.1 jsing 676: or this option is not present, then extensions are
677: ignored and not copied to the certificate.
678: If set to
1.35 jmc 679: .Cm copy ,
1.1 jsing 680: then any extensions present in the request that are not already present
681: are copied to the certificate.
682: If set to
1.35 jmc 683: .Cm copyall ,
1.1 jsing 684: then all extensions in the request are copied to the certificate:
685: if the extension is already present in the certificate it is deleted first.
1.35 jmc 686: .Pp
687: The
688: .Cm copy_extensions
689: option should be used with caution.
690: If care is not taken, it can be a security risk.
691: For example, if a certificate request contains a
692: .Cm basicConstraints
693: extension with CA:TRUE and the
694: .Cm copy_extensions
695: value is set to
696: .Cm copyall
697: and the user does not spot
1.91 schwarze 698: this when the certificate is displayed, then this will hand the requester
1.35 jmc 699: a valid CA certificate.
700: .Pp
701: This situation can be avoided by setting
702: .Cm copy_extensions
703: to
704: .Cm copy
705: and including
706: .Cm basicConstraints
707: with CA:FALSE in the configuration file.
708: Then if the request contains a
709: .Cm basicConstraints
710: extension, it will be ignored.
1.1 jsing 711: .Pp
712: The main use of this option is to allow a certificate request to supply
713: values for certain extensions such as
1.35 jmc 714: .Cm subjectAltName .
715: .It Cm crl_extensions
1.1 jsing 716: The same as
717: .Fl crlexts .
1.35 jmc 718: .It Cm crlnumber
1.1 jsing 719: A text file containing the next CRL number to use in hex.
720: The CRL number will be inserted in the CRLs only if this file exists.
721: If this file is present, it must contain a valid CRL number.
1.35 jmc 722: .It Cm database
1.1 jsing 723: The text database file to use.
724: Mandatory.
725: This file must be present, though initially it will be empty.
1.35 jmc 726: .It Cm default_crl_hours , default_crl_days
1.1 jsing 727: The same as the
728: .Fl crlhours
729: and
730: .Fl crldays
731: options.
732: These will only be used if neither command line option is present.
733: At least one of these must be present to generate a CRL.
1.35 jmc 734: .It Cm default_days
1.1 jsing 735: The same as the
736: .Fl days
737: option.
738: The number of days to certify a certificate for.
1.35 jmc 739: .It Cm default_enddate
1.1 jsing 740: The same as the
741: .Fl enddate
742: option.
743: Either this option or
1.35 jmc 744: .Cm default_days
1.1 jsing 745: .Pq or the command line equivalents
746: must be present.
1.35 jmc 747: .It Cm default_md
1.1 jsing 748: The same as the
749: .Fl md
750: option.
751: The message digest to use.
752: Mandatory.
1.35 jmc 753: .It Cm default_startdate
1.1 jsing 754: The same as the
755: .Fl startdate
756: option.
757: The start date to certify a certificate for.
758: If not set, the current time is used.
1.35 jmc 759: .It Cm email_in_dn
1.1 jsing 760: The same as
761: .Fl noemailDN .
762: If the EMAIL field is to be removed from the DN of the certificate,
763: simply set this to
764: .Qq no .
765: If not present, the default is to allow for the EMAIL field in the
766: certificate's DN.
1.35 jmc 767: .It Cm msie_hack
1.1 jsing 768: The same as
769: .Fl msie_hack .
1.35 jmc 770: .It Cm name_opt , cert_opt
1.1 jsing 771: These options allow the format used to display the certificate details
772: when asking the user to confirm signing.
773: All the options supported by the
774: .Nm x509
775: utilities'
776: .Fl nameopt
777: and
778: .Fl certopt
779: switches can be used here, except that
1.35 jmc 780: .Cm no_signame
1.1 jsing 781: and
1.35 jmc 782: .Cm no_sigdump
1.1 jsing 783: are permanently set and cannot be disabled
784: (this is because the certificate signature cannot be displayed because
785: the certificate has not been signed at this point).
786: .Pp
787: For convenience, the value
1.35 jmc 788: .Cm ca_default
1.1 jsing 789: is accepted by both to produce a reasonable output.
790: .Pp
791: If neither option is present, the format used in earlier versions of
1.35 jmc 792: .Nm openssl
1.1 jsing 793: is used.
1.81 jmc 794: Use of the old format is strongly discouraged
795: because it only displays fields mentioned in the
1.35 jmc 796: .Cm policy
1.1 jsing 797: section,
798: mishandles multicharacter string types and does not display extensions.
1.35 jmc 799: .It Cm new_certs_dir
1.1 jsing 800: The same as the
801: .Fl outdir
802: command line option.
803: It specifies the directory where new certificates will be placed.
804: Mandatory.
1.35 jmc 805: .It Cm oid_file
1.1 jsing 806: This specifies a file containing additional object identifiers.
807: Each line of the file should consist of the numerical form of the
808: object identifier followed by whitespace, then the short name followed
809: by whitespace and finally the long name.
1.35 jmc 810: .It Cm oid_section
1.1 jsing 811: This specifies a section in the configuration file containing extra
812: object identifiers.
813: Each line should consist of the short name of the object identifier
814: followed by
815: .Sq =
816: and the numerical form.
817: The short and long names are the same when this option is used.
1.35 jmc 818: .It Cm policy
1.1 jsing 819: The same as
820: .Fl policy .
821: Mandatory.
1.35 jmc 822: .It Cm preserve
1.1 jsing 823: The same as
824: .Fl preserveDN .
1.35 jmc 825: .It Cm private_key
1.1 jsing 826: Same as the
827: .Fl keyfile
828: option.
829: The file containing the CA private key.
830: Mandatory.
1.35 jmc 831: .It Cm serial
1.1 jsing 832: A text file containing the next serial number to use in hex.
833: Mandatory.
834: This file must be present and contain a valid serial number.
1.35 jmc 835: .It Cm unique_subject
1.1 jsing 836: If the value
1.35 jmc 837: .Cm yes
1.1 jsing 838: is given, the valid certificate entries in the
839: database must have unique subjects.
840: If the value
1.35 jmc 841: .Cm no
1.1 jsing 842: is given,
843: several valid certificate entries may have the exact same subject.
844: The default value is
1.35 jmc 845: .Cm yes .
1.131 inoguchi 846: .Pp
847: Note that it is valid in some circumstances for certificates to be created
1.132 jmc 848: without any subject.
849: In cases where there are multiple certificates without
1.131 inoguchi 850: subjects this does not count as a duplicate.
1.35 jmc 851: .It Cm x509_extensions
1.1 jsing 852: The same as
853: .Fl extensions .
1.123 inoguchi 854: .El
855: .Tg certhash
856: .Sh CERTHASH
857: .Bl -hang -width "openssl certhash"
858: .It Nm openssl certhash
859: .Bk -words
860: .Op Fl nv
861: .Ar dir ...
862: .Ek
863: .El
864: .Pp
865: The
866: .Nm certhash
867: command calculates a hash value of
868: .Qq .pem
869: file in the specified directory list and creates symbolic links for each file,
870: where the name of the link is the hash value.
871: See the
872: .Xr SSL_CTX_load_verify_locations 3
873: manual page for how hash links are used.
874: .Pp
875: The links created are of the form
876: .Qq HHHHHHHH.D ,
877: where each
878: .Sq H
879: is a hexadecimal character and
880: .Sq D
881: is a single decimal digit.
882: The hashes for CRLs look similar, except the letter
883: .Sq r
884: appears after the period, like this:
885: .Qq HHHHHHHH.rD .
886: When processing a directory,
887: .Nm certhash
888: will first remove all links that have a name in that syntax and invalid
889: reference.
890: .Pp
891: Multiple objects may have the same hash; they will be indicated by
892: incrementing the
893: .Sq D
894: value.
895: Duplicates are found by comparing the full SHA256 fingerprint.
896: A warning will be displayed if a duplicate is found.
897: .Pp
898: A warning will also be displayed if there are files that cannot be parsed as
899: either a certificate or a CRL.
900: .Pp
901: The options are as follows:
902: .Bl -tag -width Ds
903: .It Fl n
904: Perform a dry-run, and do not make any changes.
905: .It Fl v
906: Print extra details about the processing.
907: .It Ar dir ...
908: Specify the directories to process.
1.1 jsing 909: .El
1.120 kn 910: .Tg ciphers
1.1 jsing 911: .Sh CIPHERS
912: .Nm openssl ciphers
1.138 ! tb 913: .Op Fl hsVv
1.93 schwarze 914: .Op Ar control
1.1 jsing 915: .Pp
916: The
917: .Nm ciphers
1.93 schwarze 918: command converts the
919: .Ar control
920: string from the format documented in
921: .Xr SSL_CTX_set_cipher_list 3
922: into an ordered SSL cipher suite preference list.
923: If no
924: .Ar control
925: string is specified, the
926: .Cm DEFAULT
927: list is printed.
1.1 jsing 928: .Pp
929: The options are as follows:
930: .Bl -tag -width Ds
931: .It Fl h , \&?
932: Print a brief usage message.
1.138 ! tb 933: .It Fl s
! 934: Only list ciphers that are supported by the TLS method.
1.1 jsing 935: .It Fl V
1.36 jmc 936: Verbose.
1.92 schwarze 937: List ciphers with cipher suite code in hex format,
938: cipher name, and a complete description of protocol version,
939: key exchange, authentication, encryption, and mac algorithms.
1.36 jmc 940: .It Fl v
1.1 jsing 941: Like
1.36 jmc 942: .Fl V ,
943: but without cipher suite codes.
1.116 inoguchi 944: .El
1.120 kn 945: .Tg cms
1.116 inoguchi 946: .Sh CMS
947: .Bl -hang -width "openssl cms"
948: .It Nm openssl cms
949: .Bk -words
950: .Oo
951: .Fl aes128 | aes192 | aes256 | camellia128 |
952: .Fl camellia192 | camellia256 | des | des3 |
953: .Fl rc2-40 | rc2-64 | rc2-128
954: .Oc
955: .Op Fl CAfile Ar file
956: .Op Fl CApath Ar directory
957: .Op Fl binary
958: .Op Fl certfile Ar file
959: .Op Fl certsout Ar file
960: .Op Fl cmsout
961: .Op Fl compress
962: .Op Fl content Ar file
963: .Op Fl crlfeol
964: .Op Fl data_create
965: .Op Fl data_out
966: .Op Fl debug_decrypt
967: .Op Fl decrypt
968: .Op Fl digest_create
969: .Op Fl digest_verify
970: .Op Fl econtent_type Ar type
971: .Op Fl encrypt
972: .Op Fl EncryptedData_decrypt
973: .Op Fl EncryptedData_encrypt
974: .Op Fl from Ar addr
975: .Op Fl in Ar file
976: .Op Fl inform Cm der | pem | smime
977: .Op Fl inkey Ar file
978: .Op Fl keyform Cm der | pem
979: .Op Fl keyid
980: .Op Fl keyopt Ar nm:v
981: .Op Fl md Ar digest
982: .Op Fl no_attr_verify
983: .Op Fl no_content_verify
984: .Op Fl no_signer_cert_verify
985: .Op Fl noattr
986: .Op Fl nocerts
987: .Op Fl nodetach
988: .Op Fl nointern
989: .Op Fl nooldmime
990: .Op Fl noout
991: .Op Fl nosigs
992: .Op Fl nosmimecap
993: .Op Fl noverify
994: .Op Fl out Ar file
995: .Op Fl outform Cm der | pem | smime
996: .Op Fl passin Ar src
997: .Op Fl print
998: .Op Fl pwri_password Ar arg
999: .Op Fl rctform Cm der | pem | smime
1000: .Op Fl receipt_request_all | receipt_request_first
1001: .Op Fl receipt_request_from Ar addr
1002: .Op Fl receipt_request_print
1003: .Op Fl receipt_request_to Ar addr
1004: .Op Fl recip Ar file
1005: .Op Fl resign
1006: .Op Fl secretkey Ar key
1007: .Op Fl secretkeyid Ar id
1008: .Op Fl sign
1009: .Op Fl sign_receipt
1010: .Op Fl signer Ar file
1011: .Op Fl stream | indef | noindef
1012: .Op Fl subject Ar s
1013: .Op Fl text
1014: .Op Fl to Ar addr
1015: .Op Fl uncompress
1016: .Op Fl verify
1017: .Op Fl verify_receipt Ar file
1018: .Op Fl verify_retcode
1019: .Op Ar cert.pem ...
1020: .Ek
1021: .El
1022: .Pp
1023: The
1024: .Nm cms
1025: command handles S/MIME v3.1 mail.
1026: It can encrypt, decrypt, sign and verify, compress and uncompress S/MIME
1027: messages.
1028: .Pp
1029: The MIME message must be sent without any blank lines between the headers and
1030: the output.
1031: Some mail programs will automatically add a blank line.
1032: Piping the mail directly to sendmail is one way to achieve the correct format.
1033: .Pp
1034: The supplied message to be signed or encrypted must include the necessary MIME
1035: headers or many S/MIME clients won't display it properly (if at all).
1036: You can use the
1037: .Fl text
1038: option to automatically add plain text headers.
1039: .Pp
1040: A "signed and encrypted" message is one where a signed message is then
1041: encrypted.
1042: This can be produced by encrypting an already signed message.
1043: .Pp
1044: There are various operation options that set the type of operation to be
1045: performed.
1046: The meaning of the other options varies according to the operation type.
1047: .Bl -tag -width "XXXX"
1048: .It Fl encrypt
1049: Encrypt mail for the given recipient certificates.
1050: Input file is the message to be encrypted.
1051: The output file is the encrypted mail in MIME format.
1052: The actual CMS type is EnvelopedData.
1053: Note that no revocation check is done for the recipient cert, so if that
1054: key has been compromised, others may be able to decrypt the text.
1055: .It Fl decrypt
1056: Decrypt mail using the supplied certificate and private key.
1057: Expects an encrypted mail message in MIME format for the input file.
1058: The decrypted mail is written to the output file.
1059: .It Fl sign
1060: Sign mail using the supplied certificate and private key.
1061: Input file is the message to be signed.
1062: The signed message in MIME format is written to the output file.
1063: .It Fl verify
1064: Verify signed mail.
1065: Expects a signed mail message on input and outputs the signed data.
1066: Both clear text and opaque signing are supported.
1067: .It Fl cmsout
1068: Take an input message and write out a PEM encoded CMS structure.
1069: .It Fl resign
1070: Resign a message.
1071: Take an existing message and one or more new signers.
1072: This operation uses an existing message digest when adding a new signer.
1073: This means that attributes must be present in at least one existing
1074: signer using the same message digest or this operation will fail.
1075: .It Fl data_create
1076: Create a CMS Data type.
1077: .It Fl data_out
1078: Output a content from the input CMS Data type.
1079: .It Fl digest_create
1080: Create a CMS DigestedData type.
1081: .It Fl digest_verify
1082: Verify a CMS DigestedData type and output the content.
1083: .It Fl compress
1084: Create a CMS CompressedData type.
1085: Must be compiled with zlib support for this option to work.
1086: .It Fl uncompress
1087: Uncompress a CMS CompressedData type and output the content.
1088: Must be compiled with zlib support for this option to work.
1089: .It Fl EncryptedData_encrypt
1090: Encrypt a content using supplied symmetric key and algorithm using a
1091: CMS EncryptedData type.
1092: .It Fl EncryptedData_decrypt
1093: Decrypt a CMS EncryptedData type using supplied symmetric key.
1094: .It Fl sign_receipt
1095: Generate and output a signed receipt for the supplied message.
1096: The input message must contain a signed receipt request.
1097: Functionality is otherwise similar to the
1098: .Fl sign
1099: operation.
1100: .It Xo
1101: .Fl verify_receipt Ar file
1102: .Xc
1103: Verify a signed receipt in file.
1104: The input message must contain the original receipt request.
1105: Functionality is otherwise similar to the
1106: .Fl verify
1107: operation.
1108: .El
1109: .Pp
1110: The remaining options are as follows:
1111: .Bl -tag -width "XXXX"
1112: .It Xo
1113: .Fl aes128 | aes192 | aes256 | camellia128 |
1114: .Fl camellia192 | camellia256 | des | des3 |
1115: .Fl rc2-40 | rc2-64 | rc2-128
1116: .Xc
1117: The encryption algorithm to use.
1118: 128-, 192-, or 256-bit AES, 128-, 192-, or 256-bit CAMELLIA,
1119: DES (56 bits), triple DES (168 bits),
1120: or 40-, 64-, or 128-bit RC2, respectively;
1121: if not specified, triple DES is
1122: used.
1123: Only used with
1124: .Fl encrypt
1125: and
1126: .Fl EncryptedData_encrypt
1127: commands.
1128: .It Fl binary
1129: Normally the input message is converted to "canonical" format which is
1130: effectively using CR/LF as end of line, as required by the S/MIME specification.
1.127 jmc 1131: When this option is present, no translation occurs.
1.116 inoguchi 1132: This is useful when handling binary data which may not be in MIME format.
1133: .It Fl CAfile Ar file
1134: A file containing trusted CA certificates, used with
1135: .Fl verify
1136: and
1137: .Fl verify_receipt .
1138: .It Fl CApath Ar directory
1139: A directory containing trusted CA certificates, used with
1140: .Fl verify
1141: and
1142: .Fl verify_receipt .
1143: This directory must be a standard certificate directory: that is a hash
1144: of each subject name (using
1145: .Nm x509 Fl hash )
1146: should be linked to each certificate.
1.124 inoguchi 1147: .It Ar cert.pem ...
1.116 inoguchi 1148: One or more certificates of message recipients: used when encrypting a message.
1149: .It Fl certfile Ar file
1150: Allows additional certificates to be specified.
1.137 naddy 1151: When signing, these will be included with the message.
1152: When verifying, these will be searched for the signer's certificates.
1.116 inoguchi 1153: The certificates should be in PEM format.
1154: .It Fl certsout Ar file
1155: A file that any certificates contained in the message are written to.
1156: .It Xo
1157: .Fl check_ss_sig ,
1158: .Fl crl_check ,
1159: .Fl crl_check_all ,
1160: .Fl extended_crl ,
1161: .Fl ignore_critical ,
1162: .Fl issuer_checks ,
1163: .Fl policy ,
1164: .Fl policy_check ,
1165: .Fl purpose ,
1166: .Fl x509_strict
1167: .Xc
1168: Set various certificate chain validation options.
1169: See the
1170: .Nm verify
1171: command for details.
1172: .It Fl content Ar file
1173: A file containing the detached content.
1174: This is only useful with the
1175: .Fl verify
1176: command.
1177: This is only usable if the CMS structure is using the detached signature
1178: form where the content is not included.
1179: This option will override any content if the input format is S/MIME and
1180: it uses the multipart/signed MIME content type.
1181: .It Fl crlfeol
1182: Output a S/MIME message with CR/LF end of line.
1183: .It Fl debug_decrypt
1184: Set the CMS_DEBUG_DECRYPT flag when decrypting.
1185: This option should be used with caution, since this can be used to disable
1186: the MMA attack protection and return an error if no recipient can be found.
1187: See the
1188: .Xr CMS_decrypt 3
1189: manual page for details of the flag.
1190: .It Xo
1191: .Fl from Ar addr ,
1192: .Fl subject Ar s ,
1193: .Fl to Ar addr
1194: .Xc
1195: The relevant mail headers.
1196: These are included outside the signed portion of a message so they may
1197: be included manually.
1198: If signing then many S/MIME mail clients check the signer's certificate's
1199: email address matches that specified in the From: address.
1200: .It Fl econtent_type Ar type
1201: Set the encapsulated content type, used with
1202: .Fl sign .
1.137 naddy 1203: If not supplied, the Data type is used.
1.116 inoguchi 1204: The type argument can be any valid OID name in either text or numerical format.
1205: .It Fl in Ar file
1206: The input message to be encrypted or signed or the message to be decrypted or
1207: verified.
1208: .It Fl inform Cm der | pem | smime
1209: The input format for the CMS structure.
1210: The default is
1211: .Cm smime ,
1212: which reads an S/MIME format message.
1213: .Cm pem
1214: and
1215: .Cm der
1216: format change this to expect PEM and DER format CMS structures instead.
1217: This currently only affects the input format of the CMS structure; if no
1218: CMS structure is being input (for example with
1219: .Fl encrypt
1220: or
1221: .Fl sign )
1222: this option has no effect.
1223: .It Fl inkey Ar file
1224: The private key to use when signing or decrypting.
1225: This must match the corresponding certificate.
1226: If this option is not specified then the private key must be included in
1227: the certificate file specified with the
1228: .Fl recip
1229: or
1230: .Fl signer
1231: file.
1.137 naddy 1232: When signing, this option can be used multiple times to specify successive keys.
1.116 inoguchi 1233: .It Fl keyform Cm der | pem
1234: Input private key format.
1235: The default is
1236: .Cm pem .
1237: .It Fl keyid
1238: Use subject key identifier to identify certificates instead of issuer
1239: name and serial number.
1240: The supplied certificate must include a subject key identifier extension.
1241: Supported by
1242: .Fl sign
1243: and
1244: .Fl encrypt
1245: operations.
1246: .It Fl keyopt Ar nm:v
1247: Set customised parameters for the preceding key or certificate
1248: for encryption and signing.
1249: It can currently be used to set RSA-PSS for signing, RSA-OAEP for
1250: encryption or to modify default parameters for ECDH.
1251: This option can be used multiple times.
1252: .It Fl md Ar digest
1253: The digest algorithm to use when signing or resigning.
1254: If not present then the default digest algorithm for the signing key
1255: will be used (usually SHA1).
1256: .It Fl no_attr_verify
1257: Do not verify the signer's attribute of a signature.
1258: .It Fl no_content_verify
1259: Do not verify the content of a signed message.
1260: .It Fl no_signer_cert_verify
1261: Do not verify the signer's certificate of a signed message.
1262: .It Fl noattr
1263: Do not include attributes.
1264: Normally when a message is signed a set of attributes are included which
1265: include the signing time and supported symmetric algorithms.
1266: With this option they are not included.
1267: .It Fl nocerts
1268: Do not include the signer's certificate.
1269: This will reduce the size of the signed message but the verifier must
1270: have a copy of the signer's certificate available locally (passed using
1271: the
1272: .Fl certfile
1273: option for example).
1274: .It Fl nodetach
1.137 naddy 1275: When signing a message, use opaque signing.
1.116 inoguchi 1276: This form is more resistant to translation by mail relays but it cannot be
1277: read by mail agents that do not support S/MIME.
1278: Without this option cleartext signing with the MIME type multipart/signed is
1279: used.
1280: .It Fl nointern
1281: Only the certificates specified in the
1282: .Fl certfile
1283: option are used.
1.137 naddy 1284: When verifying a message, normally certificates (if any) included in the
1.116 inoguchi 1285: message are searched for the signing certificate.
1286: The supplied certificates can still be used as untrusted CAs however.
1287: .It Fl nooldmime
1288: Output an old S/MIME content type like "application/x-pkcs7-".
1289: .It Fl noout
1290: Do not output the parsed CMS structure for the
1291: .Fl cmsout
1292: operation.
1293: This is useful when combined with the
1294: .Fl print
1295: option or if the syntax of the CMS structure is being checked.
1296: .It Fl nosigs
1297: Do not try to verify the signatures on the message.
1298: .It Fl nosmimecap
1299: Exclude the list of supported algorithms from signed attributes; other
1300: options such as signing time and content type are still included.
1301: .It Fl noverify
1302: Do not verify the signer's certificate of a signed message.
1303: .It Fl out Ar file
1304: The message text that has been decrypted or verified or the output MIME
1305: format message that has been signed or verified.
1306: .It Fl outform Cm der | pem | smime
1307: This specifies the output format for the CMS structure.
1308: The default is
1309: .Cm smime ,
1310: which writes an S/MIME format message.
1311: .Cm pem
1312: and
1313: .Cm der
1314: format change this to write PEM and DER format CMS structures instead.
1315: This currently only affects the output format of the CMS structure; if
1316: no CMS structure is being output (for example with
1317: .Fl verify
1318: or
1319: .Fl decrypt )
1320: this option has no effect.
1321: .It Fl passin Ar src
1322: The private key password source.
1323: .It Fl print
1324: Print out all fields of the CMS structure for the
1325: .Fl cmsout
1326: operation.
1327: This is mainly useful for testing purposes.
1328: .It Fl pwri_password Ar arg
1329: Specify PasswordRecipientInfo (PWRI) password to use.
1330: Supported by the
1331: .Fl encrypt
1332: and
1333: .Fl decrypt
1334: operations.
1335: .It Fl rctform Cm der | pem | smime
1336: Specify the format for a signed receipt for use with the
1337: .Fl receipt_verify
1338: operation.
1339: The default is
1340: .Cm smime .
1341: .It Fl receipt_request_all | receipt_request_first
1342: Indicate requests should be provided by all recipient or first tier
1343: recipients (those mailed directly and not from a mailing list), for the
1344: .Fl sign
1345: operation to include a signed receipt request.
1346: Ignored if
1347: .Fl receipt_request_from
1348: is included.
1349: .It Fl receipt_request_from Ar addr
1350: Add an explicit email address where receipts should be supplied.
1351: .It Fl receipt_request_print
1352: Print out the contents of any signed receipt requests for the
1353: .Fl verify
1354: operation.
1355: .It Fl receipt_request_to Ar addr
1356: Add an explicit email address where signed receipts should be sent to.
1357: This option must be supplied if a signed receipt is requested.
1358: .It Fl recip Ar file
1.137 naddy 1359: When decrypting a message, this specifies the recipient's certificate.
1.116 inoguchi 1360: The certificate must match one of the recipients of the message or an
1361: error occurs.
1.137 naddy 1362: When encrypting a message, this option may be used multiple times to
1.116 inoguchi 1363: specify each recipient.
1364: This form must be used if customised parameters are required (for example to
1365: specify RSA-OAEP).
1366: Only certificates carrying RSA, Diffie-Hellman or EC keys are supported
1367: by this option.
1368: .It Fl secretkey Ar key
1369: Specify symmetric key to use.
1370: The key must be supplied in hex format and be consistent with the
1371: algorithm used.
1372: Supported by the
1373: .Fl EncryptedData_encrypt ,
1374: .Fl EncryptedData_decrypt ,
1375: .Fl encrypt
1376: and
1377: .Fl decrypt
1378: operations.
1379: When used with
1380: .Fl encrypt
1381: or
1.137 naddy 1382: .Fl decrypt ,
1.116 inoguchi 1383: the supplied key is used to wrap or unwrap the content encryption key
1384: using an AES key in the KEKRecipientInfo type.
1385: .It Fl secretkeyid Ar id
1386: The key identifier for the supplied symmetric key for KEKRecipientInfo type.
1387: This option must be present if the
1388: .Fl secretkey
1389: option is used with
1390: .Fl encrypt .
1391: With
1392: .Fl decrypt
1393: operations the id is used to locate the relevant key; if it is not supplied
1394: then an attempt is used to decrypt any KEKRecipientInfo structures.
1395: .It Fl signer Ar file
1396: A signing certificate when signing or resigning a message; this option
1397: can be used multiple times if more than one signer is required.
1398: If a message is being verified then the signers certificates will be
1399: written to this file if the verification was successful.
1400: .It Xo
1401: .Fl stream |
1402: .Fl indef |
1403: .Fl noindef
1404: .Xc
1405: The
1406: .Fl stream
1407: and
1408: .Fl indef
1409: options are equivalent and enable streaming I/O for encoding operations.
1410: This permits single pass processing of data without the need to hold the
1411: entire contents in memory, potentially supporting very large files.
1412: Streaming is automatically set for S/MIME signing with detached data if
1413: the output format is
1414: .Cm smime ;
1415: it is currently off by default for all other operations.
1416: .Fl noindef
1417: disable streaming I/O where it would produce an indefinite length
1418: constructed encoding.
1419: This option currently has no effect.
1420: .It Fl text
1421: Add plain text (text/plain) MIME headers to the supplied message if
1422: encrypting or signing.
1.137 naddy 1423: If decrypting or verifying, it strips off text headers: if the decrypted
1.116 inoguchi 1424: or verified message is not of MIME type text/plain then an error occurs.
1425: .It Fl verify_retcode
1426: Set verification error code to exit code to indicate what verification error
1427: has occurred.
1428: Supported by
1429: .Fl verify
1430: operation only.
1431: Exit code value minus 32 shows verification error code.
1432: See
1433: .Nm verify
1434: command for the list of verification error code.
1435: .El
1436: .Pp
1437: The exit codes for
1438: .Nm cms
1439: are as follows:
1440: .Pp
1441: .Bl -tag -width "XXXX" -offset 3n -compact
1442: .It 0
1443: The operation was completely successful.
1444: .It 1
1445: An error occurred parsing the command options.
1446: .It 2
1447: One of the input files could not be read.
1448: .It 3
1449: An error occurred creating the CMS file or when reading the MIME message.
1450: .It 4
1451: An error occurred decrypting or verifying the message.
1452: .It 5
1453: The message was verified correctly but an error occurred writing out the
1454: signer's certificates.
1455: .It 6
1456: An error occurred writing the output file.
1457: .It 32+
1458: A verify error occurred while
1459: .Fl verify_retcode
1460: is specified.
1.1 jsing 1461: .El
1.120 kn 1462: .Tg crl
1.1 jsing 1463: .Sh CRL
1.114 jmc 1464: .Bl -hang -width "openssl crl"
1465: .It Nm openssl crl
1466: .Bk -words
1.1 jsing 1467: .Op Fl CAfile Ar file
1468: .Op Fl CApath Ar dir
1.104 inoguchi 1469: .Op Fl crlnumber
1.1 jsing 1470: .Op Fl fingerprint
1471: .Op Fl hash
1.104 inoguchi 1472: .Op Fl hash_old
1.1 jsing 1473: .Op Fl in Ar file
1.38 jmc 1474: .Op Fl inform Cm der | pem
1.1 jsing 1475: .Op Fl issuer
1476: .Op Fl lastupdate
1.104 inoguchi 1477: .Op Fl nameopt Ar option
1.1 jsing 1478: .Op Fl nextupdate
1479: .Op Fl noout
1480: .Op Fl out Ar file
1.38 jmc 1481: .Op Fl outform Cm der | pem
1.1 jsing 1482: .Op Fl text
1.104 inoguchi 1483: .Op Fl verify
1.114 jmc 1484: .Ek
1485: .El
1.1 jsing 1486: .Pp
1487: The
1488: .Nm crl
1489: command processes CRL files in DER or PEM format.
1.37 jmc 1490: .Pp
1.1 jsing 1491: The options are as follows:
1492: .Bl -tag -width Ds
1493: .It Fl CAfile Ar file
1494: Verify the signature on a CRL by looking up the issuing certificate in
1495: .Ar file .
1496: .It Fl CApath Ar directory
1497: Verify the signature on a CRL by looking up the issuing certificate in
1498: .Ar dir .
1499: This directory must be a standard certificate directory,
1500: i.e. a hash of each subject name (using
1501: .Cm x509 Fl hash )
1502: should be linked to each certificate.
1.104 inoguchi 1503: .It Fl crlnumber
1504: Print the CRL number.
1.1 jsing 1505: .It Fl fingerprint
1506: Print the CRL fingerprint.
1507: .It Fl hash
1508: Output a hash of the issuer name.
1509: This can be used to look up CRLs in a directory by issuer name.
1.104 inoguchi 1510: .It Fl hash_old
1511: Output an old-style (MD5) hash of the issuer name.
1.1 jsing 1512: .It Fl in Ar file
1.37 jmc 1513: The input file to read from, or standard input if not specified.
1.38 jmc 1514: .It Fl inform Cm der | pem
1.37 jmc 1515: The input format.
1.1 jsing 1516: .It Fl issuer
1517: Output the issuer name.
1518: .It Fl lastupdate
1519: Output the
1.37 jmc 1520: .Cm lastUpdate
1.1 jsing 1521: field.
1.104 inoguchi 1522: .It Fl nameopt Ar option
1523: Specify certificate name options.
1.1 jsing 1524: .It Fl nextupdate
1525: Output the
1.37 jmc 1526: .Cm nextUpdate
1.1 jsing 1527: field.
1528: .It Fl noout
1.46 jmc 1529: Do not output the encoded version of the CRL.
1.1 jsing 1530: .It Fl out Ar file
1.37 jmc 1531: The output file to write to, or standard output if not specified.
1.38 jmc 1532: .It Fl outform Cm der | pem
1.37 jmc 1533: The output format.
1.1 jsing 1534: .It Fl text
1.64 jmc 1535: Print the CRL in plain text.
1.104 inoguchi 1536: .It Fl verify
1537: Verify the signature on the CRL.
1.1 jsing 1538: .El
1.120 kn 1539: .Tg crl2pkcs7
1.1 jsing 1540: .Sh CRL2PKCS7
1.114 jmc 1541: .Bl -hang -width "openssl crl2pkcs7"
1542: .It Nm openssl crl2pkcs7
1543: .Bk -words
1.1 jsing 1544: .Op Fl certfile Ar file
1545: .Op Fl in Ar file
1.40 jmc 1546: .Op Fl inform Cm der | pem
1.1 jsing 1547: .Op Fl nocrl
1548: .Op Fl out Ar file
1.40 jmc 1549: .Op Fl outform Cm der | pem
1.114 jmc 1550: .Ek
1551: .El
1.1 jsing 1552: .Pp
1553: The
1554: .Nm crl2pkcs7
1555: command takes an optional CRL and one or more
1556: certificates and converts them into a PKCS#7 degenerate
1557: .Qq certificates only
1558: structure.
1559: .Pp
1560: The options are as follows:
1561: .Bl -tag -width Ds
1562: .It Fl certfile Ar file
1.40 jmc 1563: Add the certificates in PEM
1.1 jsing 1564: .Ar file
1.40 jmc 1565: to the PKCS#7 structure.
1566: This option can be used more than once
1567: to read certificates from multiple files.
1.1 jsing 1568: .It Fl in Ar file
1.40 jmc 1569: Read the CRL from
1570: .Ar file ,
1571: or standard input if not specified.
1572: .It Fl inform Cm der | pem
1.64 jmc 1573: The input format.
1.1 jsing 1574: .It Fl nocrl
1575: Normally, a CRL is included in the output file.
1576: With this option, no CRL is
1577: included in the output file and a CRL is not read from the input file.
1578: .It Fl out Ar file
1.40 jmc 1579: Write the PKCS#7 structure to
1580: .Ar file ,
1581: or standard output if not specified.
1582: .It Fl outform Cm der | pem
1.64 jmc 1583: The output format.
1.1 jsing 1584: .El
1.120 kn 1585: .Tg dgst
1.1 jsing 1586: .Sh DGST
1.114 jmc 1587: .Bl -hang -width "openssl dgst"
1588: .It Nm openssl dgst
1589: .Bk -words
1.105 inoguchi 1590: .Op Fl cdr
1.1 jsing 1591: .Op Fl binary
1.43 jmc 1592: .Op Fl Ar digest
1.1 jsing 1593: .Op Fl hex
1594: .Op Fl hmac Ar key
1.43 jmc 1595: .Op Fl keyform Cm pem
1.1 jsing 1596: .Op Fl mac Ar algorithm
1597: .Op Fl macopt Ar nm : Ns Ar v
1598: .Op Fl out Ar file
1599: .Op Fl passin Ar arg
1600: .Op Fl prverify Ar file
1601: .Op Fl sign Ar file
1602: .Op Fl signature Ar file
1603: .Op Fl sigopt Ar nm : Ns Ar v
1604: .Op Fl verify Ar file
1605: .Op Ar
1.114 jmc 1606: .Ek
1607: .El
1.1 jsing 1608: .Pp
1609: The digest functions output the message digest of a supplied
1610: .Ar file
1611: or
1612: .Ar files
1613: in hexadecimal form.
1614: They can also be used for digital signing and verification.
1615: .Pp
1616: The options are as follows:
1617: .Bl -tag -width Ds
1618: .It Fl binary
1619: Output the digest or signature in binary form.
1620: .It Fl c
1.48 jmc 1621: Print the digest in two-digit groups separated by colons.
1.1 jsing 1622: .It Fl d
1.48 jmc 1623: Print BIO debugging information.
1.43 jmc 1624: .It Fl Ar digest
1625: Use the specified message
1626: .Ar digest .
1.98 naddy 1627: The default is SHA256.
1.43 jmc 1628: The available digests can be displayed using
1629: .Nm openssl
1630: .Cm list-message-digest-commands .
1631: The following are equivalent:
1632: .Nm openssl dgst
1.98 naddy 1633: .Fl sha256
1.43 jmc 1634: and
1635: .Nm openssl
1.98 naddy 1636: .Cm sha256 .
1.1 jsing 1637: .It Fl hex
1638: Digest is to be output as a hex dump.
1639: This is the default case for a
1640: .Qq normal
1641: digest as opposed to a digital signature.
1642: .It Fl hmac Ar key
1643: Create a hashed MAC using
1644: .Ar key .
1.43 jmc 1645: .It Fl keyform Cm pem
1.1 jsing 1646: Specifies the key format to sign the digest with.
1647: .It Fl mac Ar algorithm
1648: Create a keyed Message Authentication Code (MAC).
1649: The most popular MAC algorithm is HMAC (hash-based MAC),
1650: but there are other MAC algorithms which are not based on hash.
1651: MAC keys and other options should be set via the
1652: .Fl macopt
1653: parameter.
1654: .It Fl macopt Ar nm : Ns Ar v
1655: Passes options to the MAC algorithm, specified by
1656: .Fl mac .
1657: The following options are supported by HMAC:
1658: .Bl -tag -width Ds
1.43 jmc 1659: .It Cm key : Ns Ar string
1.1 jsing 1660: Specifies the MAC key as an alphanumeric string
1661: (use if the key contain printable characters only).
1662: String length must conform to any restrictions of the MAC algorithm.
1.43 jmc 1663: .It Cm hexkey : Ns Ar string
1.1 jsing 1664: Specifies the MAC key in hexadecimal form (two hex digits per byte).
1665: Key length must conform to any restrictions of the MAC algorithm.
1666: .El
1667: .It Fl out Ar file
1.43 jmc 1668: The output file to write to,
1669: or standard output if not specified.
1.1 jsing 1670: .It Fl passin Ar arg
1671: The key password source.
1672: .It Fl prverify Ar file
1673: Verify the signature using the private key in
1674: .Ar file .
1675: The output is either
1676: .Qq Verification OK
1677: or
1678: .Qq Verification Failure .
1.105 inoguchi 1679: .It Fl r
1680: Print the digest in coreutils format.
1.1 jsing 1681: .It Fl sign Ar file
1682: Digitally sign the digest using the private key in
1683: .Ar file .
1684: .It Fl signature Ar file
1685: The actual signature to verify.
1686: .It Fl sigopt Ar nm : Ns Ar v
1687: Pass options to the signature algorithm during sign or verify operations.
1688: The names and values of these options are algorithm-specific.
1689: .It Fl verify Ar file
1690: Verify the signature using the public key in
1691: .Ar file .
1692: The output is either
1693: .Qq Verification OK
1694: or
1695: .Qq Verification Failure .
1696: .It Ar
1697: File or files to digest.
1698: If no files are specified then standard input is used.
1699: .El
1.120 kn 1700: .Tg dhparam
1.1 jsing 1701: .Sh DHPARAM
1.114 jmc 1702: .Bl -hang -width "openssl dhparam"
1703: .It Nm openssl dhparam
1704: .Bk -words
1.1 jsing 1705: .Op Fl 2 | 5
1706: .Op Fl C
1707: .Op Fl check
1708: .Op Fl dsaparam
1709: .Op Fl in Ar file
1.44 jmc 1710: .Op Fl inform Cm der | pem
1.1 jsing 1711: .Op Fl noout
1712: .Op Fl out Ar file
1.44 jmc 1713: .Op Fl outform Cm der | pem
1.1 jsing 1714: .Op Fl text
1715: .Op Ar numbits
1.114 jmc 1716: .Ek
1717: .El
1.1 jsing 1718: .Pp
1719: The
1720: .Nm dhparam
1721: command is used to manipulate DH parameter files.
1.44 jmc 1722: Only the older PKCS#3 DH is supported,
1723: not the newer X9.42 DH.
1.1 jsing 1724: .Pp
1725: The options are as follows:
1726: .Bl -tag -width Ds
1727: .It Fl 2 , 5
1.44 jmc 1728: The generator to use;
1.1 jsing 1729: 2 is the default.
1730: If present, the input file is ignored and parameters are generated instead.
1731: .It Fl C
1.44 jmc 1732: Convert the parameters into C code.
1.1 jsing 1733: The parameters can then be loaded by calling the
1.44 jmc 1734: .No get_dh Ns Ar numbits
1.1 jsing 1735: function.
1736: .It Fl check
1737: Check the DH parameters.
1738: .It Fl dsaparam
1.44 jmc 1739: Read or create DSA parameters,
1740: converted to DH format on output.
1.1 jsing 1741: Otherwise,
1742: .Qq strong
1743: primes
1744: .Pq such that (p-1)/2 is also prime
1745: will be used for DH parameter generation.
1746: .Pp
1747: DH parameter generation with the
1748: .Fl dsaparam
1749: option is much faster,
1750: and the recommended exponent length is shorter,
1751: which makes DH key exchange more efficient.
1752: Beware that with such DSA-style DH parameters,
1753: a fresh DH key should be created for each use to
1754: avoid small-subgroup attacks that may be possible otherwise.
1755: .It Fl in Ar file
1.44 jmc 1756: The input file to read from,
1757: or standard input if not specified.
1758: .It Fl inform Cm der | pem
1759: The input format.
1.1 jsing 1760: .It Fl noout
1.46 jmc 1761: Do not output the encoded version of the parameters.
1.44 jmc 1762: .It Fl out Ar file
1763: The output file to write to,
1764: or standard output if not specified.
1765: .It Fl outform Cm der | pem
1766: The output format.
1767: .It Fl text
1.64 jmc 1768: Print the DH parameters in plain text.
1.1 jsing 1769: .It Ar numbits
1.44 jmc 1770: Generate a parameter set of size
1.1 jsing 1771: .Ar numbits .
1772: It must be the last option.
1.16 sthen 1773: If not present, a value of 2048 is used.
1.1 jsing 1774: If this value is present, the input file is ignored and
1775: parameters are generated instead.
1776: .El
1.120 kn 1777: .Tg dsa
1.1 jsing 1778: .Sh DSA
1.114 jmc 1779: .Bl -hang -width "openssl dsa"
1780: .It Nm openssl dsa
1781: .Bk -words
1.1 jsing 1782: .Oo
1783: .Fl aes128 | aes192 | aes256 |
1784: .Fl des | des3
1785: .Oc
1786: .Op Fl in Ar file
1.108 inoguchi 1787: .Op Fl inform Cm der | pem | pvk
1.1 jsing 1788: .Op Fl modulus
1789: .Op Fl noout
1790: .Op Fl out Ar file
1.108 inoguchi 1791: .Op Fl outform Cm der | pem | pvk
1.1 jsing 1792: .Op Fl passin Ar arg
1793: .Op Fl passout Ar arg
1794: .Op Fl pubin
1795: .Op Fl pubout
1.108 inoguchi 1796: .Op Fl pvk-none | pvk-strong | pvk-weak
1.1 jsing 1797: .Op Fl text
1.114 jmc 1798: .Ek
1799: .El
1.1 jsing 1800: .Pp
1801: The
1802: .Nm dsa
1803: command processes DSA keys.
1804: They can be converted between various forms and their components printed out.
1805: .Pp
1806: .Sy Note :
1807: This command uses the traditional
1808: .Nm SSLeay
1809: compatible format for private key encryption:
1810: newer applications should use the more secure PKCS#8 format using the
1811: .Nm pkcs8
1812: command.
1813: .Pp
1814: The options are as follows:
1815: .Bl -tag -width Ds
1816: .It Xo
1817: .Fl aes128 | aes192 | aes256 |
1818: .Fl des | des3
1819: .Xc
1.45 jmc 1820: Encrypt the private key with the AES, DES, or the triple DES
1.1 jsing 1821: ciphers, respectively, before outputting it.
1822: A pass phrase is prompted for.
1.45 jmc 1823: If none of these options are specified, the key is written in plain text.
1.1 jsing 1824: This means that using the
1825: .Nm dsa
1.45 jmc 1826: utility to read an encrypted key with no encryption option can be used to
1.1 jsing 1827: remove the pass phrase from a key,
1.45 jmc 1828: or by setting the encryption options it can be used to add or change
1.1 jsing 1829: the pass phrase.
1830: These options can only be used with PEM format output files.
1831: .It Fl in Ar file
1.45 jmc 1832: The input file to read from,
1833: or standard input if not specified.
1.1 jsing 1834: If the key is encrypted, a pass phrase will be prompted for.
1.108 inoguchi 1835: .It Fl inform Cm der | pem | pvk
1.45 jmc 1836: The input format.
1.1 jsing 1837: .It Fl modulus
1.45 jmc 1838: Print the value of the public key component of the key.
1.1 jsing 1839: .It Fl noout
1.46 jmc 1840: Do not output the encoded version of the key.
1.1 jsing 1841: .It Fl out Ar file
1.45 jmc 1842: The output file to write to,
1843: or standard output if not specified.
1.1 jsing 1844: If any encryption options are set then a pass phrase will be
1845: prompted for.
1.108 inoguchi 1846: .It Fl outform Cm der | pem | pvk
1.45 jmc 1847: The output format.
1.1 jsing 1848: .It Fl passin Ar arg
1849: The key password source.
1850: .It Fl passout Ar arg
1851: The output file password source.
1852: .It Fl pubin
1.60 jmc 1853: Read in a public key, not a private key.
1.1 jsing 1854: .It Fl pubout
1.60 jmc 1855: Output a public key, not a private key.
1856: Automatically set if the input is a public key.
1.108 inoguchi 1857: .It Xo
1858: .Fl pvk-none | pvk-strong | pvk-weak
1859: .Xc
1860: Enable or disable PVK encoding.
1861: The default is
1862: .Fl pvk-strong .
1.1 jsing 1863: .It Fl text
1.64 jmc 1864: Print the public/private key in plain text.
1.1 jsing 1865: .El
1.120 kn 1866: .Tg dsaparam
1.1 jsing 1867: .Sh DSAPARAM
1.114 jmc 1868: .Bl -hang -width "openssl dsaparam"
1869: .It Nm openssl dsaparam
1870: .Bk -words
1.1 jsing 1871: .Op Fl C
1872: .Op Fl genkey
1873: .Op Fl in Ar file
1.46 jmc 1874: .Op Fl inform Cm der | pem
1.1 jsing 1875: .Op Fl noout
1876: .Op Fl out Ar file
1.46 jmc 1877: .Op Fl outform Cm der | pem
1.1 jsing 1878: .Op Fl text
1879: .Op Ar numbits
1.114 jmc 1880: .Ek
1881: .El
1.1 jsing 1882: .Pp
1883: The
1884: .Nm dsaparam
1885: command is used to manipulate or generate DSA parameter files.
1886: .Pp
1887: The options are as follows:
1888: .Bl -tag -width Ds
1889: .It Fl C
1.46 jmc 1890: Convert the parameters into C code.
1.1 jsing 1891: The parameters can then be loaded by calling the
1.46 jmc 1892: .No get_dsa Ns Ar XXX
1.1 jsing 1893: function.
1894: .It Fl genkey
1.46 jmc 1895: Generate a DSA key either using the specified or generated
1.1 jsing 1896: parameters.
1897: .It Fl in Ar file
1.46 jmc 1898: The input file to read from,
1899: or standard input if not specified.
1.1 jsing 1900: If the
1901: .Ar numbits
1.46 jmc 1902: parameter is included, then this option is ignored.
1903: .It Fl inform Cm der | pem
1904: The input format.
1.1 jsing 1905: .It Fl noout
1.46 jmc 1906: Do not output the encoded version of the parameters.
1907: .It Fl out Ar file
1908: The output file to write to,
1909: or standard output if not specified.
1910: .It Fl outform Cm der | pem
1911: The output format.
1912: .It Fl text
1.64 jmc 1913: Print the DSA parameters in plain text.
1.1 jsing 1914: .It Ar numbits
1.46 jmc 1915: Generate a parameter set of size
1.1 jsing 1916: .Ar numbits .
1.46 jmc 1917: If this option is included, the input file is ignored.
1.1 jsing 1918: .El
1.120 kn 1919: .Tg ec
1.1 jsing 1920: .Sh EC
1.114 jmc 1921: .Bl -hang -width "openssl ec"
1922: .It Nm openssl ec
1923: .Bk -words
1.1 jsing 1924: .Op Fl conv_form Ar arg
1925: .Op Fl des
1926: .Op Fl des3
1927: .Op Fl in Ar file
1.47 jmc 1928: .Op Fl inform Cm der | pem
1.1 jsing 1929: .Op Fl noout
1930: .Op Fl out Ar file
1.47 jmc 1931: .Op Fl outform Cm der | pem
1.1 jsing 1932: .Op Fl param_enc Ar arg
1933: .Op Fl param_out
1934: .Op Fl passin Ar arg
1935: .Op Fl passout Ar arg
1936: .Op Fl pubin
1937: .Op Fl pubout
1938: .Op Fl text
1.114 jmc 1939: .Ek
1940: .El
1.1 jsing 1941: .Pp
1942: The
1943: .Nm ec
1944: command processes EC keys.
1945: They can be converted between various
1946: forms and their components printed out.
1.47 jmc 1947: .Nm openssl
1.1 jsing 1948: uses the private key format specified in
1949: .Dq SEC 1: Elliptic Curve Cryptography
1.136 jsg 1950: .Pq Lk https://www.secg.org/ .
1.1 jsing 1951: To convert an
1952: EC private key into the PKCS#8 private key format use the
1953: .Nm pkcs8
1954: command.
1955: .Pp
1956: The options are as follows:
1957: .Bl -tag -width Ds
1958: .It Fl conv_form Ar arg
1.47 jmc 1959: Specify how the points on the elliptic curve are converted
1.1 jsing 1960: into octet strings.
1961: Possible values are:
1.95 tb 1962: .Cm compressed ,
1963: .Cm uncompressed
1.47 jmc 1964: (the default),
1.1 jsing 1965: and
1966: .Cm hybrid .
1967: For more information regarding
1.47 jmc 1968: the point conversion forms see the X9.62 standard.
1.1 jsing 1969: Note:
1970: Due to patent issues the
1971: .Cm compressed
1972: option is disabled by default for binary curves
1973: and can be enabled by defining the preprocessor macro
1.47 jmc 1974: .Dv OPENSSL_EC_BIN_PT_COMP
1.1 jsing 1975: at compile time.
1976: .It Fl des | des3
1.47 jmc 1977: Encrypt the private key with DES, triple DES, or
1.1 jsing 1978: any other cipher supported by
1.47 jmc 1979: .Nm openssl .
1.1 jsing 1980: A pass phrase is prompted for.
1.127 jmc 1981: If none of these options are specified, the key is written in plain text.
1.1 jsing 1982: This means that using the
1983: .Nm ec
1984: utility to read in an encrypted key with no
1985: encryption option can be used to remove the pass phrase from a key,
1986: or by setting the encryption options
1.83 naddy 1987: it can be used to add or change the pass phrase.
1.1 jsing 1988: These options can only be used with PEM format output files.
1989: .It Fl in Ar file
1.47 jmc 1990: The input file to read a key from,
1991: or standard input if not specified.
1.127 jmc 1992: If the key is encrypted, a pass phrase will be prompted for.
1.47 jmc 1993: .It Fl inform Cm der | pem
1994: The input format.
1.1 jsing 1995: .It Fl noout
1.47 jmc 1996: Do not output the encoded version of the key.
1.1 jsing 1997: .It Fl out Ar file
1.47 jmc 1998: The output filename to write to,
1999: or standard output if not specified.
1.1 jsing 2000: If any encryption options are set then a pass phrase will be prompted for.
1.47 jmc 2001: .It Fl outform Cm der | pem
2002: The output format.
1.1 jsing 2003: .It Fl param_enc Ar arg
1.47 jmc 2004: Specify how the elliptic curve parameters are encoded.
1.1 jsing 2005: Possible value are:
2006: .Cm named_curve ,
2007: i.e. the EC parameters are specified by an OID; or
2008: .Cm explicit ,
2009: where the EC parameters are explicitly given
2010: (see RFC 3279 for the definition of the EC parameter structures).
2011: The default value is
2012: .Cm named_curve .
2013: Note: the
2014: .Cm implicitlyCA
2015: alternative,
2016: as specified in RFC 3279,
1.47 jmc 2017: is currently not implemented.
1.106 inoguchi 2018: .It Fl param_out
2019: Print the elliptic curve parameters.
1.1 jsing 2020: .It Fl passin Ar arg
2021: The key password source.
2022: .It Fl passout Ar arg
2023: The output file password source.
2024: .It Fl pubin
1.60 jmc 2025: Read in a public key, not a private key.
1.1 jsing 2026: .It Fl pubout
1.60 jmc 2027: Output a public key, not a private key.
2028: Automatically set if the input is a public key.
1.1 jsing 2029: .It Fl text
1.64 jmc 2030: Print the public/private key in plain text.
1.1 jsing 2031: .El
1.120 kn 2032: .Tg ecparam
1.1 jsing 2033: .Sh ECPARAM
1.114 jmc 2034: .Bl -hang -width "openssl ecparam"
2035: .It Nm openssl ecparam
2036: .Bk -words
1.1 jsing 2037: .Op Fl C
2038: .Op Fl check
2039: .Op Fl conv_form Ar arg
2040: .Op Fl genkey
2041: .Op Fl in Ar file
1.48 jmc 2042: .Op Fl inform Cm der | pem
1.1 jsing 2043: .Op Fl list_curves
2044: .Op Fl name Ar arg
2045: .Op Fl no_seed
2046: .Op Fl noout
2047: .Op Fl out Ar file
1.48 jmc 2048: .Op Fl outform Cm der | pem
1.1 jsing 2049: .Op Fl param_enc Ar arg
2050: .Op Fl text
1.114 jmc 2051: .Ek
2052: .El
1.1 jsing 2053: .Pp
1.48 jmc 2054: The
2055: .Nm ecparam
2056: command is used to manipulate or generate EC parameter files.
2057: .Nm openssl
2058: is not able to generate new groups so
2059: .Nm ecparam
2060: can only create EC parameters from known (named) curves.
2061: .Pp
1.1 jsing 2062: The options are as follows:
2063: .Bl -tag -width Ds
2064: .It Fl C
2065: Convert the EC parameters into C code.
2066: The parameters can then be loaded by calling the
1.48 jmc 2067: .No get_ec_group_ Ns Ar XXX
1.1 jsing 2068: function.
2069: .It Fl check
2070: Validate the elliptic curve parameters.
2071: .It Fl conv_form Ar arg
2072: Specify how the points on the elliptic curve are converted
2073: into octet strings.
2074: Possible values are:
1.95 tb 2075: .Cm compressed ,
2076: .Cm uncompressed
1.48 jmc 2077: (the default),
1.1 jsing 2078: and
2079: .Cm hybrid .
2080: For more information regarding
1.48 jmc 2081: the point conversion forms see the X9.62 standard.
1.1 jsing 2082: Note:
2083: Due to patent issues the
2084: .Cm compressed
2085: option is disabled by default for binary curves
2086: and can be enabled by defining the preprocessor macro
1.48 jmc 2087: .Dv OPENSSL_EC_BIN_PT_COMP
1.1 jsing 2088: at compile time.
2089: .It Fl genkey
2090: Generate an EC private key using the specified parameters.
2091: .It Fl in Ar file
1.48 jmc 2092: The input file to read from,
2093: or standard input if not specified.
2094: .It Fl inform Cm der | pem
2095: The input format.
1.1 jsing 2096: .It Fl list_curves
1.48 jmc 2097: Print a list of all
1.1 jsing 2098: currently implemented EC parameter names and exit.
2099: .It Fl name Ar arg
1.48 jmc 2100: Use the EC parameters with the specified "short" name.
1.1 jsing 2101: .It Fl no_seed
1.48 jmc 2102: Do not include the seed for the parameter generation
2103: in the ECParameters structure (see RFC 3279).
1.1 jsing 2104: .It Fl noout
1.48 jmc 2105: Do not output the encoded version of the parameters.
1.1 jsing 2106: .It Fl out Ar file
1.48 jmc 2107: The output file to write to,
2108: or standard output if not specified.
2109: .It Fl outform Cm der | pem
2110: The output format.
1.1 jsing 2111: .It Fl param_enc Ar arg
1.48 jmc 2112: Specify how the elliptic curve parameters are encoded.
1.1 jsing 2113: Possible value are:
2114: .Cm named_curve ,
2115: i.e. the EC parameters are specified by an OID, or
2116: .Cm explicit ,
2117: where the EC parameters are explicitly given
2118: (see RFC 3279 for the definition of the EC parameter structures).
2119: The default value is
2120: .Cm named_curve .
2121: Note: the
2122: .Cm implicitlyCA
2123: alternative, as specified in RFC 3279,
1.48 jmc 2124: is currently not implemented.
1.1 jsing 2125: .It Fl text
1.64 jmc 2126: Print the EC parameters in plain text.
1.1 jsing 2127: .El
1.120 kn 2128: .Tg enc
1.1 jsing 2129: .Sh ENC
1.114 jmc 2130: .Bl -hang -width "openssl enc"
2131: .It Nm openssl enc
2132: .Bk -words
1.1 jsing 2133: .Fl ciphername
1.106 inoguchi 2134: .Op Fl AadePpv
1.1 jsing 2135: .Op Fl base64
2136: .Op Fl bufsize Ar number
2137: .Op Fl debug
2138: .Op Fl in Ar file
1.97 jmc 2139: .Op Fl iter Ar iterations
1.1 jsing 2140: .Op Fl iv Ar IV
2141: .Op Fl K Ar key
2142: .Op Fl k Ar password
2143: .Op Fl kfile Ar file
2144: .Op Fl md Ar digest
2145: .Op Fl none
2146: .Op Fl nopad
2147: .Op Fl nosalt
2148: .Op Fl out Ar file
2149: .Op Fl pass Ar arg
1.96 beck 2150: .Op Fl pbkdf2
1.1 jsing 2151: .Op Fl S Ar salt
2152: .Op Fl salt
1.114 jmc 2153: .Ek
2154: .El
1.1 jsing 2155: .Pp
2156: The symmetric cipher commands allow data to be encrypted or decrypted
2157: using various block and stream ciphers using keys based on passwords
2158: or explicitly provided.
2159: Base64 encoding or decoding can also be performed either by itself
2160: or in addition to the encryption or decryption.
1.49 jmc 2161: The program can be called either as
2162: .Nm openssl Ar ciphername
2163: or
2164: .Nm openssl enc - Ns Ar ciphername .
2165: .Pp
2166: Some of the ciphers do not have large keys and others have security
2167: implications if not used correctly.
2168: All the block ciphers normally use PKCS#5 padding,
2169: also known as standard block padding.
2170: If padding is disabled, the input data must be a multiple of the cipher
2171: block length.
1.1 jsing 2172: .Pp
2173: The options are as follows:
2174: .Bl -tag -width Ds
2175: .It Fl A
2176: If the
2177: .Fl a
2178: option is set, then base64 process the data on one line.
2179: .It Fl a , base64
2180: Base64 process the data.
2181: This means that if encryption is taking place, the data is base64-encoded
2182: after encryption.
1.49 jmc 2183: If decryption is set, the input data is base64-decoded before
1.1 jsing 2184: being decrypted.
2185: .It Fl bufsize Ar number
2186: Set the buffer size for I/O.
2187: .It Fl d
2188: Decrypt the input data.
2189: .It Fl debug
2190: Debug the BIOs used for I/O.
2191: .It Fl e
1.49 jmc 2192: Encrypt the input data.
2193: This is the default.
1.1 jsing 2194: .It Fl in Ar file
1.49 jmc 2195: The input file to read from,
1.57 jmc 2196: or standard input if not specified.
1.97 jmc 2197: .It Fl iter Ar iterations
2198: Use the pbkdf2 key derivation function, with
2199: .Ar iterations
2200: as the number of iterations.
1.1 jsing 2201: .It Fl iv Ar IV
2202: The actual
2203: .Ar IV
2204: .Pq initialisation vector
2205: to use:
2206: this must be represented as a string comprised only of hex digits.
2207: When only the
2208: .Ar key
2209: is specified using the
2210: .Fl K
1.49 jmc 2211: option,
2212: the IV must explicitly be defined.
1.1 jsing 2213: When a password is being specified using one of the other options,
1.49 jmc 2214: the IV is generated from this password.
1.1 jsing 2215: .It Fl K Ar key
2216: The actual
2217: .Ar key
2218: to use:
2219: this must be represented as a string comprised only of hex digits.
1.49 jmc 2220: If only the key is specified,
2221: the IV must also be specified using the
1.1 jsing 2222: .Fl iv
2223: option.
2224: When both a
2225: .Ar key
2226: and a
2227: .Ar password
2228: are specified, the
2229: .Ar key
2230: given with the
2231: .Fl K
1.49 jmc 2232: option will be used and the IV generated from the password will be taken.
1.1 jsing 2233: It probably does not make much sense to specify both
2234: .Ar key
2235: and
2236: .Ar password .
2237: .It Fl k Ar password
2238: The
2239: .Ar password
2240: to derive the key from.
2241: Superseded by the
2242: .Fl pass
2243: option.
2244: .It Fl kfile Ar file
2245: Read the password to derive the key from the first line of
2246: .Ar file .
2247: Superseded by the
2248: .Fl pass
2249: option.
2250: .It Fl md Ar digest
2251: Use
2252: .Ar digest
2253: to create a key from a pass phrase.
1.118 sthen 2254: Currently, the default value is
1.117 tb 2255: .Cm sha256 .
1.1 jsing 2256: .It Fl none
2257: Use NULL cipher (no encryption or decryption of input).
2258: .It Fl nopad
2259: Disable standard block padding.
2260: .It Fl nosalt
1.49 jmc 2261: Don't use a salt in the key derivation routines.
1.81 jmc 2262: This option should never be used
1.49 jmc 2263: since it makes it possible to perform efficient dictionary
2264: attacks on the password and to attack stream cipher encrypted data.
1.1 jsing 2265: .It Fl out Ar file
1.51 jmc 2266: The output file to write to,
1.57 jmc 2267: or standard output if not specified.
1.1 jsing 2268: .It Fl P
1.49 jmc 2269: Print out the salt, key, and IV used, then immediately exit;
1.1 jsing 2270: don't do any encryption or decryption.
2271: .It Fl p
1.49 jmc 2272: Print out the salt, key, and IV used.
1.1 jsing 2273: .It Fl pass Ar arg
2274: The password source.
1.96 beck 2275: .It Fl pbkdf2
1.97 jmc 2276: Use the pbkdf2 key derivation function, with
1.96 beck 2277: the default of 10000 iterations.
1.1 jsing 2278: .It Fl S Ar salt
2279: The actual
2280: .Ar salt
2281: to use:
2282: this must be represented as a string comprised only of hex digits.
2283: .It Fl salt
1.49 jmc 2284: Use a salt in the key derivation routines (the default).
1.137 naddy 2285: When the salt is being used,
1.49 jmc 2286: the first eight bytes of the encrypted data are reserved for the salt:
2287: it is randomly generated when encrypting a file and read from the
2288: encrypted file when it is decrypted.
1.106 inoguchi 2289: .It Fl v
2290: Print extra details about the processing.
1.1 jsing 2291: .El
1.120 kn 2292: .Tg errstr
1.1 jsing 2293: .Sh ERRSTR
2294: .Nm openssl errstr
2295: .Op Fl stats
2296: .Ar errno ...
2297: .Pp
2298: The
2299: .Nm errstr
2300: command performs error number to error string conversion,
2301: generating a human-readable string representing the error code
2302: .Ar errno .
2303: The string is obtained through the
2304: .Xr ERR_error_string_n 3
2305: function and has the following format:
2306: .Pp
2307: .Dl error:[error code]:[library name]:[function name]:[reason string]
2308: .Pp
2309: .Bq error code
2310: is an 8-digit hexadecimal number.
2311: The remaining fields
2312: .Bq library name ,
2313: .Bq function name ,
2314: and
2315: .Bq reason string
2316: are all ASCII text.
2317: .Pp
2318: The options are as follows:
2319: .Bl -tag -width Ds
2320: .It Fl stats
2321: Print debugging statistics about various aspects of the hash table.
2322: .El
1.120 kn 2323: .Tg gendsa
1.1 jsing 2324: .Sh GENDSA
1.114 jmc 2325: .Bl -hang -width "openssl gendsa"
2326: .It Nm openssl gendsa
2327: .Bk -words
1.1 jsing 2328: .Oo
1.102 jmc 2329: .Fl aes128 | aes192 | aes256 | camellia128 |
2330: .Fl camellia192 | camellia256 | des | des3 | idea
1.1 jsing 2331: .Oc
2332: .Op Fl out Ar file
1.101 inoguchi 2333: .Op Fl passout Ar arg
2334: .Ar paramfile
1.114 jmc 2335: .Ek
2336: .El
1.1 jsing 2337: .Pp
2338: The
2339: .Nm gendsa
2340: command generates a DSA private key from a DSA parameter file
1.51 jmc 2341: (typically generated by the
1.1 jsing 2342: .Nm openssl dsaparam
2343: command).
1.51 jmc 2344: DSA key generation is little more than random number generation so it is
2345: much quicker than,
2346: for example,
2347: RSA key generation.
1.1 jsing 2348: .Pp
2349: The options are as follows:
2350: .Bl -tag -width Ds
2351: .It Xo
2352: .Fl aes128 | aes192 | aes256 |
1.101 inoguchi 2353: .Fl camellia128 | camellia192 | camellia256 |
2354: .Fl des | des3 |
2355: .Fl idea
1.1 jsing 2356: .Xc
1.101 inoguchi 2357: Encrypt the private key with the AES, CAMELLIA, DES, triple DES
2358: or the IDEA ciphers, respectively, before outputting it.
1.1 jsing 2359: A pass phrase is prompted for.
2360: If none of these options are specified, no encryption is used.
2361: .It Fl out Ar file
1.51 jmc 2362: The output file to write to,
1.57 jmc 2363: or standard output if not specified.
1.101 inoguchi 2364: .It Fl passout Ar arg
2365: The output file password source.
1.1 jsing 2366: .It Ar paramfile
1.51 jmc 2367: Specify the DSA parameter file to use.
1.1 jsing 2368: The parameters in this file determine the size of the private key.
2369: .El
1.120 kn 2370: .Tg genpkey
1.1 jsing 2371: .Sh GENPKEY
1.114 jmc 2372: .Bl -hang -width "openssl genpkey"
2373: .It Nm openssl genpkey
2374: .Bk -words
1.1 jsing 2375: .Op Fl algorithm Ar alg
2376: .Op Ar cipher
2377: .Op Fl genparam
2378: .Op Fl out Ar file
1.52 jmc 2379: .Op Fl outform Cm der | pem
1.1 jsing 2380: .Op Fl paramfile Ar file
2381: .Op Fl pass Ar arg
2382: .Op Fl pkeyopt Ar opt : Ns Ar value
2383: .Op Fl text
1.114 jmc 2384: .Ek
2385: .El
1.1 jsing 2386: .Pp
2387: The
2388: .Nm genpkey
2389: command generates private keys.
2390: The use of this
2391: program is encouraged over the algorithm specific utilities
1.22 bcook 2392: because additional algorithm options can be used.
1.1 jsing 2393: .Pp
2394: The options are as follows:
2395: .Bl -tag -width Ds
2396: .It Fl algorithm Ar alg
2397: The public key algorithm to use,
2398: such as RSA, DSA, or DH.
1.52 jmc 2399: This option must precede any
1.1 jsing 2400: .Fl pkeyopt
2401: options.
2402: The options
2403: .Fl paramfile
2404: and
2405: .Fl algorithm
2406: are mutually exclusive.
2407: .It Ar cipher
2408: Encrypt the private key with the supplied cipher.
2409: Any algorithm name accepted by
1.52 jmc 2410: .Xr EVP_get_cipherbyname 3
2411: is acceptable.
1.1 jsing 2412: .It Fl genparam
2413: Generate a set of parameters instead of a private key.
1.52 jmc 2414: This option must precede any
1.1 jsing 2415: .Fl algorithm ,
2416: .Fl paramfile ,
2417: or
2418: .Fl pkeyopt
2419: options.
2420: .It Fl out Ar file
1.52 jmc 2421: The output file to write to,
1.57 jmc 2422: or standard output if not specified.
1.52 jmc 2423: .It Fl outform Cm der | pem
2424: The output format.
1.1 jsing 2425: .It Fl paramfile Ar file
1.52 jmc 2426: Some public key algorithms generate a private key based on a set of parameters,
2427: which can be supplied using this option.
1.137 naddy 2428: If this option is used, the public key
1.1 jsing 2429: algorithm used is determined by the parameters.
1.52 jmc 2430: This option must precede any
1.1 jsing 2431: .Fl pkeyopt
2432: options.
2433: The options
2434: .Fl paramfile
2435: and
2436: .Fl algorithm
2437: are mutually exclusive.
2438: .It Fl pass Ar arg
2439: The output file password source.
2440: .It Fl pkeyopt Ar opt : Ns Ar value
2441: Set the public key algorithm option
2442: .Ar opt
2443: to
1.52 jmc 2444: .Ar value ,
2445: as follows:
1.1 jsing 2446: .Bl -tag -width Ds -offset indent
2447: .It rsa_keygen_bits : Ns Ar numbits
2448: (RSA)
2449: The number of bits in the generated key.
1.52 jmc 2450: The default is 2048.
1.1 jsing 2451: .It rsa_keygen_pubexp : Ns Ar value
2452: (RSA)
2453: The RSA public exponent value.
2454: This can be a large decimal or hexadecimal value if preceded by 0x.
1.52 jmc 2455: The default is 65537.
1.1 jsing 2456: .It dsa_paramgen_bits : Ns Ar numbits
2457: (DSA)
2458: The number of bits in the generated parameters.
1.52 jmc 2459: The default is 1024.
1.1 jsing 2460: .It dh_paramgen_prime_len : Ns Ar numbits
2461: (DH)
2462: The number of bits in the prime parameter
2463: .Ar p .
2464: .It dh_paramgen_generator : Ns Ar value
2465: (DH)
2466: The value to use for the generator
2467: .Ar g .
2468: .It ec_paramgen_curve : Ns Ar curve
2469: (EC)
1.121 schwarze 2470: The elliptic curve to use.
1.1 jsing 2471: .El
1.52 jmc 2472: .It Fl text
1.64 jmc 2473: Print the private/public key in plain text.
1.52 jmc 2474: .El
1.120 kn 2475: .Tg genrsa
1.1 jsing 2476: .Sh GENRSA
1.114 jmc 2477: .Bl -hang -width "openssl genrsa"
2478: .It Nm openssl genrsa
2479: .Bk -words
1.1 jsing 2480: .Op Fl 3 | f4
1.109 inoguchi 2481: .Oo
2482: .Fl aes128 | aes192 | aes256 | camellia128 |
2483: .Fl camellia192 | camellia256 | des | des3 | idea
2484: .Oc
1.1 jsing 2485: .Op Fl out Ar file
2486: .Op Fl passout Ar arg
2487: .Op Ar numbits
1.114 jmc 2488: .Ek
2489: .El
1.1 jsing 2490: .Pp
2491: The
2492: .Nm genrsa
1.53 jmc 2493: command generates an RSA private key,
2494: which essentially involves the generation of two prime numbers.
2495: When generating the key,
2496: various symbols will be output to indicate the progress of the generation.
2497: A
2498: .Sq \&.
2499: represents each number which has passed an initial sieve test;
2500: .Sq +
1.128 tb 2501: means a number has passed a single round of the Miller-Rabin primality test;
2502: .Sq *
2503: means the number has failed primality testing
2504: and needs to be generated afresh.
1.53 jmc 2505: A newline means that the number has passed all the prime tests
2506: (the actual number depends on the key size).
1.1 jsing 2507: .Pp
2508: The options are as follows:
2509: .Bl -tag -width Ds
2510: .It Fl 3 | f4
2511: The public exponent to use, either 3 or 65537.
2512: The default is 65537.
1.109 inoguchi 2513: .It Xo
2514: .Fl aes128 | aes192 | aes256 |
2515: .Fl camellia128 | camellia192 | camellia256 |
2516: .Fl des | des3 |
2517: .Fl idea
2518: .Xc
2519: Encrypt the private key with the AES, CAMELLIA, DES, triple DES
2520: or the IDEA ciphers, respectively, before outputting it.
1.1 jsing 2521: If none of these options are specified, no encryption is used.
2522: If encryption is used, a pass phrase is prompted for,
2523: if it is not supplied via the
2524: .Fl passout
2525: option.
2526: .It Fl out Ar file
1.53 jmc 2527: The output file to write to,
1.57 jmc 2528: or standard output if not specified.
1.1 jsing 2529: .It Fl passout Ar arg
2530: The output file password source.
2531: .It Ar numbits
2532: The size of the private key to generate in bits.
2533: This must be the last option specified.
2534: The default is 2048.
2535: .El
1.120 kn 2536: .Tg nseq
1.1 jsing 2537: .Sh NSEQ
2538: .Nm openssl nseq
2539: .Op Fl in Ar file
2540: .Op Fl out Ar file
2541: .Op Fl toseq
2542: .Pp
2543: The
2544: .Nm nseq
1.54 jmc 2545: command takes a file containing a Netscape certificate sequence
2546: (an alternative to the standard PKCS#7 format)
2547: and prints out the certificates contained in it,
2548: or takes a file of certificates
2549: and converts it into a Netscape certificate sequence.
2550: .Pp
1.1 jsing 2551: The options are as follows:
2552: .Bl -tag -width Ds
2553: .It Fl in Ar file
1.54 jmc 2554: The input file to read from,
2555: or standard input if not specified.
1.1 jsing 2556: .It Fl out Ar file
1.54 jmc 2557: The output file to write to,
2558: or standard output if not specified.
1.1 jsing 2559: .It Fl toseq
2560: Normally, a Netscape certificate sequence will be input and the output
2561: is the certificates contained in it.
2562: With the
2563: .Fl toseq
2564: option the situation is reversed:
2565: a Netscape certificate sequence is created from a file of certificates.
2566: .El
1.120 kn 2567: .Tg ocsp
1.1 jsing 2568: .Sh OCSP
1.114 jmc 2569: .Bl -hang -width "openssl ocsp"
2570: .It Nm openssl ocsp
2571: .Bk -words
1.1 jsing 2572: .Op Fl CA Ar file
2573: .Op Fl CAfile Ar file
2574: .Op Fl CApath Ar directory
2575: .Op Fl cert Ar file
2576: .Op Fl dgst Ar alg
1.108 inoguchi 2577: .Op Fl header Ar name value
1.55 jmc 2578: .Op Fl host Ar hostname : Ns Ar port
1.108 inoguchi 2579: .Op Fl ignore_err
1.1 jsing 2580: .Op Fl index Ar indexfile
2581: .Op Fl issuer Ar file
2582: .Op Fl ndays Ar days
2583: .Op Fl nmin Ar minutes
2584: .Op Fl no_cert_checks
2585: .Op Fl no_cert_verify
2586: .Op Fl no_certs
2587: .Op Fl no_chain
1.108 inoguchi 2588: .Op Fl no_explicit
1.1 jsing 2589: .Op Fl no_intern
2590: .Op Fl no_nonce
2591: .Op Fl no_signature_verify
2592: .Op Fl nonce
2593: .Op Fl noverify
2594: .Op Fl nrequest Ar number
2595: .Op Fl out Ar file
2596: .Op Fl path Ar path
2597: .Op Fl port Ar portnum
2598: .Op Fl req_text
2599: .Op Fl reqin Ar file
2600: .Op Fl reqout Ar file
2601: .Op Fl resp_key_id
2602: .Op Fl resp_no_certs
2603: .Op Fl resp_text
2604: .Op Fl respin Ar file
2605: .Op Fl respout Ar file
2606: .Op Fl rkey Ar file
2607: .Op Fl rother Ar file
2608: .Op Fl rsigner Ar file
1.108 inoguchi 2609: .Op Fl serial Ar num
1.1 jsing 2610: .Op Fl sign_other Ar file
2611: .Op Fl signer Ar file
2612: .Op Fl signkey Ar file
2613: .Op Fl status_age Ar age
2614: .Op Fl text
1.108 inoguchi 2615: .Op Fl timeout Ar seconds
1.1 jsing 2616: .Op Fl trust_other
2617: .Op Fl url Ar responder_url
2618: .Op Fl VAfile Ar file
2619: .Op Fl validity_period Ar nsec
2620: .Op Fl verify_other Ar file
1.114 jmc 2621: .Ek
2622: .El
1.1 jsing 2623: .Pp
1.55 jmc 2624: The Online Certificate Status Protocol (OCSP)
2625: enables applications to determine the (revocation) state
2626: of an identified certificate (RFC 2560).
1.1 jsing 2627: .Pp
2628: The
2629: .Nm ocsp
2630: command performs many common OCSP tasks.
2631: It can be used to print out requests and responses,
2632: create requests and send queries to an OCSP responder,
2633: and behave like a mini OCSP server itself.
2634: .Pp
2635: The options are as follows:
2636: .Bl -tag -width Ds
2637: .It Fl CAfile Ar file , Fl CApath Ar directory
1.55 jmc 2638: A file or path containing trusted CA certificates,
2639: used to verify the signature on the OCSP response.
1.1 jsing 2640: .It Fl cert Ar file
2641: Add the certificate
2642: .Ar file
2643: to the request.
2644: The issuer certificate is taken from the previous
2645: .Fl issuer
2646: option, or an error occurs if no issuer certificate is specified.
2647: .It Fl dgst Ar alg
1.55 jmc 2648: Use the digest algorithm
2649: .Ar alg
2650: for certificate identification in the OCSP request.
1.125 inoguchi 2651: By default SHA1 is used.
1.1 jsing 2652: .It Xo
2653: .Fl host Ar hostname : Ns Ar port ,
2654: .Fl path Ar path
2655: .Xc
1.55 jmc 2656: Send
2657: the OCSP request to
1.1 jsing 2658: .Ar hostname
1.55 jmc 2659: on
1.1 jsing 2660: .Ar port .
2661: .Fl path
2662: specifies the HTTP path name to use, or
1.55 jmc 2663: .Pa /
1.1 jsing 2664: by default.
1.108 inoguchi 2665: .It Fl header Ar name value
2666: Add the header name with the specified value to the OCSP request that is sent
2667: to the responder.
2668: This may be repeated.
1.1 jsing 2669: .It Fl issuer Ar file
1.81 jmc 2670: The current issuer certificate, in PEM format.
2671: Can be used multiple times and must come before any
1.1 jsing 2672: .Fl cert
2673: options.
2674: .It Fl no_cert_checks
2675: Don't perform any additional checks on the OCSP response signer's certificate.
2676: That is, do not make any checks to see if the signer's certificate is
2677: authorised to provide the necessary status information:
2678: as a result this option should only be used for testing purposes.
2679: .It Fl no_cert_verify
2680: Don't verify the OCSP response signer's certificate at all.
2681: Since this option allows the OCSP response to be signed by any certificate,
2682: it should only be used for testing purposes.
2683: .It Fl no_certs
1.55 jmc 2684: Don't include any certificates in the signed request.
1.1 jsing 2685: .It Fl no_chain
2686: Do not use certificates in the response as additional untrusted CA
2687: certificates.
1.108 inoguchi 2688: .It Fl no_explicit
2689: Don't check the explicit trust for OCSP signing in the root CA certificate.
1.1 jsing 2690: .It Fl no_intern
2691: Ignore certificates contained in the OCSP response
2692: when searching for the signer's certificate.
1.55 jmc 2693: The signer's certificate must be specified with either the
1.1 jsing 2694: .Fl verify_other
2695: or
2696: .Fl VAfile
2697: options.
2698: .It Fl no_signature_verify
2699: Don't check the signature on the OCSP response.
2700: Since this option tolerates invalid signatures on OCSP responses,
2701: it will normally only be used for testing purposes.
2702: .It Fl nonce , no_nonce
1.55 jmc 2703: Add an OCSP nonce extension to a request,
2704: or disable an OCSP nonce addition.
1.1 jsing 2705: Normally, if an OCSP request is input using the
2706: .Fl respin
1.55 jmc 2707: option no nonce is added:
1.1 jsing 2708: using the
2709: .Fl nonce
1.55 jmc 2710: option will force the addition of a nonce.
1.1 jsing 2711: If an OCSP request is being created (using the
2712: .Fl cert
2713: and
2714: .Fl serial
1.137 naddy 2715: options),
1.55 jmc 2716: a nonce is automatically added; specifying
1.1 jsing 2717: .Fl no_nonce
2718: overrides this.
2719: .It Fl noverify
1.55 jmc 2720: Don't attempt to verify the OCSP response signature or the nonce values.
2721: This is normally only be used for debugging
1.1 jsing 2722: since it disables all verification of the responder's certificate.
2723: .It Fl out Ar file
1.55 jmc 2724: Specify the output file to write to,
1.57 jmc 2725: or standard output if not specified.
1.1 jsing 2726: .It Fl req_text , resp_text , text
2727: Print out the text form of the OCSP request, response, or both, respectively.
2728: .It Fl reqin Ar file , Fl respin Ar file
2729: Read an OCSP request or response file from
2730: .Ar file .
2731: These options are ignored
2732: if an OCSP request or response creation is implied by other options
2733: (for example with the
2734: .Fl serial , cert ,
2735: and
2736: .Fl host
2737: options).
2738: .It Fl reqout Ar file , Fl respout Ar file
2739: Write out the DER-encoded certificate request or response to
2740: .Ar file .
2741: .It Fl serial Ar num
2742: Same as the
2743: .Fl cert
2744: option except the certificate with serial number
2745: .Ar num
2746: is added to the request.
2747: The serial number is interpreted as a decimal integer unless preceded by
2748: .Sq 0x .
1.55 jmc 2749: Negative integers can also be specified
2750: by preceding the value with a minus sign.
1.1 jsing 2751: .It Fl sign_other Ar file
2752: Additional certificates to include in the signed request.
2753: .It Fl signer Ar file , Fl signkey Ar file
2754: Sign the OCSP request using the certificate specified in the
2755: .Fl signer
2756: option and the private key specified by the
2757: .Fl signkey
2758: option.
2759: If the
2760: .Fl signkey
2761: option is not present, then the private key is read from the same file
2762: as the certificate.
2763: If neither option is specified, the OCSP request is not signed.
1.108 inoguchi 2764: .It Fl timeout Ar seconds
2765: Connection timeout to the OCSP responder in seconds.
1.1 jsing 2766: .It Fl trust_other
2767: The certificates specified by the
2768: .Fl verify_other
2769: option should be explicitly trusted and no additional checks will be
2770: performed on them.
2771: This is useful when the complete responder certificate chain is not available
2772: or trusting a root CA is not appropriate.
2773: .It Fl url Ar responder_url
2774: Specify the responder URL.
2775: Both HTTP and HTTPS
2776: .Pq SSL/TLS
2777: URLs can be specified.
2778: .It Fl VAfile Ar file
1.55 jmc 2779: A file containing explicitly trusted responder certificates.
1.1 jsing 2780: Equivalent to the
2781: .Fl verify_other
2782: and
2783: .Fl trust_other
2784: options.
2785: .It Fl validity_period Ar nsec , Fl status_age Ar age
1.55 jmc 2786: The range of times, in seconds, which will be tolerated in an OCSP response.
2787: Each certificate status response includes a notBefore time
2788: and an optional notAfter time.
1.1 jsing 2789: The current time should fall between these two values,
2790: but the interval between the two times may be only a few seconds.
2791: In practice the OCSP responder and clients' clocks may not be precisely
2792: synchronised and so such a check may fail.
2793: To avoid this the
2794: .Fl validity_period
2795: option can be used to specify an acceptable error range in seconds,
1.55 jmc 2796: the default value being 5 minutes.
1.1 jsing 2797: .Pp
1.55 jmc 2798: If the notAfter time is omitted from a response,
2799: it means that new status information is immediately available.
2800: In this case the age of the notBefore field is checked
2801: to see it is not older than
1.1 jsing 2802: .Ar age
2803: seconds old.
2804: By default, this additional check is not performed.
2805: .It Fl verify_other Ar file
1.55 jmc 2806: A file containing additional certificates to search
2807: when attempting to locate the OCSP response signing certificate.
2808: Some responders omit the actual signer's certificate from the response,
2809: so this can be used to supply the necessary certificate.
1.1 jsing 2810: .El
1.55 jmc 2811: .Pp
2812: The options for the OCSP server are as follows:
1.1 jsing 2813: .Bl -tag -width "XXXX"
2814: .It Fl CA Ar file
2815: CA certificate corresponding to the revocation information in
2816: .Ar indexfile .
1.108 inoguchi 2817: .It Fl ignore_err
2818: Ignore the invalid response.
1.1 jsing 2819: .It Fl index Ar indexfile
2820: .Ar indexfile
1.55 jmc 2821: is a text index file in ca format
2822: containing certificate revocation information.
1.1 jsing 2823: .Pp
1.55 jmc 2824: If this option is specified,
1.1 jsing 2825: .Nm ocsp
1.55 jmc 2826: is in responder mode, otherwise it is in client mode.
2827: The requests the responder processes can be either specified on
1.1 jsing 2828: the command line (using the
2829: .Fl issuer
2830: and
2831: .Fl serial
2832: options), supplied in a file (using the
2833: .Fl respin
1.55 jmc 2834: option), or via external OCSP clients (if
1.1 jsing 2835: .Ar port
2836: or
2837: .Ar url
2838: is specified).
2839: .Pp
1.55 jmc 2840: If this option is present, then the
1.1 jsing 2841: .Fl CA
2842: and
2843: .Fl rsigner
2844: options must also be present.
2845: .It Fl nmin Ar minutes , Fl ndays Ar days
2846: Number of
2847: .Ar minutes
2848: or
2849: .Ar days
1.55 jmc 2850: when fresh revocation information is available:
2851: used in the nextUpdate field.
2852: If neither option is present,
2853: the nextUpdate field is omitted,
2854: meaning fresh revocation information is immediately available.
1.1 jsing 2855: .It Fl nrequest Ar number
1.55 jmc 2856: Exit after receiving
1.1 jsing 2857: .Ar number
1.55 jmc 2858: requests (the default is unlimited).
1.1 jsing 2859: .It Fl port Ar portnum
2860: Port to listen for OCSP requests on.
1.55 jmc 2861: May also be specified using the
1.1 jsing 2862: .Fl url
2863: option.
2864: .It Fl resp_key_id
2865: Identify the signer certificate using the key ID;
1.55 jmc 2866: the default is to use the subject name.
1.1 jsing 2867: .It Fl resp_no_certs
2868: Don't include any certificates in the OCSP response.
2869: .It Fl rkey Ar file
2870: The private key to sign OCSP responses with;
2871: if not present, the file specified in the
2872: .Fl rsigner
2873: option is used.
2874: .It Fl rother Ar file
2875: Additional certificates to include in the OCSP response.
2876: .It Fl rsigner Ar file
2877: The certificate to sign OCSP responses with.
2878: .El
2879: .Pp
2880: Initially the OCSP responder certificate is located and the signature on
2881: the OCSP request checked using the responder certificate's public key.
2882: Then a normal certificate verify is performed on the OCSP responder certificate
2883: building up a certificate chain in the process.
2884: The locations of the trusted certificates used to build the chain can be
2885: specified by the
2886: .Fl CAfile
2887: and
2888: .Fl CApath
2889: options or they will be looked for in the standard
1.55 jmc 2890: .Nm openssl
2891: certificates directory.
1.1 jsing 2892: .Pp
1.55 jmc 2893: If the initial verify fails, the OCSP verify process halts with an error.
1.1 jsing 2894: Otherwise the issuing CA certificate in the request is compared to the OCSP
2895: responder certificate: if there is a match then the OCSP verify succeeds.
2896: .Pp
2897: Otherwise the OCSP responder certificate's CA is checked against the issuing
2898: CA certificate in the request.
2899: If there is a match and the OCSPSigning extended key usage is present
2900: in the OCSP responder certificate, then the OCSP verify succeeds.
2901: .Pp
2902: Otherwise the root CA of the OCSP responder's CA is checked to see if it
2903: is trusted for OCSP signing.
2904: If it is, the OCSP verify succeeds.
2905: .Pp
2906: If none of these checks is successful, the OCSP verify fails.
2907: What this effectively means is that if the OCSP responder certificate is
2908: authorised directly by the CA it is issuing revocation information about
1.55 jmc 2909: (and it is correctly configured),
1.1 jsing 2910: then verification will succeed.
2911: .Pp
1.55 jmc 2912: If the OCSP responder is a global responder,
2913: which can give details about multiple CAs
2914: and has its own separate certificate chain,
2915: then its root CA can be trusted for OCSP signing.
1.1 jsing 2916: Alternatively, the responder certificate itself can be explicitly trusted
2917: with the
2918: .Fl VAfile
2919: option.
1.120 kn 2920: .Tg passwd
1.1 jsing 2921: .Sh PASSWD
1.114 jmc 2922: .Bl -hang -width "openssl passwd"
2923: .It Nm openssl passwd
2924: .Bk -words
1.1 jsing 2925: .Op Fl 1 | apr1 | crypt
2926: .Op Fl in Ar file
2927: .Op Fl noverify
2928: .Op Fl quiet
2929: .Op Fl reverse
2930: .Op Fl salt Ar string
2931: .Op Fl stdin
2932: .Op Fl table
2933: .Op Ar password
1.114 jmc 2934: .Ek
2935: .El
1.1 jsing 2936: .Pp
2937: The
2938: .Nm passwd
1.56 jmc 2939: command computes the hash of a password.
1.1 jsing 2940: .Pp
2941: The options are as follows:
2942: .Bl -tag -width Ds
2943: .It Fl 1
2944: Use the MD5 based
2945: .Bx
2946: password algorithm
1.56 jmc 2947: .Qq 1 .
1.1 jsing 2948: .It Fl apr1
2949: Use the
1.56 jmc 2950: .Qq apr1
1.1 jsing 2951: algorithm
1.56 jmc 2952: .Po
2953: Apache variant of the
1.1 jsing 2954: .Bx
1.56 jmc 2955: algorithm
2956: .Pc .
1.1 jsing 2957: .It Fl crypt
2958: Use the
1.56 jmc 2959: .Qq crypt
2960: algorithm (the default).
1.1 jsing 2961: .It Fl in Ar file
2962: Read passwords from
2963: .Ar file .
2964: .It Fl noverify
2965: Don't verify when reading a password from the terminal.
2966: .It Fl quiet
2967: Don't output warnings when passwords given on the command line are truncated.
2968: .It Fl reverse
2969: Switch table columns.
2970: This only makes sense in conjunction with the
2971: .Fl table
2972: option.
2973: .It Fl salt Ar string
1.56 jmc 2974: Use the salt specified by
2975: .Ar string .
1.1 jsing 2976: When reading a password from the terminal, this implies
2977: .Fl noverify .
2978: .It Fl stdin
1.56 jmc 2979: Read passwords from standard input.
1.1 jsing 2980: .It Fl table
2981: In the output list, prepend the cleartext password and a TAB character
2982: to each password hash.
2983: .El
1.120 kn 2984: .Tg pkcs7
1.1 jsing 2985: .Sh PKCS7
1.114 jmc 2986: .Bl -hang -width "openssl pkcs7"
2987: .It Nm openssl pkcs7
2988: .Bk -words
1.1 jsing 2989: .Op Fl in Ar file
1.57 jmc 2990: .Op Fl inform Cm der | pem
1.1 jsing 2991: .Op Fl noout
2992: .Op Fl out Ar file
1.57 jmc 2993: .Op Fl outform Cm der | pem
1.106 inoguchi 2994: .Op Fl print
1.1 jsing 2995: .Op Fl print_certs
2996: .Op Fl text
1.114 jmc 2997: .Ek
2998: .El
1.1 jsing 2999: .Pp
3000: The
3001: .Nm pkcs7
3002: command processes PKCS#7 files in DER or PEM format.
1.57 jmc 3003: The PKCS#7 routines only understand PKCS#7 v 1.5 as specified in RFC 2315.
3004: .Pp
1.1 jsing 3005: The options are as follows:
3006: .Bl -tag -width Ds
3007: .It Fl in Ar file
1.57 jmc 3008: The input file to read from,
3009: or standard input if not specified.
3010: .It Fl inform Cm der | pem
3011: The input format.
1.1 jsing 3012: .It Fl noout
3013: Don't output the encoded version of the PKCS#7 structure
3014: (or certificates if
3015: .Fl print_certs
3016: is set).
3017: .It Fl out Ar file
1.57 jmc 3018: The output to write to,
3019: or standard output if not specified.
3020: .It Fl outform Cm der | pem
3021: The output format.
1.106 inoguchi 3022: .It Fl print
3023: Print the ASN.1 representation of PKCS#7 structure.
1.1 jsing 3024: .It Fl print_certs
1.57 jmc 3025: Print any certificates or CRLs contained in the file,
3026: preceded by their subject and issuer names in a one-line format.
1.1 jsing 3027: .It Fl text
1.57 jmc 3028: Print certificate details in full rather than just subject and issuer names.
1.1 jsing 3029: .El
1.120 kn 3030: .Tg pkcs8
1.1 jsing 3031: .Sh PKCS8
1.114 jmc 3032: .Bl -hang -width "openssl pkcs8"
3033: .It Nm openssl pkcs8
3034: .Bk -words
1.1 jsing 3035: .Op Fl in Ar file
1.58 jmc 3036: .Op Fl inform Cm der | pem
1.1 jsing 3037: .Op Fl nocrypt
3038: .Op Fl noiter
3039: .Op Fl out Ar file
1.58 jmc 3040: .Op Fl outform Cm der | pem
1.1 jsing 3041: .Op Fl passin Ar arg
3042: .Op Fl passout Ar arg
3043: .Op Fl topk8
3044: .Op Fl v1 Ar alg
3045: .Op Fl v2 Ar alg
1.114 jmc 3046: .Ek
3047: .El
1.1 jsing 3048: .Pp
3049: The
3050: .Nm pkcs8
1.58 jmc 3051: command processes private keys
3052: (both encrypted and unencrypted)
3053: in PKCS#8 format
3054: with a variety of PKCS#5 (v1.5 and v2.0) and PKCS#12 algorithms.
3055: The default encryption is only 56 bits;
3056: keys encrypted using PKCS#5 v2.0 algorithms and high iteration counts
3057: are more secure.
3058: .Pp
1.1 jsing 3059: The options are as follows:
3060: .Bl -tag -width Ds
3061: .It Fl in Ar file
1.58 jmc 3062: The input file to read from,
3063: or standard input if not specified.
1.1 jsing 3064: If the key is encrypted, a pass phrase will be prompted for.
1.58 jmc 3065: .It Fl inform Cm der | pem
3066: The input format.
1.1 jsing 3067: .It Fl nocrypt
1.58 jmc 3068: Generate an unencrypted PrivateKeyInfo structure.
3069: This option does not encrypt private keys at all
3070: and should only be used when absolutely necessary.
1.1 jsing 3071: .It Fl noiter
3072: Use an iteration count of 1.
3073: See the
3074: .Sx PKCS12
3075: section below for a detailed explanation of this option.
3076: .It Fl out Ar file
1.58 jmc 3077: The output file to write to,
3078: or standard output if none is specified.
1.1 jsing 3079: If any encryption options are set, a pass phrase will be prompted for.
1.58 jmc 3080: .It Fl outform Cm der | pem
3081: The output format.
1.1 jsing 3082: .It Fl passin Ar arg
3083: The key password source.
3084: .It Fl passout Ar arg
3085: The output file password source.
3086: .It Fl topk8
1.58 jmc 3087: Read a traditional format private key and write a PKCS#8 format key.
1.1 jsing 3088: .It Fl v1 Ar alg
1.58 jmc 3089: Specify a PKCS#5 v1.5 or PKCS#12 algorithm to use.
3090: .Pp
3091: .Bl -tag -width "XXXX" -compact
3092: .It PBE-MD5-DES
3093: 56-bit DES.
3094: .It PBE-SHA1-RC2-64 | PBE-MD5-RC2-64 | PBE-SHA1-DES
3095: 64-bit RC2 or 56-bit DES.
3096: .It PBE-SHA1-RC4-128 | PBE-SHA1-RC4-40 | PBE-SHA1-3DES
3097: .It PBE-SHA1-2DES | PBE-SHA1-RC2-128 | PBE-SHA1-RC2-40
3098: PKCS#12 password-based encryption algorithm,
3099: which allow strong encryption algorithms like triple DES or 128-bit RC2.
3100: .El
1.1 jsing 3101: .It Fl v2 Ar alg
1.58 jmc 3102: Use PKCS#5 v2.0 algorithms.
3103: Supports algorithms such as 168-bit triple DES or 128-bit RC2,
3104: however not many implementations support PKCS#5 v2.0 yet
3105: (if using private keys with
3106: .Nm openssl
3107: this doesn't matter).
1.1 jsing 3108: .Pp
3109: .Ar alg
1.58 jmc 3110: is the encryption algorithm to use;
3111: valid values include des, des3, and rc2.
3112: It is recommended that des3 is used.
1.1 jsing 3113: .El
1.120 kn 3114: .Tg pkcs12
1.1 jsing 3115: .Sh PKCS12
1.114 jmc 3116: .Bl -hang -width "openssl pkcs12"
3117: .It Nm openssl pkcs12
3118: .Bk -words
1.107 inoguchi 3119: .Oo
3120: .Fl aes128 | aes192 | aes256 | camellia128 |
3121: .Fl camellia192 | camellia256 | des | des3 | idea
3122: .Oc
1.1 jsing 3123: .Op Fl cacerts
3124: .Op Fl CAfile Ar file
3125: .Op Fl caname Ar name
3126: .Op Fl CApath Ar directory
3127: .Op Fl certfile Ar file
3128: .Op Fl certpbe Ar alg
3129: .Op Fl chain
3130: .Op Fl clcerts
3131: .Op Fl CSP Ar name
3132: .Op Fl descert
3133: .Op Fl export
3134: .Op Fl in Ar file
3135: .Op Fl info
3136: .Op Fl inkey Ar file
3137: .Op Fl keyex
3138: .Op Fl keypbe Ar alg
3139: .Op Fl keysig
1.107 inoguchi 3140: .Op Fl LMK
1.1 jsing 3141: .Op Fl macalg Ar alg
3142: .Op Fl maciter
3143: .Op Fl name Ar name
3144: .Op Fl nocerts
3145: .Op Fl nodes
3146: .Op Fl noiter
3147: .Op Fl nokeys
3148: .Op Fl nomac
3149: .Op Fl nomaciter
3150: .Op Fl nomacver
3151: .Op Fl noout
3152: .Op Fl out Ar file
3153: .Op Fl passin Ar arg
3154: .Op Fl passout Ar arg
1.107 inoguchi 3155: .Op Fl password Ar arg
1.1 jsing 3156: .Op Fl twopass
1.114 jmc 3157: .Ek
3158: .El
1.1 jsing 3159: .Pp
3160: The
3161: .Nm pkcs12
3162: command allows PKCS#12 files
3163: .Pq sometimes referred to as PFX files
3164: to be created and parsed.
3165: By default, a PKCS#12 file is parsed;
3166: a PKCS#12 file can be created by using the
3167: .Fl export
1.59 jmc 3168: option.
3169: .Pp
3170: The options for parsing a PKCS12 file are as follows:
1.1 jsing 3171: .Bl -tag -width "XXXX"
1.107 inoguchi 3172: .It Xo
3173: .Fl aes128 | aes192 | aes256 |
3174: .Fl camellia128 | camellia192 | camellia256 |
3175: .Fl des | des3 |
3176: .Fl idea
3177: .Xc
3178: Encrypt private keys using AES, CAMELLIA, DES, triple DES
3179: or the IDEA ciphers, respectively.
1.1 jsing 3180: The default is triple DES.
3181: .It Fl cacerts
3182: Only output CA certificates
3183: .Pq not client certificates .
3184: .It Fl clcerts
3185: Only output client certificates
3186: .Pq not CA certificates .
3187: .It Fl in Ar file
1.59 jmc 3188: The input file to read from,
3189: or standard input if not specified.
1.1 jsing 3190: .It Fl info
3191: Output additional information about the PKCS#12 file structure,
3192: algorithms used, and iteration counts.
3193: .It Fl nocerts
1.59 jmc 3194: Do not output certificates.
1.1 jsing 3195: .It Fl nodes
1.59 jmc 3196: Do not encrypt private keys.
1.1 jsing 3197: .It Fl nokeys
1.59 jmc 3198: Do not output private keys.
1.1 jsing 3199: .It Fl nomacver
1.59 jmc 3200: Do not attempt to verify the integrity MAC before reading the file.
1.1 jsing 3201: .It Fl noout
1.59 jmc 3202: Do not output the keys and certificates to the output file
1.1 jsing 3203: version of the PKCS#12 file.
3204: .It Fl out Ar file
1.59 jmc 3205: The output file to write to,
3206: or standard output if not specified.
1.1 jsing 3207: .It Fl passin Ar arg
3208: The key password source.
3209: .It Fl passout Ar arg
3210: The output file password source.
3211: .It Fl twopass
3212: Prompt for separate integrity and encryption passwords: most software
3213: always assumes these are the same so this option will render such
3214: PKCS#12 files unreadable.
3215: .El
1.59 jmc 3216: .Pp
3217: The options for PKCS12 file creation are as follows:
1.1 jsing 3218: .Bl -tag -width "XXXX"
3219: .It Fl CAfile Ar file
3220: CA storage as a file.
3221: .It Fl CApath Ar directory
3222: CA storage as a directory.
1.59 jmc 3223: The directory must be a standard certificate directory:
1.1 jsing 3224: that is, a hash of each subject name (using
1.59 jmc 3225: .Nm x509 Fl hash )
1.1 jsing 3226: should be linked to each certificate.
3227: .It Fl caname Ar name
1.59 jmc 3228: Specify the
1.1 jsing 3229: .Qq friendly name
3230: for other certificates.
1.59 jmc 3231: May be used multiple times to specify names for all certificates
1.1 jsing 3232: in the order they appear.
3233: .It Fl certfile Ar file
3234: A file to read additional certificates from.
3235: .It Fl certpbe Ar alg , Fl keypbe Ar alg
1.59 jmc 3236: Specify the algorithm used to encrypt the private key and
1.1 jsing 3237: certificates to be selected.
1.59 jmc 3238: Any PKCS#5 v1.5 or PKCS#12 PBE algorithm name can be used.
1.1 jsing 3239: If a cipher name
3240: (as output by the
3241: .Cm list-cipher-algorithms
3242: command) is specified then it
3243: is used with PKCS#5 v2.0.
3244: For interoperability reasons it is advisable to only use PKCS#12 algorithms.
3245: .It Fl chain
1.59 jmc 3246: Include the entire certificate chain of the user certificate.
1.1 jsing 3247: The standard CA store is used for this search.
3248: If the search fails, it is considered a fatal error.
3249: .It Fl CSP Ar name
3250: Write
3251: .Ar name
3252: as a Microsoft CSP name.
3253: .It Fl descert
3254: Encrypt the certificate using triple DES; this may render the PKCS#12
3255: file unreadable by some
3256: .Qq export grade
3257: software.
3258: By default, the private key is encrypted using triple DES and the
3259: certificate using 40-bit RC2.
3260: .It Fl export
1.59 jmc 3261: Create a PKCS#12 file (rather than parsing one).
1.1 jsing 3262: .It Fl in Ar file
1.59 jmc 3263: The input file to read from,
1.81 jmc 3264: or standard input if not specified.
1.1 jsing 3265: The order doesn't matter but one private key and its corresponding
3266: certificate should be present.
3267: If additional certificates are present, they will also be included
3268: in the PKCS#12 file.
3269: .It Fl inkey Ar file
1.59 jmc 3270: File to read a private key from.
1.1 jsing 3271: If not present, a private key must be present in the input file.
3272: .It Fl keyex | keysig
1.59 jmc 3273: Specify whether the private key is to be used for key exchange or just signing.
1.1 jsing 3274: Normally,
3275: .Qq export grade
3276: software will only allow 512-bit RSA keys to be
3277: used for encryption purposes, but arbitrary length keys for signing.
3278: The
3279: .Fl keysig
3280: option marks the key for signing only.
3281: Signing only keys can be used for S/MIME signing, authenticode
1.66 jmc 3282: (ActiveX control signing)
1.59 jmc 3283: and SSL client authentication.
1.107 inoguchi 3284: .It Fl LMK
3285: Add local machine keyset attribute to private key.
1.1 jsing 3286: .It Fl macalg Ar alg
3287: Specify the MAC digest algorithm.
1.59 jmc 3288: The default is SHA1.
1.1 jsing 3289: .It Fl maciter
1.66 jmc 3290: Included for compatibility only:
1.59 jmc 3291: it used to be needed to use MAC iterations counts
3292: but they are now used by default.
1.1 jsing 3293: .It Fl name Ar name
1.59 jmc 3294: Specify the
1.1 jsing 3295: .Qq friendly name
3296: for the certificate and private key.
3297: This name is typically displayed in list boxes by software importing the file.
3298: .It Fl nomac
3299: Don't attempt to provide the MAC integrity.
3300: .It Fl nomaciter , noiter
1.59 jmc 3301: Affect the iteration counts on the MAC and key algorithms.
1.1 jsing 3302: .Pp
3303: To discourage attacks by using large dictionaries of common passwords,
3304: the algorithm that derives keys from passwords can have an iteration count
3305: applied to it: this causes a certain part of the algorithm to be repeated
3306: and slows it down.
3307: The MAC is used to check the file integrity but since it will normally
3308: have the same password as the keys and certificates it could also be attacked.
3309: By default, both MAC and encryption iteration counts are set to 2048;
3310: using these options the MAC and encryption iteration counts can be set to 1.
1.137 naddy 3311: Since this reduces the file security, you should not use these options
1.1 jsing 3312: unless you really have to.
3313: Most software supports both MAC and key iteration counts.
3314: .It Fl out Ar file
1.59 jmc 3315: The output file to write to,
3316: or standard output if not specified.
1.1 jsing 3317: .It Fl passin Ar arg
3318: The key password source.
3319: .It Fl passout Ar arg
3320: The output file password source.
1.107 inoguchi 3321: .It Fl password Ar arg
3322: With
3323: .Fl export ,
3324: .Fl password
3325: is equivalent to
3326: .Fl passout .
1.108 inoguchi 3327: Otherwise,
1.107 inoguchi 3328: .Fl password
3329: is equivalent to
3330: .Fl passin .
1.1 jsing 3331: .El
1.120 kn 3332: .Tg pkey
1.1 jsing 3333: .Sh PKEY
1.114 jmc 3334: .Bl -hang -width "openssl pkey"
3335: .It Nm openssl pkey
3336: .Bk -words
1.135 tb 3337: .Op Fl check
1.1 jsing 3338: .Op Ar cipher
3339: .Op Fl in Ar file
1.60 jmc 3340: .Op Fl inform Cm der | pem
1.1 jsing 3341: .Op Fl noout
3342: .Op Fl out Ar file
1.60 jmc 3343: .Op Fl outform Cm der | pem
1.1 jsing 3344: .Op Fl passin Ar arg
3345: .Op Fl passout Ar arg
1.135 tb 3346: .Op Fl pubcheck
1.1 jsing 3347: .Op Fl pubin
3348: .Op Fl pubout
3349: .Op Fl text
3350: .Op Fl text_pub
1.114 jmc 3351: .Ek
3352: .El
1.1 jsing 3353: .Pp
3354: The
3355: .Nm pkey
3356: command processes public or private keys.
3357: They can be converted between various forms
3358: and their components printed out.
3359: .Pp
3360: The options are as follows:
3361: .Bl -tag -width Ds
1.135 tb 3362: .It Fl check
3363: Check the validity of a key pair.
1.1 jsing 3364: .It Ar cipher
1.60 jmc 3365: Encrypt the private key with the specified cipher.
1.1 jsing 3366: Any algorithm name accepted by
1.60 jmc 3367: .Xr EVP_get_cipherbyname 3
1.1 jsing 3368: is acceptable, such as
3369: .Cm des3 .
3370: .It Fl in Ar file
1.60 jmc 3371: The input file to read from,
3372: or standard input if not specified.
1.127 jmc 3373: If the key is encrypted, a pass phrase will be prompted for.
1.60 jmc 3374: .It Fl inform Cm der | pem
3375: The input format.
1.1 jsing 3376: .It Fl noout
3377: Do not output the encoded version of the key.
3378: .It Fl out Ar file
1.60 jmc 3379: The output file to write to,
3380: or standard output if not specified.
1.1 jsing 3381: If any encryption options are set then a pass phrase
3382: will be prompted for.
1.60 jmc 3383: .It Fl outform Cm der | pem
3384: The output format.
1.1 jsing 3385: .It Fl passin Ar arg
3386: The key password source.
3387: .It Fl passout Ar arg
3388: The output file password source.
1.135 tb 3389: .It Fl pubcheck
3390: Check the validity of a public key
3391: or the public component of a key pair.
1.1 jsing 3392: .It Fl pubin
1.60 jmc 3393: Read in a public key, not a private key.
1.1 jsing 3394: .It Fl pubout
1.60 jmc 3395: Output a public key, not a private key.
3396: Automatically set if the input is a public key.
1.1 jsing 3397: .It Fl text
1.64 jmc 3398: Print the public/private key in plain text.
1.1 jsing 3399: .It Fl text_pub
3400: Print out only public key components
3401: even if a private key is being processed.
3402: .El
1.120 kn 3403: .Tg pkeyparam
1.1 jsing 3404: .Sh PKEYPARAM
3405: .Cm openssl pkeyparam
1.135 tb 3406: .Op Fl check
1.1 jsing 3407: .Op Fl in Ar file
3408: .Op Fl noout
3409: .Op Fl out Ar file
3410: .Op Fl text
3411: .Pp
3412: The
1.61 jmc 3413: .Nm pkeyparam
1.1 jsing 3414: command processes public or private keys.
1.61 jmc 3415: The key type is determined by the PEM headers.
1.1 jsing 3416: .Pp
3417: The options are as follows:
3418: .Bl -tag -width Ds
1.135 tb 3419: .It Fl check
3420: check the correctness of parameters.
1.1 jsing 3421: .It Fl in Ar file
1.61 jmc 3422: The input file to read from,
3423: or standard input if not specified.
1.1 jsing 3424: .It Fl noout
3425: Do not output the encoded version of the parameters.
3426: .It Fl out Ar file
1.61 jmc 3427: The output file to write to,
3428: or standard output if not specified.
1.1 jsing 3429: .It Fl text
1.64 jmc 3430: Print the parameters in plain text.
1.1 jsing 3431: .El
1.120 kn 3432: .Tg pkeyutl
1.1 jsing 3433: .Sh PKEYUTL
1.114 jmc 3434: .Bl -hang -width "openssl pkeyutl"
3435: .It Nm openssl pkeyutl
3436: .Bk -words
1.1 jsing 3437: .Op Fl asn1parse
3438: .Op Fl certin
3439: .Op Fl decrypt
3440: .Op Fl derive
3441: .Op Fl encrypt
3442: .Op Fl hexdump
3443: .Op Fl in Ar file
3444: .Op Fl inkey Ar file
1.62 jmc 3445: .Op Fl keyform Cm der | pem
1.1 jsing 3446: .Op Fl out Ar file
3447: .Op Fl passin Ar arg
1.62 jmc 3448: .Op Fl peerform Cm der | pem
1.1 jsing 3449: .Op Fl peerkey Ar file
3450: .Op Fl pkeyopt Ar opt : Ns Ar value
3451: .Op Fl pubin
3452: .Op Fl rev
3453: .Op Fl sigfile Ar file
3454: .Op Fl sign
3455: .Op Fl verify
3456: .Op Fl verifyrecover
1.114 jmc 3457: .Ek
3458: .El
1.1 jsing 3459: .Pp
3460: The
3461: .Nm pkeyutl
3462: command can be used to perform public key operations using
3463: any supported algorithm.
3464: .Pp
3465: The options are as follows:
3466: .Bl -tag -width Ds
3467: .It Fl asn1parse
1.84 jmc 3468: ASN.1 parse the output data.
1.1 jsing 3469: This is useful when combined with the
3470: .Fl verifyrecover
1.84 jmc 3471: option when an ASN.1 structure is signed.
1.1 jsing 3472: .It Fl certin
3473: The input is a certificate containing a public key.
3474: .It Fl decrypt
3475: Decrypt the input data using a private key.
3476: .It Fl derive
3477: Derive a shared secret using the peer key.
3478: .It Fl encrypt
3479: Encrypt the input data using a public key.
3480: .It Fl hexdump
3481: Hex dump the output data.
3482: .It Fl in Ar file
1.62 jmc 3483: The input file to read from,
3484: or standard input if not specified.
1.1 jsing 3485: .It Fl inkey Ar file
3486: The input key file.
3487: By default it should be a private key.
1.62 jmc 3488: .It Fl keyform Cm der | pem
3489: The key format.
1.1 jsing 3490: .It Fl out Ar file
1.62 jmc 3491: The output file to write to,
3492: or standard output if not specified.
1.1 jsing 3493: .It Fl passin Ar arg
3494: The key password source.
1.62 jmc 3495: .It Fl peerform Cm der | pem
3496: The peer key format.
1.1 jsing 3497: .It Fl peerkey Ar file
3498: The peer key file, used by key derivation (agreement) operations.
3499: .It Fl pkeyopt Ar opt : Ns Ar value
1.62 jmc 3500: Set the public key algorithm option
3501: .Ar opt
3502: to
3503: .Ar value .
3504: Unless otherwise mentioned, all algorithms support the format
3505: .Ar digest : Ns Ar alg ,
3506: which specifies the digest to use
1.1 jsing 3507: for sign, verify, and verifyrecover operations.
3508: The value
3509: .Ar alg
3510: should represent a digest name as used in the
1.62 jmc 3511: .Xr EVP_get_digestbyname 3
3512: function.
3513: .Pp
1.1 jsing 3514: The RSA algorithm supports the
3515: encrypt, decrypt, sign, verify, and verifyrecover operations in general.
3516: Some padding modes only support some of these
3517: operations however.
3518: .Bl -tag -width Ds
3519: .It rsa_padding_mode : Ns Ar mode
3520: This sets the RSA padding mode.
3521: Acceptable values for
3522: .Ar mode
3523: are
3524: .Cm pkcs1
3525: for PKCS#1 padding;
3526: .Cm none
3527: for no padding;
3528: .Cm oaep
3529: for OAEP mode;
3530: .Cm x931
3531: for X9.31 mode;
3532: and
3533: .Cm pss
3534: for PSS.
3535: .Pp
3536: In PKCS#1 padding if the message digest is not set then the supplied data is
3537: signed or verified directly instead of using a DigestInfo structure.
3538: If a digest is set then a DigestInfo
3539: structure is used and its length
3540: must correspond to the digest type.
3541: For oeap mode only encryption and decryption is supported.
3542: For x931 if the digest type is set it is used to format the block data;
3543: otherwise the first byte is used to specify the X9.31 digest ID.
3544: Sign, verify, and verifyrecover can be performed in this mode.
3545: For pss mode only sign and verify are supported and the digest type must be
3546: specified.
3547: .It rsa_pss_saltlen : Ns Ar len
3548: For pss
3549: mode only this option specifies the salt length.
3550: Two special values are supported:
3551: -1 sets the salt length to the digest length.
1.127 jmc 3552: When signing, -2 sets the salt length to the maximum permissible value.
3553: When verifying, -2 causes the salt length to be automatically determined
1.1 jsing 3554: based on the PSS block structure.
3555: .El
1.62 jmc 3556: .Pp
1.1 jsing 3557: The DSA algorithm supports the sign and verify operations.
3558: Currently there are no additional options other than
3559: .Ar digest .
3560: Only the SHA1 digest can be used and this digest is assumed by default.
1.62 jmc 3561: .Pp
1.1 jsing 3562: The DH algorithm supports the derive operation
3563: and no additional options.
1.62 jmc 3564: .Pp
1.1 jsing 3565: The EC algorithm supports the sign, verify, and derive operations.
3566: The sign and verify operations use ECDSA and derive uses ECDH.
3567: Currently there are no additional options other than
3568: .Ar digest .
3569: Only the SHA1 digest can be used and this digest is assumed by default.
1.62 jmc 3570: .It Fl pubin
3571: The input file is a public key.
3572: .It Fl rev
3573: Reverse the order of the input buffer.
3574: .It Fl sigfile Ar file
3575: Signature file (verify operation only).
3576: .It Fl sign
3577: Sign the input data and output the signed result.
3578: This requires a private key.
3579: .It Fl verify
3580: Verify the input data against the signature file and indicate if the
3581: verification succeeded or failed.
3582: .It Fl verifyrecover
3583: Verify the input data and output the recovered data.
3584: .El
1.120 kn 3585: .Tg prime
1.1 jsing 3586: .Sh PRIME
3587: .Cm openssl prime
3588: .Op Fl bits Ar n
3589: .Op Fl checks Ar n
3590: .Op Fl generate
3591: .Op Fl hex
3592: .Op Fl safe
3593: .Ar p
3594: .Pp
3595: The
3596: .Nm prime
3597: command is used to generate prime numbers,
3598: or to check numbers for primality.
3599: Results are probabilistic:
3600: they have an exceedingly high likelihood of being correct,
3601: but are not guaranteed.
3602: .Pp
3603: The options are as follows:
3604: .Bl -tag -width Ds
3605: .It Fl bits Ar n
3606: Specify the number of bits in the generated prime number.
3607: Must be used in conjunction with
3608: .Fl generate .
3609: .It Fl checks Ar n
3610: Perform a Miller-Rabin probabilistic primality test with
3611: .Ar n
3612: iterations.
3613: The default is 20.
3614: .It Fl generate
3615: Generate a pseudo-random prime number.
3616: Must be used in conjunction with
3617: .Fl bits .
3618: .It Fl hex
3619: Output in hex format.
3620: .It Fl safe
3621: Generate only
3622: .Qq safe
3623: prime numbers
3624: (i.e. a prime p so that (p-1)/2 is also prime).
3625: .It Ar p
3626: Test if number
3627: .Ar p
3628: is prime.
3629: .El
1.120 kn 3630: .Tg rand
1.1 jsing 3631: .Sh RAND
1.114 jmc 3632: .Bl -hang -width "openssl rand"
3633: .It Nm openssl rand
3634: .Bk -words
1.1 jsing 3635: .Op Fl base64
3636: .Op Fl hex
3637: .Op Fl out Ar file
3638: .Ar num
1.114 jmc 3639: .Ek
3640: .El
1.1 jsing 3641: .Pp
3642: The
3643: .Nm rand
3644: command outputs
3645: .Ar num
3646: pseudo-random bytes.
3647: .Pp
3648: The options are as follows:
3649: .Bl -tag -width Ds
3650: .It Fl base64
1.81 jmc 3651: Perform base64 encoding on the output.
1.1 jsing 3652: .It Fl hex
3653: Specify hexadecimal output.
3654: .It Fl out Ar file
1.63 jmc 3655: The output file to write to,
3656: or standard output if not specified.
1.1 jsing 3657: .El
1.120 kn 3658: .Tg req
1.1 jsing 3659: .Sh REQ
1.114 jmc 3660: .Bl -hang -width "openssl req"
3661: .It Nm openssl req
3662: .Bk -words
1.115 inoguchi 3663: .Op Fl addext Ar ext
1.1 jsing 3664: .Op Fl batch
3665: .Op Fl config Ar file
3666: .Op Fl days Ar n
3667: .Op Fl extensions Ar section
3668: .Op Fl in Ar file
1.63 jmc 3669: .Op Fl inform Cm der | pem
1.1 jsing 3670: .Op Fl key Ar keyfile
1.63 jmc 3671: .Op Fl keyform Cm der | pem
1.1 jsing 3672: .Op Fl keyout Ar file
1.28 doug 3673: .Op Fl md4 | md5 | sha1
1.1 jsing 3674: .Op Fl modulus
1.107 inoguchi 3675: .Op Fl multivalue-rdn
1.1 jsing 3676: .Op Fl nameopt Ar option
3677: .Op Fl new
3678: .Op Fl newhdr
3679: .Op Fl newkey Ar arg
3680: .Op Fl nodes
3681: .Op Fl noout
3682: .Op Fl out Ar file
1.63 jmc 3683: .Op Fl outform Cm der | pem
1.1 jsing 3684: .Op Fl passin Ar arg
3685: .Op Fl passout Ar arg
1.107 inoguchi 3686: .Op Fl pkeyopt Ar opt:value
1.1 jsing 3687: .Op Fl pubkey
3688: .Op Fl reqexts Ar section
3689: .Op Fl reqopt Ar option
3690: .Op Fl set_serial Ar n
1.107 inoguchi 3691: .Op Fl sigopt Ar nm:v
1.1 jsing 3692: .Op Fl subj Ar arg
3693: .Op Fl subject
3694: .Op Fl text
3695: .Op Fl utf8
3696: .Op Fl verbose
3697: .Op Fl verify
3698: .Op Fl x509
1.114 jmc 3699: .Ek
3700: .El
1.1 jsing 3701: .Pp
3702: The
3703: .Nm req
3704: command primarily creates and processes certificate requests
3705: in PKCS#10 format.
3706: It can additionally create self-signed certificates,
3707: for use as root CAs, for example.
3708: .Pp
3709: The options are as follows:
3710: .Bl -tag -width Ds
1.115 inoguchi 3711: .It Fl addext Ar ext
3712: Add a specific extension to the certificate (if the
3713: .Fl x509
3714: option is present) or certificate request.
3715: The argument must have the form of a key=value pair as it would appear in a
3716: config file.
3717: This option can be given multiple times.
1.1 jsing 3718: .It Fl batch
3719: Non-interactive mode.
3720: .It Fl config Ar file
1.63 jmc 3721: Specify an alternative configuration file.
1.1 jsing 3722: .It Fl days Ar n
1.63 jmc 3723: Specify the number of days to certify the certificate for.
3724: The default is 30 days.
3725: Used with the
1.1 jsing 3726: .Fl x509
1.63 jmc 3727: option.
1.1 jsing 3728: .It Fl extensions Ar section , Fl reqexts Ar section
1.63 jmc 3729: Specify alternative sections to include certificate
3730: extensions (with
3731: .Fl x509 )
3732: or certificate request extensions,
3733: allowing several different sections to be used in the same configuration file.
1.1 jsing 3734: .It Fl in Ar file
1.63 jmc 3735: The input file to read a request from,
3736: or standard input if not specified.
1.1 jsing 3737: A request is only read if the creation options
3738: .Fl new
3739: and
3740: .Fl newkey
3741: are not specified.
1.63 jmc 3742: .It Fl inform Cm der | pem
3743: The input format.
1.1 jsing 3744: .It Fl key Ar keyfile
1.63 jmc 3745: The file to read the private key from.
1.1 jsing 3746: It also accepts PKCS#8 format private keys for PEM format files.
1.63 jmc 3747: .It Fl keyform Cm der | pem
1.1 jsing 3748: The format of the private key file specified in the
3749: .Fl key
3750: argument.
1.81 jmc 3751: The default is
3752: .Cm pem .
1.1 jsing 3753: .It Fl keyout Ar file
1.63 jmc 3754: The file to write the newly created private key to.
3755: If this option is not specified,
3756: the filename present in the configuration file is used.
1.4 sthen 3757: .It Fl md5 | sha1 | sha256
1.63 jmc 3758: The message digest to sign the request with.
1.1 jsing 3759: This overrides the digest algorithm specified in the configuration file.
3760: .Pp
3761: Some public key algorithms may override this choice.
3762: For instance, DSA signatures always use SHA1.
3763: .It Fl modulus
1.63 jmc 3764: Print the value of the modulus of the public key contained in the request.
1.107 inoguchi 3765: .It Fl multivalue-rdn
3766: This option causes the
3767: .Fl subj
3768: argument to be interpreted with full support for multivalued RDNs,
3769: for example
3770: .Qq "/DC=org/DC=OpenSSL/DC=users/UID=123456+CN=John Doe" .
3771: If
3772: .Fl multivalue-rdn
3773: is not used, the UID value is set to
3774: .Qq "123456+CN=John Doe" .
1.1 jsing 3775: .It Fl nameopt Ar option , Fl reqopt Ar option
1.63 jmc 3776: Determine how the subject or issuer names are displayed.
1.1 jsing 3777: .Ar option
1.63 jmc 3778: can be a single option or multiple options separated by commas.
1.1 jsing 3779: Alternatively, these options may be used more than once to set multiple options.
3780: See the
3781: .Sx X509
3782: section below for details.
3783: .It Fl new
1.63 jmc 3784: Generate a new certificate request.
3785: The user is prompted for the relevant field values.
1.1 jsing 3786: The actual fields prompted for and their maximum and minimum sizes
3787: are specified in the configuration file and any requested extensions.
3788: .Pp
3789: If the
3790: .Fl key
3791: option is not used, it will generate a new RSA private
3792: key using information specified in the configuration file.
3793: .It Fl newhdr
1.63 jmc 3794: Add the word NEW to the PEM file header and footer lines
1.112 inoguchi 3795: on the outputted request.
1.63 jmc 3796: Some software and CAs need this.
1.1 jsing 3797: .It Fl newkey Ar arg
1.63 jmc 3798: Create a new certificate request and a new private key.
1.1 jsing 3799: The argument takes one of several forms.
1.63 jmc 3800: .Pp
3801: .No rsa : Ns Ar nbits
3802: generates an RSA key
1.1 jsing 3803: .Ar nbits
3804: in size.
3805: If
3806: .Ar nbits
1.137 naddy 3807: is omitted,
1.63 jmc 3808: the default key size is used.
3809: .Pp
3810: .No dsa : Ns Ar file
3811: generates a DSA key using the parameters in
3812: .Ar file .
3813: .Pp
3814: .No param : Ns Ar file
3815: generates a key using the parameters or certificate in
3816: .Ar file .
3817: .Pp
3818: All other algorithms support the form
3819: .Ar algorithm : Ns Ar file ,
1.1 jsing 3820: where file may be an algorithm parameter file,
3821: created by the
3822: .Cm genpkey -genparam
1.14 jmc 3823: command or an X.509 certificate for a key with appropriate algorithm.
1.63 jmc 3824: .Ar file
3825: can be omitted,
3826: in which case any parameters can be specified via the
1.1 jsing 3827: .Fl pkeyopt
3828: option.
3829: .It Fl nodes
1.63 jmc 3830: Do not encrypt the private key.
1.1 jsing 3831: .It Fl noout
1.63 jmc 3832: Do not output the encoded version of the request.
1.1 jsing 3833: .It Fl out Ar file
1.63 jmc 3834: The output file to write to,
1.99 jmc 3835: or standard output if not specified.
1.63 jmc 3836: .It Fl outform Cm der | pem
3837: The output format.
1.1 jsing 3838: .It Fl passin Ar arg
3839: The key password source.
3840: .It Fl passout Ar arg
3841: The output file password source.
1.107 inoguchi 3842: .It Fl pkeyopt Ar opt:value
3843: Set the public key algorithm option
3844: .Ar opt
3845: to
3846: .Ar value .
1.1 jsing 3847: .It Fl pubkey
1.63 jmc 3848: Output the public key.
1.1 jsing 3849: .It Fl reqopt Ar option
3850: Customise the output format used with
3851: .Fl text .
3852: The
3853: .Ar option
3854: argument can be a single option or multiple options separated by commas.
1.63 jmc 3855: See also the discussion of
1.1 jsing 3856: .Fl certopt
1.63 jmc 3857: in the
1.1 jsing 3858: .Nm x509
3859: command.
3860: .It Fl set_serial Ar n
3861: Serial number to use when outputting a self-signed certificate.
3862: This may be specified as a decimal value or a hex value if preceded by
3863: .Sq 0x .
3864: It is possible to use negative serial numbers but this is not recommended.
1.107 inoguchi 3865: .It Fl sigopt Ar nm:v
3866: Pass options to the signature algorithm during sign operation.
3867: The names and values of these options are algorithm-specific.
1.1 jsing 3868: .It Fl subj Ar arg
1.63 jmc 3869: Replaces the subject field of an input request
3870: with the specified data and output the modified request.
3871: .Ar arg
3872: must be formatted as /type0=value0/type1=value1/type2=...;
1.1 jsing 3873: characters may be escaped by
3874: .Sq \e
1.63 jmc 3875: (backslash);
1.1 jsing 3876: no spaces are skipped.
3877: .It Fl subject
1.63 jmc 3878: Print the request subject (or certificate subject if
1.1 jsing 3879: .Fl x509
1.63 jmc 3880: is specified).
1.1 jsing 3881: .It Fl text
1.64 jmc 3882: Print the certificate request in plain text.
1.1 jsing 3883: .It Fl utf8
1.63 jmc 3884: Interpret field values as UTF8 strings, not ASCII.
1.1 jsing 3885: .It Fl verbose
3886: Print extra details about the operations being performed.
3887: .It Fl verify
1.63 jmc 3888: Verify the signature on the request.
1.1 jsing 3889: .It Fl x509
1.63 jmc 3890: Output a self-signed certificate instead of a certificate request.
3891: This is typically used to generate a test certificate or a self-signed root CA.
3892: The extensions added to the certificate (if any)
1.1 jsing 3893: are specified in the configuration file.
3894: Unless specified using the
3895: .Fl set_serial
1.63 jmc 3896: option, 0 is used for the serial number.
1.1 jsing 3897: .El
1.63 jmc 3898: .Pp
1.1 jsing 3899: The configuration options are specified in the
1.63 jmc 3900: .Qq req
1.1 jsing 3901: section of the configuration file.
1.63 jmc 3902: The options available are as follows:
1.1 jsing 3903: .Bl -tag -width "XXXX"
1.63 jmc 3904: .It Cm attributes
3905: The section containing any request attributes: its format
1.1 jsing 3906: is the same as
1.63 jmc 3907: .Cm distinguished_name .
3908: Typically these may contain the challengePassword or unstructuredName types.
3909: They are currently ignored by the
3910: .Nm openssl
1.1 jsing 3911: request signing utilities, but some CAs might want them.
1.63 jmc 3912: .It Cm default_bits
3913: The default key size, in bits.
3914: The default is 2048.
1.1 jsing 3915: It is used if the
3916: .Fl new
1.63 jmc 3917: option is used and can be overridden by using the
1.1 jsing 3918: .Fl newkey
3919: option.
1.63 jmc 3920: .It Cm default_keyfile
3921: The default file to write a private key to,
3922: or standard output if not specified.
3923: It can be overridden by the
1.1 jsing 3924: .Fl keyout
3925: option.
1.63 jmc 3926: .It Cm default_md
3927: The digest algorithm to use.
1.1 jsing 3928: Possible values include
1.63 jmc 3929: .Cm md5 ,
3930: .Cm sha1
1.1 jsing 3931: and
1.63 jmc 3932: .Cm sha256
3933: (the default).
3934: It can be overridden on the command line.
3935: .It Cm distinguished_name
3936: The section containing the distinguished name fields to
1.1 jsing 3937: prompt for when generating a certificate or certificate request.
1.63 jmc 3938: The format is described below.
3939: .It Cm encrypt_key
3940: If set to
3941: .Qq no
3942: and a private key is generated, it is not encrypted.
3943: It is equivalent to the
1.1 jsing 3944: .Fl nodes
1.63 jmc 3945: option.
1.1 jsing 3946: For compatibility,
1.63 jmc 3947: .Cm encrypt_rsa_key
1.1 jsing 3948: is an equivalent option.
1.63 jmc 3949: .It Cm input_password | output_password
3950: The passwords for the input private key file (if present)
3951: and the output private key file (if one will be created).
1.1 jsing 3952: The command line options
3953: .Fl passin
3954: and
3955: .Fl passout
3956: override the configuration file values.
1.63 jmc 3957: .It Cm oid_file
3958: A file containing additional OBJECT IDENTIFIERS.
1.1 jsing 3959: Each line of the file should consist of the numerical form of the
3960: object identifier, followed by whitespace, then the short name followed
3961: by whitespace and finally the long name.
1.63 jmc 3962: .It Cm oid_section
3963: Specify a section in the configuration file containing extra
1.1 jsing 3964: object identifiers.
3965: Each line should consist of the short name of the
3966: object identifier followed by
3967: .Sq =
3968: and the numerical form.
3969: The short and long names are the same when this option is used.
1.63 jmc 3970: .It Cm prompt
3971: If set to
3972: .Qq no ,
3973: it disables prompting of certificate fields
1.1 jsing 3974: and just takes values from the config file directly.
3975: It also changes the expected format of the
1.63 jmc 3976: .Cm distinguished_name
1.1 jsing 3977: and
1.63 jmc 3978: .Cm attributes
1.1 jsing 3979: sections.
1.63 jmc 3980: .It Cm req_extensions
3981: The configuration file section containing a list of
1.1 jsing 3982: extensions to add to the certificate request.
3983: It can be overridden by the
3984: .Fl reqexts
1.63 jmc 3985: option.
3986: .It Cm string_mask
3987: Limit the string types for encoding certain fields.
1.1 jsing 3988: The following values may be used, limiting strings to the indicated types:
3989: .Bl -tag -width "MASK:number"
1.63 jmc 3990: .It Cm utf8only
3991: UTF8String.
1.1 jsing 3992: This is the default, as recommended by PKIX in RFC 2459.
1.63 jmc 3993: .It Cm default
3994: PrintableString, IA5String, T61String, BMPString, UTF8String.
3995: .It Cm pkix
3996: PrintableString, IA5String, BMPString, UTF8String.
3997: Inspired by the PKIX recommendation in RFC 2459 for certificates
3998: generated before 2004, but differs by also permitting IA5String.
3999: .It Cm nombstr
4000: PrintableString, IA5String, T61String, UniversalString.
4001: A workaround for some ancient software that had problems
4002: with the variable-sized BMPString and UTF8String types.
1.1 jsing 4003: .It Cm MASK : Ns Ar number
1.63 jmc 4004: An explicit bitmask of permitted types, where
1.1 jsing 4005: .Ar number
4006: is a C-style hex, decimal, or octal number that's a bit-wise OR of
4007: .Dv B_ASN1_*
4008: values from
4009: .In openssl/asn1.h .
4010: .El
1.63 jmc 4011: .It Cm utf8
4012: If set to
4013: .Qq yes ,
1.72 jmc 4014: field values are interpreted as UTF8 strings.
1.63 jmc 4015: .It Cm x509_extensions
4016: The configuration file section containing a list of
1.1 jsing 4017: extensions to add to a certificate generated when the
4018: .Fl x509
4019: switch is used.
4020: It can be overridden by the
4021: .Fl extensions
1.72 jmc 4022: command line switch.
1.1 jsing 4023: .El
1.63 jmc 4024: .Pp
1.1 jsing 4025: There are two separate formats for the distinguished name and attribute
4026: sections.
4027: If the
4028: .Fl prompt
4029: option is set to
1.63 jmc 4030: .Qq no ,
1.72 jmc 4031: then these sections just consist of field names and values.
4032: If the
1.1 jsing 4033: .Fl prompt
4034: option is absent or not set to
1.63 jmc 4035: .Qq no ,
1.72 jmc 4036: then the file contains field prompting information of the form:
1.1 jsing 4037: .Bd -unfilled -offset indent
4038: fieldName="prompt"
4039: fieldName_default="default field value"
4040: fieldName_min= 2
4041: fieldName_max= 4
4042: .Ed
4043: .Pp
4044: .Qq fieldName
4045: is the field name being used, for example
1.63 jmc 4046: .Cm commonName
4047: (or CN).
1.1 jsing 4048: The
4049: .Qq prompt
4050: string is used to ask the user to enter the relevant details.
4051: If the user enters nothing, the default value is used;
4052: if no default value is present, the field is omitted.
4053: A field can still be omitted if a default value is present,
4054: if the user just enters the
4055: .Sq \&.
4056: character.
4057: .Pp
4058: The number of characters entered must be between the
1.63 jmc 4059: fieldName_min and fieldName_max limits:
1.1 jsing 4060: there may be additional restrictions based on the field being used
4061: (for example
1.63 jmc 4062: .Cm countryName
1.1 jsing 4063: can only ever be two characters long and must fit in a
1.63 jmc 4064: .Cm PrintableString ) .
1.1 jsing 4065: .Pp
4066: Some fields (such as
1.63 jmc 4067: .Cm organizationName )
1.1 jsing 4068: can be used more than once in a DN.
4069: This presents a problem because configuration files will
4070: not recognize the same name occurring twice.
4071: To avoid this problem, if the
1.63 jmc 4072: .Cm fieldName
1.1 jsing 4073: contains some characters followed by a full stop, they will be ignored.
4074: So, for example, a second
1.63 jmc 4075: .Cm organizationName
1.1 jsing 4076: can be input by calling it
4077: .Qq 1.organizationName .
4078: .Pp
4079: The actual permitted field names are any object identifier short or
4080: long names.
4081: These are compiled into
1.63 jmc 4082: .Nm openssl
1.1 jsing 4083: and include the usual values such as
1.63 jmc 4084: .Cm commonName , countryName , localityName , organizationName ,
1.89 jmc 4085: .Cm organizationalUnitName , stateOrProvinceName .
1.1 jsing 4086: Additionally,
1.63 jmc 4087: .Cm emailAddress
1.1 jsing 4088: is included as well as
1.63 jmc 4089: .Cm name , surname , givenName , initials
1.1 jsing 4090: and
1.63 jmc 4091: .Cm dnQualifier .
1.1 jsing 4092: .Pp
4093: Additional object identifiers can be defined with the
1.63 jmc 4094: .Cm oid_file
1.1 jsing 4095: or
1.63 jmc 4096: .Cm oid_section
1.1 jsing 4097: options in the configuration file.
4098: Any additional fields will be treated as though they were a
1.63 jmc 4099: .Cm DirectoryString .
1.120 kn 4100: .Tg rsa
1.1 jsing 4101: .Sh RSA
1.114 jmc 4102: .Bl -hang -width "openssl rsa"
4103: .It Nm openssl rsa
4104: .Bk -words
1.64 jmc 4105: .Op Fl aes128 | aes192 | aes256 | des | des3
1.1 jsing 4106: .Op Fl check
4107: .Op Fl in Ar file
1.108 inoguchi 4108: .Op Fl inform Cm der | net | pem | pvk
1.1 jsing 4109: .Op Fl modulus
4110: .Op Fl noout
4111: .Op Fl out Ar file
1.108 inoguchi 4112: .Op Fl outform Cm der | net | pem | pvk
1.1 jsing 4113: .Op Fl passin Ar arg
4114: .Op Fl passout Ar arg
4115: .Op Fl pubin
4116: .Op Fl pubout
1.108 inoguchi 4117: .Op Fl pvk-none | pvk-strong | pvk-weak
4118: .Op Fl RSAPublicKey_in
4119: .Op Fl RSAPublicKey_out
1.1 jsing 4120: .Op Fl text
1.114 jmc 4121: .Ek
4122: .El
1.1 jsing 4123: .Pp
4124: The
4125: .Nm rsa
4126: command processes RSA keys.
4127: They can be converted between various forms and their components printed out.
1.64 jmc 4128: .Nm rsa
4129: uses the traditional
1.1 jsing 4130: .Nm SSLeay
4131: compatible format for private key encryption:
4132: newer applications should use the more secure PKCS#8 format using the
4133: .Nm pkcs8
4134: utility.
4135: .Pp
4136: The options are as follows:
4137: .Bl -tag -width Ds
1.64 jmc 4138: .It Fl aes128 | aes192 | aes256 | des | des3
4139: Encrypt the private key with the AES, DES,
1.1 jsing 4140: or the triple DES ciphers, respectively, before outputting it.
4141: A pass phrase is prompted for.
4142: If none of these options are specified, the key is written in plain text.
4143: This means that using the
4144: .Nm rsa
4145: utility to read in an encrypted key with no encryption option can be used
4146: to remove the pass phrase from a key, or by setting the encryption options
4147: it can be used to add or change the pass phrase.
4148: These options can only be used with PEM format output files.
4149: .It Fl check
1.64 jmc 4150: Check the consistency of an RSA private key.
1.1 jsing 4151: .It Fl in Ar file
1.64 jmc 4152: The input file to read from,
4153: or standard input if not specified.
1.1 jsing 4154: If the key is encrypted, a pass phrase will be prompted for.
1.108 inoguchi 4155: .It Fl inform Cm der | net | pem | pvk
1.64 jmc 4156: The input format.
1.1 jsing 4157: .It Fl noout
1.64 jmc 4158: Do not output the encoded version of the key.
1.1 jsing 4159: .It Fl modulus
1.64 jmc 4160: Print the value of the modulus of the key.
1.1 jsing 4161: .It Fl out Ar file
1.64 jmc 4162: The output file to write to,
4163: or standard output if not specified.
1.108 inoguchi 4164: .It Fl outform Cm der | net | pem | pvk
1.64 jmc 4165: The output format.
1.1 jsing 4166: .It Fl passin Ar arg
4167: The key password source.
4168: .It Fl passout Ar arg
4169: The output file password source.
4170: .It Fl pubin
1.64 jmc 4171: Read in a public key,
4172: not a private key.
1.1 jsing 4173: .It Fl pubout
1.64 jmc 4174: Output a public key,
4175: not a private key.
4176: Automatically set if the input is a public key.
1.108 inoguchi 4177: .It Xo
4178: .Fl pvk-none | pvk-strong | pvk-weak
4179: .Xc
4180: Enable or disable PVK encoding.
4181: The default is
4182: .Fl pvk-strong .
4183: .It Fl RSAPublicKey_in , RSAPublicKey_out
4184: Same as
4185: .Fl pubin
4186: and
4187: .Fl pubout
4188: except
4189: .Cm RSAPublicKey
4190: format is used instead.
1.1 jsing 4191: .It Fl text
1.64 jmc 4192: Print the public/private key components in plain text.
1.1 jsing 4193: .El
1.120 kn 4194: .Tg rsautl
1.1 jsing 4195: .Sh RSAUTL
1.114 jmc 4196: .Bl -hang -width "openssl rsautl"
4197: .It Nm openssl rsautl
4198: .Bk -words
1.1 jsing 4199: .Op Fl asn1parse
4200: .Op Fl certin
4201: .Op Fl decrypt
4202: .Op Fl encrypt
4203: .Op Fl hexdump
4204: .Op Fl in Ar file
4205: .Op Fl inkey Ar file
1.65 jmc 4206: .Op Fl keyform Cm der | pem
1.100 tb 4207: .Op Fl oaep | pkcs | raw | x931
1.1 jsing 4208: .Op Fl out Ar file
1.100 tb 4209: .Op Fl passin Ar arg
1.1 jsing 4210: .Op Fl pubin
1.100 tb 4211: .Op Fl rev
1.1 jsing 4212: .Op Fl sign
4213: .Op Fl verify
1.114 jmc 4214: .Ek
4215: .El
1.1 jsing 4216: .Pp
4217: The
4218: .Nm rsautl
4219: command can be used to sign, verify, encrypt and decrypt
4220: data using the RSA algorithm.
4221: .Pp
4222: The options are as follows:
4223: .Bl -tag -width Ds
4224: .It Fl asn1parse
4225: Asn1parse the output data; this is useful when combined with the
4226: .Fl verify
4227: option.
4228: .It Fl certin
4229: The input is a certificate containing an RSA public key.
4230: .It Fl decrypt
4231: Decrypt the input data using an RSA private key.
4232: .It Fl encrypt
4233: Encrypt the input data using an RSA public key.
4234: .It Fl hexdump
4235: Hex dump the output data.
4236: .It Fl in Ar file
1.65 jmc 4237: The input to read from,
4238: or standard input if not specified.
1.1 jsing 4239: .It Fl inkey Ar file
1.65 jmc 4240: The input key file; by default an RSA private key.
4241: .It Fl keyform Cm der | pem
1.85 tb 4242: The private key format.
1.65 jmc 4243: The default is
4244: .Cm pem .
1.100 tb 4245: .It Fl oaep | pkcs | raw | x931
1.1 jsing 4246: The padding to use:
1.100 tb 4247: PKCS#1 OAEP, PKCS#1 v1.5 (the default), no padding, or ANSI X9.31,
4248: respectively.
1.1 jsing 4249: For signatures, only
4250: .Fl pkcs
4251: and
4252: .Fl raw
4253: can be used.
4254: .It Fl out Ar file
1.65 jmc 4255: The output file to write to,
4256: or standard output if not specified.
1.100 tb 4257: .It Fl passin Ar arg
4258: The key password source.
1.1 jsing 4259: .It Fl pubin
4260: The input file is an RSA public key.
1.100 tb 4261: .It Fl rev
4262: Reverse the order of the input buffer.
1.1 jsing 4263: .It Fl sign
4264: Sign the input data and output the signed result.
4265: This requires an RSA private key.
4266: .It Fl verify
4267: Verify the input data and output the recovered data.
4268: .El
1.120 kn 4269: .Tg s_client
1.1 jsing 4270: .Sh S_CLIENT
1.114 jmc 4271: .Bl -hang -width "openssl s_client"
4272: .It Nm openssl s_client
4273: .Bk -words
1.1 jsing 4274: .Op Fl 4 | 6
1.110 inoguchi 4275: .Op Fl alpn Ar protocols
1.1 jsing 4276: .Op Fl bugs
4277: .Op Fl CAfile Ar file
4278: .Op Fl CApath Ar directory
4279: .Op Fl cert Ar file
1.110 inoguchi 4280: .Op Fl certform Cm der | pem
1.1 jsing 4281: .Op Fl check_ss_sig
4282: .Op Fl cipher Ar cipherlist
1.66 jmc 4283: .Op Fl connect Ar host Ns Op : Ns Ar port
1.1 jsing 4284: .Op Fl crl_check
4285: .Op Fl crl_check_all
4286: .Op Fl crlf
4287: .Op Fl debug
1.129 jsing 4288: .Op Fl dtls
1.110 inoguchi 4289: .Op Fl dtls1
1.129 jsing 4290: .Op Fl dtls1_2
1.1 jsing 4291: .Op Fl extended_crl
1.121 schwarze 4292: .Op Fl groups Ar list
1.110 inoguchi 4293: .Op Fl host Ar host
1.1 jsing 4294: .Op Fl ign_eof
4295: .Op Fl ignore_critical
4296: .Op Fl issuer_checks
4297: .Op Fl key Ar keyfile
1.110 inoguchi 4298: .Op Fl keyform Cm der | pem
4299: .Op Fl keymatexport Ar label
4300: .Op Fl keymatexportlen Ar len
4301: .Op Fl legacy_server_connect
1.1 jsing 4302: .Op Fl msg
1.110 inoguchi 4303: .Op Fl mtu Ar mtu
1.1 jsing 4304: .Op Fl nbio
4305: .Op Fl nbio_test
1.110 inoguchi 4306: .Op Fl no_comp
4307: .Op Fl no_ign_eof
4308: .Op Fl no_legacy_server_connect
1.1 jsing 4309: .Op Fl no_ticket
4310: .Op Fl no_tls1
1.6 guenther 4311: .Op Fl no_tls1_1
4312: .Op Fl no_tls1_2
1.119 jsing 4313: .Op Fl no_tls1_3
1.110 inoguchi 4314: .Op Fl pass Ar arg
1.1 jsing 4315: .Op Fl pause
4316: .Op Fl policy_check
1.110 inoguchi 4317: .Op Fl port Ar port
1.1 jsing 4318: .Op Fl prexit
1.11 bluhm 4319: .Op Fl proxy Ar host : Ns Ar port
1.1 jsing 4320: .Op Fl quiet
4321: .Op Fl reconnect
1.5 jsing 4322: .Op Fl servername Ar name
1.110 inoguchi 4323: .Op Fl serverpref
4324: .Op Fl sess_in Ar file
4325: .Op Fl sess_out Ar file
1.1 jsing 4326: .Op Fl showcerts
4327: .Op Fl starttls Ar protocol
4328: .Op Fl state
1.110 inoguchi 4329: .Op Fl status
4330: .Op Fl timeout
1.1 jsing 4331: .Op Fl tls1
1.31 jmc 4332: .Op Fl tls1_1
4333: .Op Fl tls1_2
1.119 jsing 4334: .Op Fl tls1_3
1.1 jsing 4335: .Op Fl tlsextdebug
1.110 inoguchi 4336: .Op Fl use_srtp Ar profiles
1.1 jsing 4337: .Op Fl verify Ar depth
1.110 inoguchi 4338: .Op Fl verify_return_error
1.1 jsing 4339: .Op Fl x509_strict
1.19 landry 4340: .Op Fl xmpphost Ar host
1.114 jmc 4341: .Ek
4342: .El
1.1 jsing 4343: .Pp
4344: The
4345: .Nm s_client
4346: command implements a generic SSL/TLS client which connects
4347: to a remote host using SSL/TLS.
1.66 jmc 4348: .Pp
4349: If a connection is established with an SSL server, any data received
4350: from the server is displayed and any key presses will be sent to the
4351: server.
4352: When used interactively (which means neither
4353: .Fl quiet
4354: nor
4355: .Fl ign_eof
4356: have been given), the session will be renegotiated if the line begins with an
4357: .Cm R ;
4358: if the line begins with a
4359: .Cm Q
4360: or if end of file is reached, the connection will be closed down.
1.1 jsing 4361: .Pp
4362: The options are as follows:
4363: .Bl -tag -width Ds
4364: .It Fl 4
1.66 jmc 4365: Attempt connections using IPv4 only.
1.1 jsing 4366: .It Fl 6
1.66 jmc 4367: Attempt connections using IPv6 only.
1.110 inoguchi 4368: .It Fl alpn Ar protocols
4369: Enable the Application-Layer Protocol Negotiation.
4370: .Ar protocols
4371: is a comma-separated list of protocol names that the client should advertise
4372: support for.
1.1 jsing 4373: .It Fl bugs
1.66 jmc 4374: Enable various workarounds for buggy implementations.
1.1 jsing 4375: .It Fl CAfile Ar file
4376: A
4377: .Ar file
4378: containing trusted certificates to use during server authentication
4379: and to use when attempting to build the client certificate chain.
4380: .It Fl CApath Ar directory
4381: The
4382: .Ar directory
4383: to use for server certificate verification.
4384: This directory must be in
4385: .Qq hash format ;
4386: see
4387: .Fl verify
4388: for more information.
4389: These are also used when building the client certificate chain.
4390: .It Fl cert Ar file
4391: The certificate to use, if one is requested by the server.
4392: The default is not to use a certificate.
1.110 inoguchi 4393: .It Fl certform Cm der | pem
4394: The certificate format.
4395: The default is
4396: .Cm pem .
1.1 jsing 4397: .It Xo
4398: .Fl check_ss_sig ,
4399: .Fl crl_check ,
4400: .Fl crl_check_all ,
4401: .Fl extended_crl ,
4402: .Fl ignore_critical ,
4403: .Fl issuer_checks ,
4404: .Fl policy_check ,
4405: .Fl x509_strict
4406: .Xc
4407: Set various certificate chain validation options.
4408: See the
1.66 jmc 4409: .Nm verify
1.1 jsing 4410: command for details.
4411: .It Fl cipher Ar cipherlist
1.66 jmc 4412: Modify the cipher list sent by the client.
1.1 jsing 4413: Although the server determines which cipher suite is used, it should take
4414: the first supported cipher in the list sent by the client.
4415: See the
1.66 jmc 4416: .Nm ciphers
4417: command for more information.
4418: .It Fl connect Ar host Ns Op : Ns Ar port
4419: The
1.1 jsing 4420: .Ar host
1.66 jmc 4421: and
1.1 jsing 4422: .Ar port
4423: to connect to.
4424: If not specified, an attempt is made to connect to the local host
4425: on port 4433.
4426: Alternatively, the host and port pair may be separated using a forward-slash
1.66 jmc 4427: character,
4428: which is useful for numeric IPv6 addresses.
1.1 jsing 4429: .It Fl crlf
1.66 jmc 4430: Translate a line feed from the terminal into CR+LF,
4431: as required by some servers.
1.1 jsing 4432: .It Fl debug
1.66 jmc 4433: Print extensive debugging information, including a hex dump of all traffic.
1.129 jsing 4434: .It Fl dtls
4435: Permit any version of DTLS.
1.110 inoguchi 4436: .It Fl dtls1
4437: Permit only DTLS1.0.
1.129 jsing 4438: .It Fl dtls1_2
4439: Permit only DTLS1.2.
1.121 schwarze 4440: .It Fl groups Ar list
4441: Set the supported elliptic curve groups to the colon separated
4442: .Ar list
4443: of group NIDs or names as documented in
4444: .Xr SSL_CTX_set1_groups_list 3 .
1.110 inoguchi 4445: .It Fl host Ar host
4446: The
4447: .Ar host
4448: to connect to.
4449: The default is localhost.
1.1 jsing 4450: .It Fl ign_eof
1.66 jmc 4451: Inhibit shutting down the connection when end of file is reached in the input.
1.1 jsing 4452: .It Fl key Ar keyfile
4453: The private key to use.
4454: If not specified, the certificate file will be used.
1.110 inoguchi 4455: .It Fl keyform Cm der | pem
4456: The private key format.
4457: The default is
4458: .Cm pem .
4459: .It Fl keymatexport Ar label
4460: Export keying material using label.
4461: .It Fl keymatexportlen Ar len
4462: Export len bytes of keying material (default 20).
4463: .It Fl legacy_server_connect , no_legacy_server_connect
4464: Allow or disallow initial connection to servers that don't support RI.
1.1 jsing 4465: .It Fl msg
4466: Show all protocol messages with hex dump.
1.110 inoguchi 4467: .It Fl mtu Ar mtu
4468: Set the link layer MTU.
1.1 jsing 4469: .It Fl nbio
1.66 jmc 4470: Turn on non-blocking I/O.
1.1 jsing 4471: .It Fl nbio_test
1.66 jmc 4472: Test non-blocking I/O.
1.110 inoguchi 4473: .It Fl no_ign_eof
4474: Shut down the connection when end of file is reached in the input.
4475: Can be used to override the implicit
4476: .Fl ign_eof
4477: after
4478: .Fl quiet .
1.119 jsing 4479: .It Fl no_tls1 | no_tls1_1 | no_tls1_2 | no_tls1_3
4480: Disable the use of TLS1.0, 1.1, 1.2 and 1.3 respectively.
1.1 jsing 4481: .It Fl no_ticket
4482: Disable RFC 4507 session ticket support.
1.110 inoguchi 4483: .It Fl pass Ar arg
4484: The private key password source.
1.1 jsing 4485: .It Fl pause
1.66 jmc 4486: Pause 1 second between each read and write call.
1.110 inoguchi 4487: .It Fl port Ar port
4488: The
4489: .Ar port
4490: to connect to.
4491: The default is 4433.
1.1 jsing 4492: .It Fl prexit
4493: Print session information when the program exits.
4494: This will always attempt
4495: to print out information even if the connection fails.
4496: Normally, information will only be printed out once if the connection succeeds.
4497: This option is useful because the cipher in use may be renegotiated
4498: or the connection may fail because a client certificate is required or is
4499: requested only after an attempt is made to access a certain URL.
1.66 jmc 4500: Note that the output produced by this option is not always accurate
4501: because a connection might never have been established.
1.11 bluhm 4502: .It Fl proxy Ar host : Ns Ar port
4503: Use the HTTP proxy at
4504: .Ar host
4505: and
4506: .Ar port .
4507: The connection to the proxy is done in cleartext and the
4508: .Fl connect
4509: argument is given to the proxy.
4510: If not specified, localhost is used as final destination.
4511: After that, switch the connection through the proxy to the destination
4512: to TLS.
1.1 jsing 4513: .It Fl quiet
4514: Inhibit printing of session and certificate information.
4515: This implicitly turns on
4516: .Fl ign_eof
4517: as well.
4518: .It Fl reconnect
1.66 jmc 4519: Reconnect to the same server 5 times using the same session ID; this can
1.1 jsing 4520: be used as a test that session caching is working.
1.5 jsing 4521: .It Fl servername Ar name
4522: Include the TLS Server Name Indication (SNI) extension in the ClientHello
4523: message, using the specified server
4524: .Ar name .
1.1 jsing 4525: .It Fl showcerts
4526: Display the whole server certificate chain: normally only the server
4527: certificate itself is displayed.
1.110 inoguchi 4528: .It Fl serverpref
4529: Use the server's cipher preferences.
4530: .It Fl sess_in Ar file
4531: Load TLS session from file.
4532: The client will attempt to resume a connection from this session.
4533: .It Fl sess_out Ar file
4534: Output TLS session to file.
1.1 jsing 4535: .It Fl starttls Ar protocol
1.66 jmc 4536: Send the protocol-specific messages to switch to TLS for communication.
1.1 jsing 4537: .Ar protocol
4538: is a keyword for the intended protocol.
4539: Currently, the supported keywords are
4540: .Qq ftp ,
4541: .Qq imap ,
4542: .Qq smtp ,
4543: .Qq pop3 ,
4544: and
4545: .Qq xmpp .
4546: .It Fl state
1.66 jmc 4547: Print the SSL session states.
1.110 inoguchi 4548: .It Fl status
4549: Send a certificate status request to the server (OCSP stapling).
4550: The server response (if any) is printed out.
4551: .It Fl timeout
4552: Enable send/receive timeout on DTLS connections.
1.119 jsing 4553: .It Fl tls1 | tls1_1 | tls1_2 | tls1_3
4554: Permit only TLS1.0, 1.1, 1.2 or 1.3 respectively.
1.1 jsing 4555: .It Fl tlsextdebug
1.66 jmc 4556: Print a hex dump of any TLS extensions received from the server.
1.110 inoguchi 4557: .It Fl use_srtp Ar profiles
4558: Offer SRTP key management with a colon-separated profile list.
1.1 jsing 4559: .It Fl verify Ar depth
1.66 jmc 4560: Turn on server certificate verification,
4561: with a maximum length of
4562: .Ar depth .
1.1 jsing 4563: Currently the verify operation continues after errors so all the problems
4564: with a certificate chain can be seen.
4565: As a side effect the connection will never fail due to a server
4566: certificate verify failure.
1.110 inoguchi 4567: .It Fl verify_return_error
4568: Return verification error.
1.19 landry 4569: .It Fl xmpphost Ar hostname
1.66 jmc 4570: When used with
1.19 landry 4571: .Fl starttls Ar xmpp ,
1.66 jmc 4572: specify the host for the "to" attribute of the stream element.
1.19 landry 4573: If this option is not specified then the host specified with
4574: .Fl connect
4575: will be used.
1.1 jsing 4576: .El
1.120 kn 4577: .Tg s_server
1.1 jsing 4578: .Sh S_SERVER
1.114 jmc 4579: .Bl -hang -width "openssl s_server"
4580: .It Nm openssl s_server
4581: .Bk -words
1.1 jsing 4582: .Op Fl accept Ar port
1.111 inoguchi 4583: .Op Fl alpn Ar protocols
1.1 jsing 4584: .Op Fl bugs
4585: .Op Fl CAfile Ar file
4586: .Op Fl CApath Ar directory
4587: .Op Fl cert Ar file
1.111 inoguchi 4588: .Op Fl cert2 Ar file
4589: .Op Fl certform Cm der | pem
1.1 jsing 4590: .Op Fl cipher Ar cipherlist
4591: .Op Fl context Ar id
4592: .Op Fl crl_check
4593: .Op Fl crl_check_all
4594: .Op Fl crlf
4595: .Op Fl dcert Ar file
1.111 inoguchi 4596: .Op Fl dcertform Cm der | pem
1.1 jsing 4597: .Op Fl debug
4598: .Op Fl dhparam Ar file
4599: .Op Fl dkey Ar file
1.111 inoguchi 4600: .Op Fl dkeyform Cm der | pem
4601: .Op Fl dpass Ar arg
1.129 jsing 4602: .Op Fl dtls
1.111 inoguchi 4603: .Op Fl dtls1
1.129 jsing 4604: .Op Fl dtls1_2
1.121 schwarze 4605: .Op Fl groups Ar list
1.1 jsing 4606: .Op Fl HTTP
4607: .Op Fl id_prefix Ar arg
4608: .Op Fl key Ar keyfile
1.111 inoguchi 4609: .Op Fl key2 Ar keyfile
4610: .Op Fl keyform Cm der | pem
4611: .Op Fl keymatexport Ar label
4612: .Op Fl keymatexportlen Ar len
1.1 jsing 4613: .Op Fl msg
1.111 inoguchi 4614: .Op Fl mtu Ar mtu
1.130 tb 4615: .Op Fl naccept Ar num
1.111 inoguchi 4616: .Op Fl named_curve Ar arg
1.1 jsing 4617: .Op Fl nbio
4618: .Op Fl nbio_test
1.111 inoguchi 4619: .Op Fl no_cache
1.1 jsing 4620: .Op Fl no_dhe
1.111 inoguchi 4621: .Op Fl no_ecdhe
4622: .Op Fl no_ticket
1.1 jsing 4623: .Op Fl no_tls1
1.6 guenther 4624: .Op Fl no_tls1_1
4625: .Op Fl no_tls1_2
1.122 inoguchi 4626: .Op Fl no_tls1_3
1.1 jsing 4627: .Op Fl no_tmp_rsa
4628: .Op Fl nocert
1.111 inoguchi 4629: .Op Fl pass Ar arg
1.1 jsing 4630: .Op Fl quiet
1.111 inoguchi 4631: .Op Fl servername Ar name
4632: .Op Fl servername_fatal
1.1 jsing 4633: .Op Fl serverpref
4634: .Op Fl state
1.111 inoguchi 4635: .Op Fl status
4636: .Op Fl status_timeout Ar nsec
4637: .Op Fl status_url Ar url
4638: .Op Fl status_verbose
4639: .Op Fl timeout
1.1 jsing 4640: .Op Fl tls1
1.31 jmc 4641: .Op Fl tls1_1
4642: .Op Fl tls1_2
1.122 inoguchi 4643: .Op Fl tls1_3
1.111 inoguchi 4644: .Op Fl tlsextdebug
4645: .Op Fl use_srtp Ar profiles
1.1 jsing 4646: .Op Fl Verify Ar depth
4647: .Op Fl verify Ar depth
1.111 inoguchi 4648: .Op Fl verify_return_error
1.1 jsing 4649: .Op Fl WWW
4650: .Op Fl www
1.114 jmc 4651: .Ek
4652: .El
1.1 jsing 4653: .Pp
4654: The
4655: .Nm s_server
4656: command implements a generic SSL/TLS server which listens
4657: for connections on a given port using SSL/TLS.
4658: .Pp
1.67 jmc 4659: If a connection request is established with a client and neither the
4660: .Fl www
4661: nor the
4662: .Fl WWW
4663: option has been used, then any data received
4664: from the client is displayed and any key presses are sent to the client.
4665: Certain single letter commands perform special operations:
4666: .Pp
4667: .Bl -tag -width "XXXX" -compact
4668: .It Ic P
4669: Send plain text, which should cause the client to disconnect.
4670: .It Ic Q
4671: End the current SSL connection and exit.
4672: .It Ic q
4673: End the current SSL connection, but still accept new connections.
4674: .It Ic R
4675: Renegotiate the SSL session and request a client certificate.
4676: .It Ic r
4677: Renegotiate the SSL session.
4678: .It Ic S
4679: Print out some session cache status information.
4680: .El
4681: .Pp
1.1 jsing 4682: The options are as follows:
4683: .Bl -tag -width Ds
1.113 inoguchi 4684: .It Fl accept Ar port
1.67 jmc 4685: Listen on TCP
1.1 jsing 4686: .Ar port
1.67 jmc 4687: for connections.
4688: The default is port 4433.
1.111 inoguchi 4689: .It Fl alpn Ar protocols
4690: Enable the Application-Layer Protocol Negotiation.
4691: .Ar protocols
4692: is a comma-separated list of supported protocol names.
1.1 jsing 4693: .It Fl bugs
1.67 jmc 4694: Enable various workarounds for buggy implementations.
1.1 jsing 4695: .It Fl CAfile Ar file
1.67 jmc 4696: A
4697: .Ar file
4698: containing trusted certificates to use during client authentication
1.1 jsing 4699: and to use when attempting to build the server certificate chain.
4700: The list is also used in the list of acceptable client CAs passed to the
4701: client when a certificate is requested.
4702: .It Fl CApath Ar directory
4703: The
4704: .Ar directory
4705: to use for client certificate verification.
4706: This directory must be in
4707: .Qq hash format ;
4708: see
4709: .Fl verify
4710: for more information.
4711: These are also used when building the server certificate chain.
4712: .It Fl cert Ar file
1.67 jmc 4713: The certificate to use: most server's cipher suites require the use of a
4714: certificate and some require a certificate with a certain public key type.
4715: For example, the DSS cipher suites require a certificate containing a DSS
4716: (DSA) key.
1.1 jsing 4717: If not specified, the file
4718: .Pa server.pem
4719: will be used.
1.111 inoguchi 4720: .It Fl cert2 Ar file
4721: The certificate to use for servername.
4722: .It Fl certform Cm der | pem
4723: The certificate format.
4724: The default is
4725: .Cm pem .
1.1 jsing 4726: .It Fl cipher Ar cipherlist
1.67 jmc 4727: Modify the cipher list used by the server.
1.1 jsing 4728: This allows the cipher list used by the server to be modified.
4729: When the client sends a list of supported ciphers, the first client cipher
4730: also included in the server list is used.
4731: Because the client specifies the preference order, the order of the server
4732: cipherlist is irrelevant.
4733: See the
1.67 jmc 4734: .Nm ciphers
4735: command for more information.
1.1 jsing 4736: .It Fl context Ar id
1.67 jmc 4737: Set the SSL context ID.
1.1 jsing 4738: It can be given any string value.
4739: .It Fl crl_check , crl_check_all
4740: Check the peer certificate has not been revoked by its CA.
4741: The CRLs are appended to the certificate file.
4742: .Fl crl_check_all
1.67 jmc 4743: checks all CRLs of all CAs in the chain.
1.1 jsing 4744: .It Fl crlf
1.67 jmc 4745: Translate a line feed from the terminal into CR+LF.
1.1 jsing 4746: .It Fl dcert Ar file , Fl dkey Ar file
4747: Specify an additional certificate and private key; these behave in the
4748: same manner as the
4749: .Fl cert
4750: and
4751: .Fl key
4752: options except there is no default if they are not specified
1.67 jmc 4753: (no additional certificate or key is used).
1.1 jsing 4754: By using RSA and DSS certificates and keys,
4755: a server can support clients which only support RSA or DSS cipher suites
4756: by using an appropriate certificate.
1.111 inoguchi 4757: .It Fl dcertform Cm der | pem , Fl dkeyform Cm der | pem , Fl dpass Ar arg
4758: Additional certificate and private key format, and private key password source,
4759: respectively.
1.1 jsing 4760: .It Fl debug
1.67 jmc 4761: Print extensive debugging information, including a hex dump of all traffic.
1.1 jsing 4762: .It Fl dhparam Ar file
4763: The DH parameter file to use.
4764: The ephemeral DH cipher suites generate keys
4765: using a set of DH parameters.
4766: If not specified, an attempt is made to
4767: load the parameters from the server certificate file.
4768: If this fails, a static set of parameters hard coded into the
4769: .Nm s_server
4770: program will be used.
1.129 jsing 4771: .It Fl dtls
4772: Permit any version of DTLS.
1.111 inoguchi 4773: .It Fl dtls1
4774: Permit only DTLS1.0.
1.129 jsing 4775: .It Fl dtls1_2
4776: Permit only DTLS1.2.
1.121 schwarze 4777: .It Fl groups Ar list
4778: Set the supported elliptic curve groups to the colon separated
4779: .Ar list
4780: of group NIDs or names as documented in
4781: .Xr SSL_CTX_set1_groups_list 3 .
1.1 jsing 4782: .It Fl HTTP
1.67 jmc 4783: Emulate a simple web server.
4784: Pages are resolved relative to the current directory.
4785: For example if the URL
1.1 jsing 4786: .Pa https://myhost/page.html
4787: is requested, the file
4788: .Pa ./page.html
4789: will be loaded.
4790: The files loaded are assumed to contain a complete and correct HTTP
4791: response (lines that are part of the HTTP response line and headers
4792: must end with CRLF).
4793: .It Fl id_prefix Ar arg
4794: Generate SSL/TLS session IDs prefixed by
4795: .Ar arg .
4796: This is mostly useful for testing any SSL/TLS code
1.81 jmc 4797: that wish to deal with multiple servers,
4798: when each of which might be generating a unique range of session IDs.
1.1 jsing 4799: .It Fl key Ar keyfile
4800: The private key to use.
4801: If not specified, the certificate file will be used.
1.111 inoguchi 4802: .It Fl key2 Ar keyfile
4803: The private key to use for servername.
4804: .It Fl keyform Cm der | pem
4805: The private key format.
4806: The default is
4807: .Cm pem .
4808: .It Fl keymatexport Ar label
4809: Export keying material using label.
4810: .It Fl keymatexportlen Ar len
4811: Export len bytes of keying material (default 20).
1.1 jsing 4812: .It Fl msg
4813: Show all protocol messages with hex dump.
1.111 inoguchi 4814: .It Fl mtu Ar mtu
4815: Set the link layer MTU.
1.130 tb 4816: .It Fl naccept Ar num
4817: Terminate server after
4818: .Ar num
4819: connections.
1.111 inoguchi 4820: .It Fl named_curve Ar arg
4821: Specify the elliptic curve name to use for ephemeral ECDH keys.
1.121 schwarze 4822: This option is deprecated; use
4823: .Fl groups
4824: instead.
1.1 jsing 4825: .It Fl nbio
1.67 jmc 4826: Turn on non-blocking I/O.
1.1 jsing 4827: .It Fl nbio_test
1.67 jmc 4828: Test non-blocking I/O.
1.111 inoguchi 4829: .It Fl no_cache
4830: Disable session caching.
1.1 jsing 4831: .It Fl no_dhe
1.67 jmc 4832: Disable ephemeral DH cipher suites.
1.111 inoguchi 4833: .It Fl no_ecdhe
4834: Disable ephemeral ECDH cipher suites.
4835: .It Fl no_ticket
4836: Disable RFC 4507 session ticket support.
1.122 inoguchi 4837: .It Fl no_tls1 | no_tls1_1 | no_tls1_2 | no_tls1_3
4838: Disable the use of TLS1.0, 1.1, 1.2, and 1.3, respectively.
1.1 jsing 4839: .It Fl no_tmp_rsa
1.67 jmc 4840: Disable temporary RSA key generation.
1.1 jsing 4841: .It Fl nocert
1.67 jmc 4842: Do not use a certificate.
1.1 jsing 4843: This restricts the cipher suites available to the anonymous ones
1.67 jmc 4844: (currently just anonymous DH).
1.111 inoguchi 4845: .It Fl pass Ar arg
4846: The private key password source.
1.1 jsing 4847: .It Fl quiet
4848: Inhibit printing of session and certificate information.
1.111 inoguchi 4849: .It Fl servername Ar name
4850: Set the TLS Server Name Indication (SNI) extension with
4851: .Ar name .
4852: .It Fl servername_fatal
4853: Send fatal alert if servername does not match.
4854: The default is warning alert.
1.1 jsing 4855: .It Fl serverpref
4856: Use server's cipher preferences.
4857: .It Fl state
1.67 jmc 4858: Print the SSL session states.
1.111 inoguchi 4859: .It Fl status
4860: Enables certificate status request support (OCSP stapling).
4861: .It Fl status_timeout Ar nsec
4862: Sets the timeout for OCSP response in seconds.
4863: .It Fl status_url Ar url
4864: Sets a fallback responder URL to use if no responder URL is present in the
4865: server certificate.
4866: Without this option, an error is returned if the server certificate does not
4867: contain a responder address.
4868: .It Fl status_verbose
4869: Enables certificate status request support (OCSP stapling) and gives a verbose
4870: printout of the OCSP response.
4871: .It Fl timeout
4872: Enable send/receive timeout on DTLS connections.
1.122 inoguchi 4873: .It Fl tls1 | tls1_1 | tls1_2 | tls1_3
4874: Permit only TLS1.0, 1.1, 1.2, or 1.3, respectively.
1.111 inoguchi 4875: .It Fl tlsextdebug
4876: Print a hex dump of any TLS extensions received from the server.
4877: .It Fl use_srtp Ar profiles
4878: Offer SRTP key management with a colon-separated profile list.
4879: .It Fl verify_return_error
4880: Return verification error.
1.1 jsing 4881: .It Fl WWW
1.67 jmc 4882: Emulate a simple web server.
4883: Pages are resolved relative to the current directory.
4884: For example if the URL
1.1 jsing 4885: .Pa https://myhost/page.html
4886: is requested, the file
4887: .Pa ./page.html
4888: will be loaded.
4889: .It Fl www
1.67 jmc 4890: Send a status message to the client when it connects,
4891: including information about the ciphers used and various session parameters.
1.1 jsing 4892: The output is in HTML format so this option will normally be used with a
4893: web browser.
4894: .It Fl Verify Ar depth , Fl verify Ar depth
1.67 jmc 4895: Request a certificate chain from the client,
4896: with a maximum length of
4897: .Ar depth .
4898: With
4899: .Fl Verify ,
4900: the client must supply a certificate or an error occurs;
4901: with
4902: .Fl verify ,
4903: a certificate is requested but the client does not have to send one.
1.1 jsing 4904: .El
1.120 kn 4905: .Tg s_time
1.1 jsing 4906: .Sh S_TIME
1.114 jmc 4907: .Bl -hang -width "openssl s_time"
4908: .It Nm openssl s_time
4909: .Bk -words
1.1 jsing 4910: .Op Fl bugs
4911: .Op Fl CAfile Ar file
4912: .Op Fl CApath Ar directory
4913: .Op Fl cert Ar file
4914: .Op Fl cipher Ar cipherlist
1.68 jmc 4915: .Op Fl connect Ar host Ns Op : Ns Ar port
1.1 jsing 4916: .Op Fl key Ar keyfile
4917: .Op Fl nbio
4918: .Op Fl new
1.20 lteo 4919: .Op Fl no_shutdown
1.1 jsing 4920: .Op Fl reuse
4921: .Op Fl time Ar seconds
4922: .Op Fl verify Ar depth
4923: .Op Fl www Ar page
1.114 jmc 4924: .Ek
4925: .El
1.1 jsing 4926: .Pp
4927: The
1.68 jmc 4928: .Nm s_time
1.1 jsing 4929: command implements a generic SSL/TLS client which connects to a
4930: remote host using SSL/TLS.
4931: It can request a page from the server and includes
4932: the time to transfer the payload data in its timing measurements.
4933: It measures the number of connections within a given timeframe,
4934: the amount of data transferred
4935: .Pq if any ,
4936: and calculates the average time spent for one connection.
4937: .Pp
4938: The options are as follows:
4939: .Bl -tag -width Ds
4940: .It Fl bugs
1.68 jmc 4941: Enable various workarounds for buggy implementations.
1.1 jsing 4942: .It Fl CAfile Ar file
1.68 jmc 4943: A
4944: .Ar file
4945: containing trusted certificates to use during server authentication
1.1 jsing 4946: and to use when attempting to build the client certificate chain.
4947: .It Fl CApath Ar directory
4948: The directory to use for server certificate verification.
4949: This directory must be in
4950: .Qq hash format ;
4951: see
4952: .Nm verify
4953: for more information.
4954: These are also used when building the client certificate chain.
4955: .It Fl cert Ar file
4956: The certificate to use, if one is requested by the server.
4957: The default is not to use a certificate.
4958: .It Fl cipher Ar cipherlist
1.68 jmc 4959: Modify the cipher list sent by the client.
1.1 jsing 4960: Although the server determines which cipher suite is used,
4961: it should take the first supported cipher in the list sent by the client.
4962: See the
4963: .Nm ciphers
4964: command for more information.
1.68 jmc 4965: .It Fl connect Ar host Ns Op : Ns Ar port
4966: The host and port to connect to.
1.1 jsing 4967: .It Fl key Ar keyfile
4968: The private key to use.
4969: If not specified, the certificate file will be used.
4970: .It Fl nbio
1.68 jmc 4971: Turn on non-blocking I/O.
1.1 jsing 4972: .It Fl new
1.68 jmc 4973: Perform the timing test using a new session ID for each connection.
1.1 jsing 4974: If neither
4975: .Fl new
4976: nor
4977: .Fl reuse
4978: are specified,
4979: they are both on by default and executed in sequence.
1.20 lteo 4980: .It Fl no_shutdown
1.21 jmc 4981: Shut down the connection without sending a
1.68 jmc 4982: .Qq close notify
1.20 lteo 4983: shutdown alert to the server.
1.1 jsing 4984: .It Fl reuse
1.68 jmc 4985: Perform the timing test using the same session ID for each connection.
1.1 jsing 4986: If neither
4987: .Fl new
4988: nor
4989: .Fl reuse
4990: are specified,
4991: they are both on by default and executed in sequence.
4992: .It Fl time Ar seconds
1.68 jmc 4993: Limit
1.1 jsing 4994: .Nm s_time
1.68 jmc 4995: benchmarks to the number of
4996: .Ar seconds .
1.1 jsing 4997: The default is 30 seconds.
4998: .It Fl verify Ar depth
1.68 jmc 4999: Turn on server certificate verification,
5000: with a maximum length of
5001: .Ar depth .
1.1 jsing 5002: Currently the verify operation continues after errors, so all the problems
5003: with a certificate chain can be seen.
5004: As a side effect,
5005: the connection will never fail due to a server certificate verify failure.
5006: .It Fl www Ar page
1.68 jmc 5007: The page to GET from the server.
1.1 jsing 5008: A value of
5009: .Sq /
5010: gets the index.htm[l] page.
5011: If this parameter is not specified,
5012: .Nm s_time
5013: will only perform the handshake to establish SSL connections
5014: but not transfer any payload data.
5015: .El
1.120 kn 5016: .Tg sess_id
1.1 jsing 5017: .Sh SESS_ID
1.114 jmc 5018: .Bl -hang -width "openssl sess_id"
5019: .It Nm openssl sess_id
5020: .Bk -words
1.1 jsing 5021: .Op Fl cert
5022: .Op Fl context Ar ID
5023: .Op Fl in Ar file
1.69 jmc 5024: .Op Fl inform Cm der | pem
1.1 jsing 5025: .Op Fl noout
5026: .Op Fl out Ar file
1.69 jmc 5027: .Op Fl outform Cm der | pem
1.1 jsing 5028: .Op Fl text
1.114 jmc 5029: .Ek
5030: .El
1.1 jsing 5031: .Pp
5032: The
5033: .Nm sess_id
5034: program processes the encoded version of the SSL session structure and
5035: optionally prints out SSL session details
1.69 jmc 5036: (for example the SSL session master key)
1.72 jmc 5037: in human-readable format.
1.1 jsing 5038: .Pp
5039: The options are as follows:
5040: .Bl -tag -width Ds
5041: .It Fl cert
5042: If a certificate is present in the session,
5043: it will be output using this option;
5044: if the
5045: .Fl text
5046: option is also present, then it will be printed out in text form.
5047: .It Fl context Ar ID
1.69 jmc 5048: Set the session
1.1 jsing 5049: .Ar ID .
1.69 jmc 5050: The ID can be any string of characters.
1.1 jsing 5051: .It Fl in Ar file
1.69 jmc 5052: The input file to read from,
5053: or standard input if not specified.
5054: .It Fl inform Cm der | pem
5055: The input format.
5056: .Cm der
1.84 jmc 5057: uses an ASN.1 DER-encoded format containing session details.
1.1 jsing 5058: The precise format can vary from one version to the next.
1.69 jmc 5059: .Cm pem
5060: is the default format: it consists of the DER
1.1 jsing 5061: format base64-encoded with additional header and footer lines.
5062: .It Fl noout
1.69 jmc 5063: Do not output the encoded version of the session.
1.1 jsing 5064: .It Fl out Ar file
1.69 jmc 5065: The output file to write to,
5066: or standard output if not specified.
5067: .It Fl outform Cm der | pem
5068: The output format.
1.1 jsing 5069: .It Fl text
1.69 jmc 5070: Print the various public or private key components in plain text,
5071: in addition to the encoded version.
1.1 jsing 5072: .El
5073: .Pp
1.69 jmc 5074: The output of
5075: .Nm sess_id
5076: is composed as follows:
1.1 jsing 5077: .Pp
1.69 jmc 5078: .Bl -tag -width "Verify return code " -offset 3n -compact
5079: .It Protocol
5080: The protocol in use.
5081: .It Cipher
5082: The actual raw SSL or TLS cipher code.
5083: .It Session-ID
5084: The SSL session ID, in hex format.
5085: .It Session-ID-ctx
5086: The session ID context, in hex format.
5087: .It Master-Key
5088: The SSL session master key.
5089: .It Key-Arg
1.1 jsing 5090: The key argument; this is only used in SSL v2.
1.69 jmc 5091: .It Start Time
5092: The session start time.
1.1 jsing 5093: .Ux
5094: format.
1.69 jmc 5095: .It Timeout
5096: The timeout, in seconds.
5097: .It Verify return code
5098: The return code when a certificate is verified.
1.1 jsing 5099: .El
5100: .Pp
5101: Since the SSL session output contains the master key, it is possible to read
5102: the contents of an encrypted session using this information.
5103: Therefore appropriate security precautions
5104: should be taken if the information is being output by a
5105: .Qq real
5106: application.
5107: This is, however, strongly discouraged and should only be used for
5108: debugging purposes.
1.120 kn 5109: .Tg smime
1.1 jsing 5110: .Sh SMIME
1.114 jmc 5111: .Bl -hang -width "openssl smime"
5112: .It Nm openssl smime
5113: .Bk -words
1.1 jsing 5114: .Oo
5115: .Fl aes128 | aes192 | aes256 | des |
5116: .Fl des3 | rc2-40 | rc2-64 | rc2-128
5117: .Oc
5118: .Op Fl binary
5119: .Op Fl CAfile Ar file
5120: .Op Fl CApath Ar directory
5121: .Op Fl certfile Ar file
5122: .Op Fl check_ss_sig
5123: .Op Fl content Ar file
5124: .Op Fl crl_check
5125: .Op Fl crl_check_all
5126: .Op Fl decrypt
5127: .Op Fl encrypt
5128: .Op Fl extended_crl
5129: .Op Fl from Ar addr
5130: .Op Fl ignore_critical
5131: .Op Fl in Ar file
5132: .Op Fl indef
1.70 jmc 5133: .Op Fl inform Cm der | pem | smime
1.1 jsing 5134: .Op Fl inkey Ar file
5135: .Op Fl issuer_checks
1.112 inoguchi 5136: .Op Fl keyform Cm der | pem
1.1 jsing 5137: .Op Fl md Ar digest
5138: .Op Fl noattr
5139: .Op Fl nocerts
5140: .Op Fl nochain
5141: .Op Fl nodetach
5142: .Op Fl noindef
5143: .Op Fl nointern
5144: .Op Fl nosigs
1.108 inoguchi 5145: .Op Fl nosmimecap
1.1 jsing 5146: .Op Fl noverify
5147: .Op Fl out Ar file
1.70 jmc 5148: .Op Fl outform Cm der | pem | smime
1.1 jsing 5149: .Op Fl passin Ar arg
5150: .Op Fl pk7out
5151: .Op Fl policy_check
5152: .Op Fl recip Ar file
5153: .Op Fl resign
5154: .Op Fl sign
5155: .Op Fl signer Ar file
5156: .Op Fl stream
5157: .Op Fl subject Ar s
5158: .Op Fl text
5159: .Op Fl to Ar addr
5160: .Op Fl verify
5161: .Op Fl x509_strict
5162: .Op Ar cert.pem ...
1.114 jmc 5163: .Ek
5164: .El
1.1 jsing 5165: .Pp
5166: The
5167: .Nm smime
1.70 jmc 5168: command handles S/MIME mail.
5169: It can encrypt, decrypt, sign, and verify S/MIME messages.
5170: .Pp
5171: The MIME message must be sent without any blank lines between the
5172: headers and the output.
5173: Some mail programs will automatically add a blank line.
5174: Piping the mail directly to an MTA is one way to
5175: achieve the correct format.
5176: .Pp
5177: The supplied message to be signed or encrypted must include the necessary
5178: MIME headers or many S/MIME clients won't display it properly (if at all).
5179: Use the
5180: .Fl text
5181: option to automatically add plain text headers.
1.1 jsing 5182: .Pp
1.70 jmc 5183: A
5184: .Qq signed and encrypted
5185: message is one where a signed message is then encrypted.
5186: This can be produced by encrypting an already signed message.
1.1 jsing 5187: .Pp
1.70 jmc 5188: There are a number of operations that can be performed, as follows:
1.1 jsing 5189: .Bl -tag -width "XXXX"
5190: .It Fl decrypt
5191: Decrypt mail using the supplied certificate and private key.
1.70 jmc 5192: The input file is an encrypted mail message in MIME format.
1.1 jsing 5193: The decrypted mail is written to the output file.
5194: .It Fl encrypt
5195: Encrypt mail for the given recipient certificates.
1.70 jmc 5196: The input is the message to be encrypted.
5197: The output file is the encrypted mail, in MIME format.
1.1 jsing 5198: .It Fl pk7out
1.70 jmc 5199: Take an input message and write out a PEM-encoded PKCS#7 structure.
1.1 jsing 5200: .It Fl resign
5201: Resign a message: take an existing message and one or more new signers.
5202: .It Fl sign
5203: Sign mail using the supplied certificate and private key.
1.70 jmc 5204: The input file is the message to be signed.
5205: The signed message, in MIME format, is written to the output file.
1.1 jsing 5206: .It Fl verify
5207: Verify signed mail.
1.70 jmc 5208: The input is a signed mail message and the output is the signed data.
1.1 jsing 5209: Both clear text and opaque signing is supported.
5210: .El
5211: .Pp
1.14 jmc 5212: The remaining options are as follows:
1.1 jsing 5213: .Bl -tag -width "XXXX"
5214: .It Xo
5215: .Fl aes128 | aes192 | aes256 | des |
5216: .Fl des3 | rc2-40 | rc2-64 | rc2-128
5217: .Xc
5218: The encryption algorithm to use.
1.70 jmc 5219: 128-, 192-, or 256-bit AES, DES (56 bits), triple DES (168 bits),
1.1 jsing 5220: or 40-, 64-, or 128-bit RC2, respectively;
5221: if not specified, 40-bit RC2 is
5222: used.
5223: Only used with
5224: .Fl encrypt .
5225: .It Fl binary
5226: Normally, the input message is converted to
5227: .Qq canonical
1.70 jmc 5228: format which uses CR/LF as end of line,
5229: as required by the S/MIME specification.
1.127 jmc 5230: When this option is present, no translation occurs.
1.70 jmc 5231: This is useful when handling binary data which may not be in MIME format.
1.1 jsing 5232: .It Fl CAfile Ar file
5233: A
5234: .Ar file
5235: containing trusted CA certificates; only used with
5236: .Fl verify .
5237: .It Fl CApath Ar directory
5238: A
5239: .Ar directory
5240: containing trusted CA certificates; only used with
5241: .Fl verify .
5242: This directory must be a standard certificate directory:
5243: that is, a hash of each subject name (using
5244: .Nm x509 -hash )
5245: should be linked to each certificate.
5246: .It Ar cert.pem ...
5247: One or more certificates of message recipients: used when encrypting
5248: a message.
5249: .It Fl certfile Ar file
5250: Allows additional certificates to be specified.
5251: When signing, these will be included with the message.
5252: When verifying, these will be searched for the signers' certificates.
5253: The certificates should be in PEM format.
5254: .It Xo
5255: .Fl check_ss_sig ,
5256: .Fl crl_check ,
5257: .Fl crl_check_all ,
5258: .Fl extended_crl ,
5259: .Fl ignore_critical ,
5260: .Fl issuer_checks ,
5261: .Fl policy_check ,
5262: .Fl x509_strict
5263: .Xc
5264: Set various certificate chain validation options.
5265: See the
1.70 jmc 5266: .Nm verify
1.1 jsing 5267: command for details.
5268: .It Fl content Ar file
1.70 jmc 5269: A file containing the detached content.
1.1 jsing 5270: This is only useful with the
5271: .Fl verify
1.70 jmc 5272: option,
5273: and only usable if the PKCS#7 structure is using the detached
1.1 jsing 5274: signature form where the content is not included.
1.70 jmc 5275: This option will override any content if the input format is S/MIME
5276: and it uses the multipart/signed MIME content type.
1.1 jsing 5277: .It Xo
5278: .Fl from Ar addr ,
5279: .Fl subject Ar s ,
5280: .Fl to Ar addr
5281: .Xc
5282: The relevant mail headers.
5283: These are included outside the signed
5284: portion of a message so they may be included manually.
1.70 jmc 5285: When signing, many S/MIME
1.1 jsing 5286: mail clients check that the signer's certificate email
5287: address matches the From: address.
5288: .It Fl in Ar file
1.70 jmc 5289: The input file to read from.
1.1 jsing 5290: .It Fl indef
5291: Enable streaming I/O for encoding operations.
5292: This permits single pass processing of data without
5293: the need to hold the entire contents in memory,
5294: potentially supporting very large files.
5295: Streaming is automatically set for S/MIME signing with detached
5296: data if the output format is SMIME;
5297: it is currently off by default for all other operations.
1.70 jmc 5298: .It Fl inform Cm der | pem | smime
5299: The input format.
1.1 jsing 5300: .It Fl inkey Ar file
1.70 jmc 5301: The private key to use when signing or decrypting,
5302: which must match the corresponding certificate.
1.1 jsing 5303: If this option is not specified, the private key must be included
5304: in the certificate file specified with
5305: the
5306: .Fl recip
5307: or
5308: .Fl signer
5309: file.
5310: When signing,
5311: this option can be used multiple times to specify successive keys.
1.112 inoguchi 5312: .It Fl keyform Cm der | pem
1.1 jsing 5313: Input private key format.
1.112 inoguchi 5314: The default is
5315: .Cm pem .
1.1 jsing 5316: .It Fl md Ar digest
5317: The digest algorithm to use when signing or resigning.
5318: If not present then the default digest algorithm for the signing key is used
5319: (usually SHA1).
5320: .It Fl noattr
1.70 jmc 5321: Do not include attributes.
1.1 jsing 5322: .It Fl nocerts
1.70 jmc 5323: Do not include the signer's certificate.
1.1 jsing 5324: This will reduce the size of the signed message but the verifier must
5325: have a copy of the signer's certificate available locally (passed using the
5326: .Fl certfile
5327: option, for example).
5328: .It Fl nochain
5329: Do not do chain verification of signers' certificates: that is,
5330: don't use the certificates in the signed message as untrusted CAs.
5331: .It Fl nodetach
1.137 naddy 5332: When signing a message, use opaque signing: this form is more resistant
1.1 jsing 5333: to translation by mail relays but it cannot be read by mail agents that
1.70 jmc 5334: do not support S/MIME.
5335: Without this option cleartext signing with the MIME type
5336: multipart/signed is used.
1.1 jsing 5337: .It Fl noindef
1.70 jmc 5338: Disable streaming I/O where it would produce an encoding of indefinite length
5339: (currently has no effect).
1.1 jsing 5340: .It Fl nointern
1.70 jmc 5341: Only use certificates specified in the
5342: .Fl certfile .
5343: The supplied certificates can still be used as untrusted CAs.
1.1 jsing 5344: .It Fl nosigs
1.70 jmc 5345: Do not try to verify the signatures on the message.
1.108 inoguchi 5346: .It Fl nosmimecap
5347: Exclude the list of supported algorithms from signed attributes,
5348: other options such as signing time and content type are still included.
1.1 jsing 5349: .It Fl noverify
5350: Do not verify the signer's certificate of a signed message.
5351: .It Fl out Ar file
1.70 jmc 5352: The output file to write to.
5353: .It Fl outform Cm der | pem | smime
5354: The output format.
5355: The default is smime, which writes an S/MIME format message.
5356: .Cm pem
1.1 jsing 5357: and
1.70 jmc 5358: .Cm der
5359: change this to write PEM and DER format PKCS#7 structures instead.
1.1 jsing 5360: This currently only affects the output format of the PKCS#7
5361: structure; if no PKCS#7 structure is being output (for example with
5362: .Fl verify
5363: or
5364: .Fl decrypt )
5365: this option has no effect.
5366: .It Fl passin Ar arg
5367: The key password source.
5368: .It Fl recip Ar file
5369: The recipients certificate when decrypting a message.
5370: This certificate
5371: must match one of the recipients of the message or an error occurs.
5372: .It Fl signer Ar file
5373: A signing certificate when signing or resigning a message;
5374: this option can be used multiple times if more than one signer is required.
5375: If a message is being verified, the signer's certificates will be
5376: written to this file if the verification was successful.
5377: .It Fl stream
5378: The same as
5379: .Fl indef .
5380: .It Fl text
1.70 jmc 5381: Add plain text (text/plain) MIME
1.1 jsing 5382: headers to the supplied message if encrypting or signing.
5383: If decrypting or verifying, it strips off text headers:
1.70 jmc 5384: if the decrypted or verified message is not of MIME type text/plain
5385: then an error occurs.
1.1 jsing 5386: .El
5387: .Pp
1.70 jmc 5388: The exit codes for
5389: .Nm smime
5390: are as follows:
1.1 jsing 5391: .Pp
1.70 jmc 5392: .Bl -tag -width "XXXX" -offset 3n -compact
5393: .It 0
1.1 jsing 5394: The operation was completely successful.
1.70 jmc 5395: .It 1
1.1 jsing 5396: An error occurred parsing the command options.
1.70 jmc 5397: .It 2
1.1 jsing 5398: One of the input files could not be read.
1.70 jmc 5399: .It 3
5400: An error occurred creating the file or when reading the message.
5401: .It 4
1.1 jsing 5402: An error occurred decrypting or verifying the message.
1.70 jmc 5403: .It 5
5404: An error occurred writing certificates.
1.1 jsing 5405: .El
1.120 kn 5406: .Tg speed
1.1 jsing 5407: .Sh SPEED
1.114 jmc 5408: .Bl -hang -width "openssl speed"
5409: .It Nm openssl speed
5410: .Bk -words
1.71 jmc 5411: .Op Ar algorithm
1.1 jsing 5412: .Op Fl decrypt
5413: .Op Fl elapsed
1.71 jmc 5414: .Op Fl evp Ar algorithm
1.1 jsing 5415: .Op Fl mr
5416: .Op Fl multi Ar number
1.114 jmc 5417: .Ek
5418: .El
1.1 jsing 5419: .Pp
5420: The
5421: .Nm speed
5422: command is used to test the performance of cryptographic algorithms.
5423: .Bl -tag -width "XXXX"
1.71 jmc 5424: .It Ar algorithm
5425: Perform the test using
5426: .Ar algorithm .
5427: The default is to test all algorithms.
1.1 jsing 5428: .It Fl decrypt
1.71 jmc 5429: Time decryption instead of encryption;
5430: must be used with
5431: .Fl evp .
1.1 jsing 5432: .It Fl elapsed
5433: Measure time in real time instead of CPU user time.
1.71 jmc 5434: .It Fl evp Ar algorithm
5435: Perform the test using one of the algorithms accepted by
5436: .Xr EVP_get_cipherbyname 3 .
1.1 jsing 5437: .It Fl mr
5438: Produce machine readable output.
5439: .It Fl multi Ar number
5440: Run
5441: .Ar number
5442: benchmarks in parallel.
5443: .El
1.120 kn 5444: .Tg spkac
1.77 jmc 5445: .Sh SPKAC
1.114 jmc 5446: .Bl -hang -width "openssl spkac"
5447: .It Nm openssl spkac
5448: .Bk -words
1.77 jmc 5449: .Op Fl challenge Ar string
5450: .Op Fl in Ar file
5451: .Op Fl key Ar keyfile
5452: .Op Fl noout
5453: .Op Fl out Ar file
5454: .Op Fl passin Ar arg
5455: .Op Fl pubkey
5456: .Op Fl spkac Ar spkacname
5457: .Op Fl spksect Ar section
5458: .Op Fl verify
1.114 jmc 5459: .Ek
5460: .El
1.77 jmc 5461: .Pp
5462: The
5463: .Nm spkac
5464: command processes signed public key and challenge (SPKAC) files.
5465: It can print out their contents, verify the signature,
5466: and produce its own SPKACs from a supplied private key.
5467: .Pp
5468: The options are as follows:
5469: .Bl -tag -width Ds
5470: .It Fl challenge Ar string
5471: The challenge string, if an SPKAC is being created.
5472: .It Fl in Ar file
5473: The input file to read from,
5474: or standard input if not specified.
5475: Ignored if the
5476: .Fl key
5477: option is used.
5478: .It Fl key Ar keyfile
5479: Create an SPKAC file using the private key in
5480: .Ar keyfile .
5481: The
5482: .Fl in , noout , spksect ,
5483: and
5484: .Fl verify
5485: options are ignored, if present.
5486: .It Fl noout
5487: Do not output the text version of the SPKAC.
5488: .It Fl out Ar file
5489: The output file to write to,
5490: or standard output if not specified.
5491: .It Fl passin Ar arg
5492: The key password source.
5493: .It Fl pubkey
5494: Output the public key of an SPKAC.
5495: .It Fl spkac Ar spkacname
5496: An alternative name for the variable containing the SPKAC.
5497: The default is "SPKAC".
5498: This option affects both generated and input SPKAC files.
5499: .It Fl spksect Ar section
5500: An alternative name for the
5501: .Ar section
5502: containing the SPKAC.
5503: .It Fl verify
5504: Verify the digital signature on the supplied SPKAC.
5505: .El
1.120 kn 5506: .Tg ts
1.1 jsing 5507: .Sh TS
1.114 jmc 5508: .Bk -words
5509: .Bl -hang -width "openssl ts"
5510: .It Nm openssl ts
1.1 jsing 5511: .Fl query
1.29 bcook 5512: .Op Fl md4 | md5 | ripemd160 | sha1
1.1 jsing 5513: .Op Fl cert
5514: .Op Fl config Ar configfile
5515: .Op Fl data Ar file_to_hash
5516: .Op Fl digest Ar digest_bytes
5517: .Op Fl in Ar request.tsq
5518: .Op Fl no_nonce
5519: .Op Fl out Ar request.tsq
5520: .Op Fl policy Ar object_id
5521: .Op Fl text
1.114 jmc 5522: .It Nm openssl ts
1.1 jsing 5523: .Fl reply
5524: .Op Fl chain Ar certs_file.pem
5525: .Op Fl config Ar configfile
5526: .Op Fl in Ar response.tsr
5527: .Op Fl inkey Ar private.pem
5528: .Op Fl out Ar response.tsr
5529: .Op Fl passin Ar arg
5530: .Op Fl policy Ar object_id
5531: .Op Fl queryfile Ar request.tsq
5532: .Op Fl section Ar tsa_section
5533: .Op Fl signer Ar tsa_cert.pem
5534: .Op Fl text
5535: .Op Fl token_in
5536: .Op Fl token_out
1.114 jmc 5537: .It Nm openssl ts
1.1 jsing 5538: .Fl verify
5539: .Op Fl CAfile Ar trusted_certs.pem
5540: .Op Fl CApath Ar trusted_cert_path
5541: .Op Fl data Ar file_to_hash
5542: .Op Fl digest Ar digest_bytes
5543: .Op Fl in Ar response.tsr
5544: .Op Fl queryfile Ar request.tsq
5545: .Op Fl token_in
5546: .Op Fl untrusted Ar cert_file.pem
1.114 jmc 5547: .El
5548: .Ek
1.1 jsing 5549: .Pp
5550: The
5551: .Nm ts
5552: command is a basic Time Stamping Authority (TSA) client and server
5553: application as specified in RFC 3161 (Time-Stamp Protocol, TSP).
5554: A TSA can be part of a PKI deployment and its role is to provide long
1.72 jmc 5555: term proof of the existence of specific data.
1.1 jsing 5556: Here is a brief description of the protocol:
5557: .Bl -enum
5558: .It
5559: The TSA client computes a one-way hash value for a data file and sends
5560: the hash to the TSA.
5561: .It
5562: The TSA attaches the current date and time to the received hash value,
5563: signs them and sends the time stamp token back to the client.
5564: By creating this token the TSA certifies the existence of the original
5565: data file at the time of response generation.
5566: .It
5567: The TSA client receives the time stamp token and verifies the
5568: signature on it.
5569: It also checks if the token contains the same hash
5570: value that it had sent to the TSA.
5571: .El
5572: .Pp
5573: There is one DER-encoded protocol data unit defined for transporting a time
5574: stamp request to the TSA and one for sending the time stamp response
5575: back to the client.
5576: The
5577: .Nm ts
5578: command has three main functions:
5579: creating a time stamp request based on a data file;
5580: creating a time stamp response based on a request;
5581: and verifying if a response corresponds
5582: to a particular request or a data file.
5583: .Pp
5584: There is no support for sending the requests/responses automatically
5585: over HTTP or TCP yet as suggested in RFC 3161.
5586: Users must send the requests either by FTP or email.
5587: .Pp
5588: The
5589: .Fl query
5590: switch can be used for creating and printing a time stamp
5591: request with the following options:
5592: .Bl -tag -width Ds
5593: .It Fl cert
1.72 jmc 5594: Expect the TSA to include its signing certificate in the response.
1.1 jsing 5595: .It Fl config Ar configfile
1.72 jmc 5596: Specify an alternative configuration file.
5597: Only the OID section is used.
1.1 jsing 5598: .It Fl data Ar file_to_hash
5599: The data file for which the time stamp request needs to be created.
1.72 jmc 5600: The default is standard input.
1.1 jsing 5601: .It Fl digest Ar digest_bytes
1.72 jmc 5602: Specify the message imprint explicitly without the data file.
1.1 jsing 5603: The imprint must be specified in a hexadecimal format,
5604: two characters per byte,
1.72 jmc 5605: the bytes optionally separated by colons.
1.1 jsing 5606: The number of bytes must match the message digest algorithm in use.
5607: .It Fl in Ar request.tsq
1.72 jmc 5608: A previously created time stamp request in DER
1.1 jsing 5609: format that will be printed into the output file.
1.72 jmc 5610: Useful for examining the content of a request in human-readable format.
1.76 jmc 5611: .It Fl md4 | md5 | ripemd160 | sha | sha1
1.1 jsing 5612: The message digest to apply to the data file.
5613: It supports all the message digest algorithms that are supported by the
5614: .Nm dgst
5615: command.
1.125 inoguchi 5616: The default is SHA1.
1.1 jsing 5617: .It Fl no_nonce
1.72 jmc 5618: Specify no nonce in the request.
5619: The default, to include a 64-bit long pseudo-random nonce,
5620: is recommended to protect against replay attacks.
1.1 jsing 5621: .It Fl out Ar request.tsq
1.72 jmc 5622: The output file to write to,
5623: or standard output if not specified.
1.1 jsing 5624: .It Fl policy Ar object_id
5625: The policy that the client expects the TSA to use for creating the
5626: time stamp token.
1.72 jmc 5627: Either dotted OID notation or OID names defined
1.1 jsing 5628: in the config file can be used.
1.127 jmc 5629: If no policy is requested, the TSA uses its own default policy.
1.1 jsing 5630: .It Fl text
1.72 jmc 5631: Output in human-readable text format instead of DER.
1.1 jsing 5632: .El
5633: .Pp
5634: A time stamp response (TimeStampResp) consists of a response status
5635: and the time stamp token itself (ContentInfo),
5636: if the token generation was successful.
5637: The
5638: .Fl reply
5639: command is for creating a time stamp
5640: response or time stamp token based on a request and printing the
5641: response/token in human-readable format.
5642: If
5643: .Fl token_out
5644: is not specified the output is always a time stamp response (TimeStampResp),
5645: otherwise it is a time stamp token (ContentInfo).
5646: .Bl -tag -width Ds
5647: .It Fl chain Ar certs_file.pem
1.72 jmc 5648: The collection of PEM certificates
1.1 jsing 5649: that will be included in the response
5650: in addition to the signer certificate if the
5651: .Fl cert
5652: option was used for the request.
5653: This file is supposed to contain the certificate chain
5654: for the signer certificate from its issuer upwards.
5655: The
5656: .Fl reply
5657: command does not build a certificate chain automatically.
5658: .It Fl config Ar configfile
1.72 jmc 5659: Specify an alternative configuration file.
1.1 jsing 5660: .It Fl in Ar response.tsr
1.72 jmc 5661: Specify a previously created time stamp response (or time stamp token, if
1.1 jsing 5662: .Fl token_in
1.72 jmc 5663: is also specified)
1.1 jsing 5664: in DER format that will be written to the output file.
5665: This option does not require a request;
5666: it is useful, for example,
1.72 jmc 5667: to examine the content of a response or token
5668: or to extract the time stamp token from a response.
1.137 naddy 5669: If the input is a token and the output is a time stamp response, a default
1.72 jmc 5670: .Qq granted
1.1 jsing 5671: status info is added to the token.
5672: .It Fl inkey Ar private.pem
5673: The signer private key of the TSA in PEM format.
5674: Overrides the
5675: .Cm signer_key
5676: config file option.
5677: .It Fl out Ar response.tsr
5678: The response is written to this file.
5679: The format and content of the file depends on other options (see
5680: .Fl text
5681: and
5682: .Fl token_out ) .
5683: The default is stdout.
5684: .It Fl passin Ar arg
5685: The key password source.
5686: .It Fl policy Ar object_id
1.72 jmc 5687: The default policy to use for the response.
5688: Either dotted OID notation or OID names defined
5689: in the config file can be used.
1.137 naddy 5690: If no policy is requested, the TSA uses its own default policy.
1.1 jsing 5691: .It Fl queryfile Ar request.tsq
1.72 jmc 5692: The file containing a DER-encoded time stamp request.
1.1 jsing 5693: .It Fl section Ar tsa_section
1.72 jmc 5694: The config file section containing the settings for response generation.
1.1 jsing 5695: .It Fl signer Ar tsa_cert.pem
1.72 jmc 5696: The PEM signer certificate of the TSA.
1.1 jsing 5697: The TSA signing certificate must have exactly one extended key usage
5698: assigned to it: timeStamping.
5699: The extended key usage must also be critical,
5700: otherwise the certificate is going to be refused.
5701: Overrides the
5702: .Cm signer_cert
5703: variable of the config file.
5704: .It Fl text
1.72 jmc 5705: Output in human-readable text format instead of DER.
1.1 jsing 5706: .It Fl token_in
1.72 jmc 5707: The input is a DER-encoded time stamp token (ContentInfo)
5708: instead of a time stamp response (TimeStampResp).
1.1 jsing 5709: .It Fl token_out
1.72 jmc 5710: The output is a time stamp token (ContentInfo)
5711: instead of a time stamp response (TimeStampResp).
1.1 jsing 5712: .El
5713: .Pp
5714: The
5715: .Fl verify
5716: command is for verifying if a time stamp response or time stamp token
5717: is valid and matches a particular time stamp request or data file.
5718: The
5719: .Fl verify
5720: command does not use the configuration file.
5721: .Bl -tag -width Ds
5722: .It Fl CAfile Ar trusted_certs.pem
1.72 jmc 5723: The file containing a set of trusted self-signed PEM CA certificates.
5724: See
1.1 jsing 5725: .Nm verify
5726: for additional details.
5727: Either this option or
5728: .Fl CApath
5729: must be specified.
5730: .It Fl CApath Ar trusted_cert_path
1.112 inoguchi 5731: The directory containing the trusted CA certificates of the client.
1.72 jmc 5732: See
1.1 jsing 5733: .Nm verify
5734: for additional details.
5735: Either this option or
5736: .Fl CAfile
5737: must be specified.
5738: .It Fl data Ar file_to_hash
5739: The response or token must be verified against
5740: .Ar file_to_hash .
5741: The file is hashed with the message digest algorithm specified in the token.
5742: The
5743: .Fl digest
5744: and
5745: .Fl queryfile
5746: options must not be specified with this one.
5747: .It Fl digest Ar digest_bytes
5748: The response or token must be verified against the message digest specified
5749: with this option.
5750: The number of bytes must match the message digest algorithm
5751: specified in the token.
5752: The
5753: .Fl data
5754: and
5755: .Fl queryfile
5756: options must not be specified with this one.
5757: .It Fl in Ar response.tsr
5758: The time stamp response that needs to be verified, in DER format.
5759: This option in mandatory.
5760: .It Fl queryfile Ar request.tsq
5761: The original time stamp request, in DER format.
5762: The
5763: .Fl data
5764: and
5765: .Fl digest
5766: options must not be specified with this one.
5767: .It Fl token_in
1.72 jmc 5768: The input is a DER-encoded time stamp token (ContentInfo)
5769: instead of a time stamp response (TimeStampResp).
1.1 jsing 5770: .It Fl untrusted Ar cert_file.pem
1.72 jmc 5771: Additional untrusted PEM certificates which may be needed
5772: when building the certificate chain for the TSA's signing certificate.
1.1 jsing 5773: This file must contain the TSA signing certificate and
5774: all intermediate CA certificates unless the response includes them.
5775: .El
5776: .Pp
1.72 jmc 5777: Options specified on the command line always override
5778: the settings in the config file:
1.1 jsing 5779: .Bl -tag -width Ds
5780: .It Cm tsa Ar section , Cm default_tsa
5781: This is the main section and it specifies the name of another section
5782: that contains all the options for the
5783: .Fl reply
5784: option.
1.72 jmc 5785: This section can be overridden with the
1.1 jsing 5786: .Fl section
5787: command line switch.
5788: .It Cm oid_file
5789: See
5790: .Nm ca
5791: for a description.
5792: .It Cm oid_section
5793: See
5794: .Nm ca
5795: for a description.
5796: .It Cm serial
1.72 jmc 5797: The file containing the hexadecimal serial number of the
1.1 jsing 5798: last time stamp response created.
5799: This number is incremented by 1 for each response.
1.137 naddy 5800: If the file does not exist at the time of response generation,
1.72 jmc 5801: a new file is created with serial number 1.
1.1 jsing 5802: This parameter is mandatory.
5803: .It Cm signer_cert
5804: TSA signing certificate, in PEM format.
5805: The same as the
5806: .Fl signer
5807: command line option.
5808: .It Cm certs
1.72 jmc 5809: A set of PEM-encoded certificates that need to be
1.1 jsing 5810: included in the response.
5811: The same as the
5812: .Fl chain
5813: command line option.
5814: .It Cm signer_key
5815: The private key of the TSA, in PEM format.
5816: The same as the
5817: .Fl inkey
5818: command line option.
5819: .It Cm default_policy
5820: The default policy to use when the request does not mandate any policy.
5821: The same as the
5822: .Fl policy
5823: command line option.
5824: .It Cm other_policies
5825: Comma separated list of policies that are also acceptable by the TSA
5826: and used only if the request explicitly specifies one of them.
5827: .It Cm digests
5828: The list of message digest algorithms that the TSA accepts.
5829: At least one algorithm must be specified.
5830: This parameter is mandatory.
5831: .It Cm accuracy
5832: The accuracy of the time source of the TSA in seconds, milliseconds
5833: and microseconds.
5834: For example, secs:1, millisecs:500, microsecs:100.
5835: If any of the components is missing,
5836: zero is assumed for that field.
5837: .It Cm clock_precision_digits
1.72 jmc 5838: The maximum number of digits, which represent the fraction of seconds,
5839: that need to be included in the time field.
1.1 jsing 5840: The trailing zeroes must be removed from the time,
1.72 jmc 5841: so there might actually be fewer digits
1.1 jsing 5842: or no fraction of seconds at all.
5843: The maximum value is 6;
5844: the default is 0.
5845: .It Cm ordering
5846: If this option is yes,
5847: the responses generated by this TSA can always be ordered,
5848: even if the time difference between two responses is less
5849: than the sum of their accuracies.
5850: The default is no.
5851: .It Cm tsa_name
5852: Set this option to yes if the subject name of the TSA must be included in
5853: the TSA name field of the response.
5854: The default is no.
5855: .It Cm ess_cert_id_chain
5856: The SignedData objects created by the TSA always contain the
5857: certificate identifier of the signing certificate in a signed
5858: attribute (see RFC 2634, Enhanced Security Services).
5859: If this option is set to yes and either the
5860: .Cm certs
5861: variable or the
5862: .Fl chain
5863: option is specified then the certificate identifiers of the chain will also
5864: be included in the SigningCertificate signed attribute.
5865: If this variable is set to no,
5866: only the signing certificate identifier is included.
5867: The default is no.
5868: .El
1.120 kn 5869: .Tg verify
1.1 jsing 5870: .Sh VERIFY
1.114 jmc 5871: .Bl -hang -width "openssl verify"
5872: .It Nm openssl verify
5873: .Bk -words
1.1 jsing 5874: .Op Fl CAfile Ar file
5875: .Op Fl CApath Ar directory
5876: .Op Fl check_ss_sig
1.107 inoguchi 5877: .Op Fl CRLfile Ar file
1.1 jsing 5878: .Op Fl crl_check
5879: .Op Fl crl_check_all
5880: .Op Fl explicit_policy
5881: .Op Fl extended_crl
5882: .Op Fl help
5883: .Op Fl ignore_critical
5884: .Op Fl inhibit_any
5885: .Op Fl inhibit_map
5886: .Op Fl issuer_checks
1.126 tb 5887: .Op Fl legacy_verify
1.1 jsing 5888: .Op Fl policy_check
5889: .Op Fl purpose Ar purpose
1.107 inoguchi 5890: .Op Fl trusted Ar file
1.1 jsing 5891: .Op Fl untrusted Ar file
5892: .Op Fl verbose
5893: .Op Fl x509_strict
5894: .Op Ar certificates
1.114 jmc 5895: .Ek
5896: .El
1.1 jsing 5897: .Pp
5898: The
5899: .Nm verify
5900: command verifies certificate chains.
5901: .Pp
5902: The options are as follows:
5903: .Bl -tag -width Ds
5904: .It Fl CAfile Ar file
5905: A
5906: .Ar file
5907: of trusted certificates.
5908: The
5909: .Ar file
5910: should contain multiple certificates in PEM format, concatenated together.
5911: .It Fl CApath Ar directory
5912: A
5913: .Ar directory
5914: of trusted certificates.
1.76 jmc 5915: The certificates, or symbolic links to them,
5916: should have names of the form
5917: .Ar hash Ns .0 ,
5918: where
5919: .Ar hash
5920: is the hashed certificate subject name
5921: (see the
1.1 jsing 5922: .Fl hash
5923: option of the
5924: .Nm x509
5925: utility).
1.107 inoguchi 5926: .It Fl check_ss_sig
5927: Verify the signature on the self-signed root CA.
5928: This is disabled by default
5929: because it doesn't add any security.
5930: .It Fl CRLfile Ar file
5931: The
5932: .Ar file
5933: should contain one or more CRLs in PEM format.
1.1 jsing 5934: .It Fl crl_check
1.76 jmc 5935: Check end entity certificate validity by attempting to look up a valid CRL.
1.127 jmc 5936: If a valid CRL cannot be found, an error occurs.
1.1 jsing 5937: .It Fl crl_check_all
1.76 jmc 5938: Check the validity of all certificates in the chain by attempting
1.1 jsing 5939: to look up valid CRLs.
5940: .It Fl explicit_policy
1.76 jmc 5941: Set policy variable require-explicit-policy (RFC 3280).
1.1 jsing 5942: .It Fl extended_crl
5943: Enable extended CRL features such as indirect CRLs and alternate CRL
5944: signing keys.
5945: .It Fl help
1.76 jmc 5946: Print a usage message.
1.1 jsing 5947: .It Fl ignore_critical
1.76 jmc 5948: Ignore critical extensions instead of rejecting the certificate.
1.1 jsing 5949: .It Fl inhibit_any
1.76 jmc 5950: Set policy variable inhibit-any-policy (RFC 3280).
1.1 jsing 5951: .It Fl inhibit_map
1.76 jmc 5952: Set policy variable inhibit-policy-mapping (RFC 3280).
1.1 jsing 5953: .It Fl issuer_checks
1.76 jmc 5954: Print diagnostics relating to searches for the issuer certificate
5955: of the current certificate
5956: showing why each candidate issuer certificate was rejected.
5957: The presence of rejection messages
5958: does not itself imply that anything is wrong:
5959: during the normal verify process several rejections may take place.
1.126 tb 5960: .It Fl legacy_verify
5961: Use the legacy X.509 certificate chain verification code.
1.1 jsing 5962: .It Fl policy_check
1.76 jmc 5963: Enable certificate policy processing.
1.1 jsing 5964: .It Fl purpose Ar purpose
5965: The intended use for the certificate.
5966: Without this option no chain verification will be done.
5967: Currently accepted uses are
1.76 jmc 5968: .Cm sslclient , sslserver ,
5969: .Cm nssslserver , smimesign ,
5970: .Cm smimeencrypt , crlsign ,
5971: .Cm any ,
1.1 jsing 5972: and
1.76 jmc 5973: .Cm ocsphelper .
1.107 inoguchi 5974: .It Fl trusted Ar file
5975: A
5976: .Ar file
5977: of trusted certificates.
5978: The
5979: .Ar file
5980: should contain multiple certificates.
1.1 jsing 5981: .It Fl untrusted Ar file
5982: A
5983: .Ar file
5984: of untrusted certificates.
5985: The
5986: .Ar file
5987: should contain multiple certificates.
5988: .It Fl verbose
5989: Print extra information about the operations being performed.
5990: .It Fl x509_strict
5991: Disable workarounds for broken certificates which have to be disabled
5992: for strict X.509 compliance.
5993: .It Ar certificates
1.76 jmc 5994: One or more PEM
1.1 jsing 5995: .Ar certificates
5996: to verify.
5997: If no certificate files are included, an attempt is made to read
5998: a certificate from standard input.
1.76 jmc 5999: If the first certificate filename begins with a dash,
6000: use a lone dash to mark the last option.
1.1 jsing 6001: .El
1.76 jmc 6002: .Pp
1.1 jsing 6003: The
6004: .Nm verify
6005: program uses the same functions as the internal SSL and S/MIME verification,
1.76 jmc 6006: with one crucial difference:
6007: wherever possible an attempt is made to continue after an error,
6008: whereas normally the verify operation would halt on the first error.
1.1 jsing 6009: This allows all the problems with a certificate chain to be determined.
6010: .Pp
1.76 jmc 6011: The verify operation consists of a number of separate steps.
1.1 jsing 6012: Firstly a certificate chain is built up starting from the supplied certificate
6013: and ending in the root CA.
6014: It is an error if the whole chain cannot be built up.
6015: The chain is built up by looking up the issuer's certificate of the current
6016: certificate.
6017: If a certificate is found which is its own issuer, it is assumed
6018: to be the root CA.
6019: .Pp
1.76 jmc 6020: All certificates whose subject name matches the issuer name
1.1 jsing 6021: of the current certificate are subject to further tests.
6022: The relevant authority key identifier components of the current certificate
1.76 jmc 6023: (if present) must match the subject key identifier (if present)
6024: and issuer and serial number of the candidate issuer;
6025: in addition the
6026: .Cm keyUsage
6027: extension of the candidate issuer (if present) must permit certificate signing.
1.1 jsing 6028: .Pp
6029: The lookup first looks in the list of untrusted certificates and if no match
6030: is found the remaining lookups are from the trusted certificates.
1.76 jmc 6031: The root CA is always looked up in the trusted certificate list:
6032: if the certificate to verify is a root certificate,
6033: then an exact match must be found in the trusted list.
1.1 jsing 6034: .Pp
6035: The second operation is to check every untrusted certificate's extensions for
6036: consistency with the supplied purpose.
6037: If the
6038: .Fl purpose
6039: option is not included, then no checks are done.
6040: The supplied or
6041: .Qq leaf
6042: certificate must have extensions compatible with the supplied purpose
6043: and all other certificates must also be valid CA certificates.
6044: The precise extensions required are described in more detail in
6045: the
1.76 jmc 6046: .Nm X509
1.1 jsing 6047: section below.
6048: .Pp
6049: The third operation is to check the trust settings on the root CA.
6050: The root CA should be trusted for the supplied purpose.
1.76 jmc 6051: A certificate with no trust settings is considered to be valid for
1.1 jsing 6052: all purposes.
6053: .Pp
6054: The final operation is to check the validity of the certificate chain.
6055: The validity period is checked against the current system time and the
1.76 jmc 6056: .Cm notBefore
1.1 jsing 6057: and
1.76 jmc 6058: .Cm notAfter
1.1 jsing 6059: dates in the certificate.
6060: The certificate signatures are also checked at this point.
6061: .Pp
6062: If all operations complete successfully, the certificate is considered
6063: valid.
6064: If any operation fails then the certificate is not valid.
6065: When a verify operation fails, the output messages can be somewhat cryptic.
6066: The general form of the error message is:
1.76 jmc 6067: .Bd -literal
6068: server.pem: /C=AU/ST=Queensland/O=CryptSoft Pty Ltd/CN=Test CA (1024-bit)
6069: error 24 at 1 depth lookup:invalid CA certificate
1.1 jsing 6070: .Ed
6071: .Pp
6072: The first line contains the name of the certificate being verified, followed by
6073: the subject name of the certificate.
6074: The second line contains the error number and the depth.
6075: The depth is the number of the certificate being verified when a
6076: problem was detected starting with zero for the certificate being verified
6077: itself, then 1 for the CA that signed the certificate and so on.
6078: Finally a text version of the error number is presented.
6079: .Pp
6080: An exhaustive list of the error codes and messages is shown below; this also
6081: includes the name of the error code as defined in the header file
1.12 bentley 6082: .In openssl/x509_vfy.h .
1.76 jmc 6083: Some of the error codes are defined but never returned: these are described as
1.1 jsing 6084: .Qq unused .
6085: .Bl -tag -width "XXXX"
1.78 jmc 6086: .It 0 X509_V_OK
1.1 jsing 6087: The operation was successful.
1.78 jmc 6088: .It 2 X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT
6089: The issuer certificate of an untrusted certificate could not be found.
6090: .It 3 X509_V_ERR_UNABLE_TO_GET_CRL
1.1 jsing 6091: The CRL of a certificate could not be found.
1.78 jmc 6092: .It 4 X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE
1.1 jsing 6093: The certificate signature could not be decrypted.
1.78 jmc 6094: This means that the actual signature value could not be determined
6095: rather than it not matching the expected value.
1.1 jsing 6096: This is only meaningful for RSA keys.
1.78 jmc 6097: .It 5 X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE
6098: The CRL signature could not be decrypted.
6099: This means that the actual signature value could not be determined
6100: rather than it not matching the expected value.
1.1 jsing 6101: Unused.
1.78 jmc 6102: .It 6 X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY
1.1 jsing 6103: The public key in the certificate
1.76 jmc 6104: .Cm SubjectPublicKeyInfo
1.1 jsing 6105: could not be read.
1.78 jmc 6106: .It 7 X509_V_ERR_CERT_SIGNATURE_FAILURE
1.1 jsing 6107: The signature of the certificate is invalid.
1.78 jmc 6108: .It 8 X509_V_ERR_CRL_SIGNATURE_FAILURE
1.1 jsing 6109: The signature of the certificate is invalid.
1.78 jmc 6110: .It 9 X509_V_ERR_CERT_NOT_YET_VALID
1.1 jsing 6111: The certificate is not yet valid: the
1.76 jmc 6112: .Cm notBefore
1.1 jsing 6113: date is after the current time.
1.78 jmc 6114: .It 10 X509_V_ERR_CERT_HAS_EXPIRED
1.1 jsing 6115: The certificate has expired; that is, the
1.76 jmc 6116: .Cm notAfter
1.1 jsing 6117: date is before the current time.
1.78 jmc 6118: .It 11 X509_V_ERR_CRL_NOT_YET_VALID
1.1 jsing 6119: The CRL is not yet valid.
1.78 jmc 6120: .It 12 X509_V_ERR_CRL_HAS_EXPIRED
1.1 jsing 6121: The CRL has expired.
1.78 jmc 6122: .It 13 X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD
1.1 jsing 6123: The certificate
1.76 jmc 6124: .Cm notBefore
1.1 jsing 6125: field contains an invalid time.
1.78 jmc 6126: .It 14 X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD
1.1 jsing 6127: The certificate
1.76 jmc 6128: .Cm notAfter
1.1 jsing 6129: field contains an invalid time.
1.78 jmc 6130: .It 15 X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD
1.1 jsing 6131: The CRL
1.76 jmc 6132: .Cm lastUpdate
1.1 jsing 6133: field contains an invalid time.
1.78 jmc 6134: .It 16 X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD
1.1 jsing 6135: The CRL
1.76 jmc 6136: .Cm nextUpdate
1.1 jsing 6137: field contains an invalid time.
1.78 jmc 6138: .It 17 X509_V_ERR_OUT_OF_MEM
1.1 jsing 6139: An error occurred trying to allocate memory.
6140: This should never happen.
1.78 jmc 6141: .It 18 X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT
1.1 jsing 6142: The passed certificate is self-signed and the same certificate cannot be
6143: found in the list of trusted certificates.
1.78 jmc 6144: .It 19 X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN
1.1 jsing 6145: The certificate chain could be built up using the untrusted certificates but
6146: the root could not be found locally.
1.78 jmc 6147: .It 20 X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY
1.1 jsing 6148: The issuer certificate of a locally looked up certificate could not be found.
6149: This normally means the list of trusted certificates is not complete.
1.78 jmc 6150: .It 21 X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE
1.1 jsing 6151: No signatures could be verified because the chain contains only one
6152: certificate and it is not self-signed.
1.78 jmc 6153: .It 22 X509_V_ERR_CERT_CHAIN_TOO_LONG
1.1 jsing 6154: The certificate chain length is greater than the supplied maximum depth.
6155: Unused.
1.78 jmc 6156: .It 23 X509_V_ERR_CERT_REVOKED
1.1 jsing 6157: The certificate has been revoked.
1.78 jmc 6158: .It 24 X509_V_ERR_INVALID_CA
1.1 jsing 6159: A CA certificate is invalid.
6160: Either it is not a CA or its extensions are not consistent
6161: with the supplied purpose.
1.78 jmc 6162: .It 25 X509_V_ERR_PATH_LENGTH_EXCEEDED
1.1 jsing 6163: The
1.76 jmc 6164: .Cm basicConstraints
1.1 jsing 6165: pathlength parameter has been exceeded.
1.78 jmc 6166: .It 26 X509_V_ERR_INVALID_PURPOSE
1.1 jsing 6167: The supplied certificate cannot be used for the specified purpose.
1.78 jmc 6168: .It 27 X509_V_ERR_CERT_UNTRUSTED
1.1 jsing 6169: The root CA is not marked as trusted for the specified purpose.
1.78 jmc 6170: .It 28 X509_V_ERR_CERT_REJECTED
1.1 jsing 6171: The root CA is marked to reject the specified purpose.
1.78 jmc 6172: .It 29 X509_V_ERR_SUBJECT_ISSUER_MISMATCH
1.1 jsing 6173: The current candidate issuer certificate was rejected because its subject name
6174: did not match the issuer name of the current certificate.
6175: Only displayed when the
6176: .Fl issuer_checks
6177: option is set.
1.78 jmc 6178: .It 30 X509_V_ERR_AKID_SKID_MISMATCH
1.1 jsing 6179: The current candidate issuer certificate was rejected because its subject key
6180: identifier was present and did not match the authority key identifier current
6181: certificate.
6182: Only displayed when the
6183: .Fl issuer_checks
6184: option is set.
1.78 jmc 6185: .It 31 X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH
1.1 jsing 6186: The current candidate issuer certificate was rejected because its issuer name
6187: and serial number were present and did not match the authority key identifier
6188: of the current certificate.
6189: Only displayed when the
6190: .Fl issuer_checks
6191: option is set.
1.78 jmc 6192: .It 32 X509_V_ERR_KEYUSAGE_NO_CERTSIGN
1.1 jsing 6193: The current candidate issuer certificate was rejected because its
1.76 jmc 6194: .Cm keyUsage
1.1 jsing 6195: extension does not permit certificate signing.
1.78 jmc 6196: .It 50 X509_V_ERR_APPLICATION_VERIFICATION
1.1 jsing 6197: An application specific error.
6198: Unused.
6199: .El
1.120 kn 6200: .Tg version
1.1 jsing 6201: .Sh VERSION
6202: .Nm openssl version
6203: .Op Fl abdfopv
6204: .Pp
6205: The
6206: .Nm version
6207: command is used to print out version information about
1.79 jmc 6208: .Nm openssl .
1.1 jsing 6209: .Pp
6210: The options are as follows:
6211: .Bl -tag -width Ds
6212: .It Fl a
6213: All information: this is the same as setting all the other flags.
6214: .It Fl b
6215: The date the current version of
1.79 jmc 6216: .Nm openssl
1.1 jsing 6217: was built.
6218: .It Fl d
6219: .Ev OPENSSLDIR
6220: setting.
6221: .It Fl f
6222: Compilation flags.
6223: .It Fl o
6224: Option information: various options set when the library was built.
6225: .It Fl p
6226: Platform setting.
6227: .It Fl v
6228: The current
1.79 jmc 6229: .Nm openssl
1.1 jsing 6230: version.
6231: .El
1.120 kn 6232: .Tg x509
1.1 jsing 6233: .Sh X509
1.114 jmc 6234: .Bl -hang -width "openssl x509"
6235: .It Nm openssl x509
6236: .Bk -words
1.1 jsing 6237: .Op Fl C
6238: .Op Fl addreject Ar arg
6239: .Op Fl addtrust Ar arg
6240: .Op Fl alias
6241: .Op Fl CA Ar file
6242: .Op Fl CAcreateserial
1.80 jmc 6243: .Op Fl CAform Cm der | pem
1.1 jsing 6244: .Op Fl CAkey Ar file
1.80 jmc 6245: .Op Fl CAkeyform Cm der | pem
1.1 jsing 6246: .Op Fl CAserial Ar file
6247: .Op Fl certopt Ar option
6248: .Op Fl checkend Ar arg
6249: .Op Fl clrext
6250: .Op Fl clrreject
6251: .Op Fl clrtrust
6252: .Op Fl dates
6253: .Op Fl days Ar arg
6254: .Op Fl email
6255: .Op Fl enddate
6256: .Op Fl extensions Ar section
6257: .Op Fl extfile Ar file
6258: .Op Fl fingerprint
6259: .Op Fl hash
6260: .Op Fl in Ar file
1.80 jmc 6261: .Op Fl inform Cm der | net | pem
1.1 jsing 6262: .Op Fl issuer
6263: .Op Fl issuer_hash
6264: .Op Fl issuer_hash_old
1.80 jmc 6265: .Op Fl keyform Cm der | pem
1.29 bcook 6266: .Op Fl md5 | sha1
1.1 jsing 6267: .Op Fl modulus
6268: .Op Fl nameopt Ar option
1.107 inoguchi 6269: .Op Fl next_serial
1.1 jsing 6270: .Op Fl noout
6271: .Op Fl ocsp_uri
6272: .Op Fl ocspid
6273: .Op Fl out Ar file
1.80 jmc 6274: .Op Fl outform Cm der | net | pem
1.1 jsing 6275: .Op Fl passin Ar arg
6276: .Op Fl pubkey
6277: .Op Fl purpose
6278: .Op Fl req
6279: .Op Fl serial
6280: .Op Fl set_serial Ar n
6281: .Op Fl setalias Ar arg
6282: .Op Fl signkey Ar file
1.107 inoguchi 6283: .Op Fl sigopt Ar nm:v
1.1 jsing 6284: .Op Fl startdate
6285: .Op Fl subject
6286: .Op Fl subject_hash
6287: .Op Fl subject_hash_old
6288: .Op Fl text
6289: .Op Fl trustout
6290: .Op Fl x509toreq
1.114 jmc 6291: .Ek
6292: .El
1.1 jsing 6293: .Pp
6294: The
6295: .Nm x509
6296: command is a multi-purpose certificate utility.
6297: It can be used to display certificate information, convert certificates to
6298: various forms, sign certificate requests like a
6299: .Qq mini CA ,
6300: or edit certificate trust settings.
6301: .Pp
1.80 jmc 6302: The following are x509 input, output, and general purpose options:
1.1 jsing 6303: .Bl -tag -width "XXXX"
6304: .It Fl in Ar file
1.80 jmc 6305: The input file to read from,
6306: or standard input if not specified.
6307: .It Fl inform Cm der | net | pem
6308: The input format.
1.1 jsing 6309: Normally, the command will expect an X.509 certificate,
6310: but this can change if other options such as
6311: .Fl req
6312: are present.
1.29 bcook 6313: .It Fl md5 | sha1
1.1 jsing 6314: The digest to use.
6315: This affects any signing or display option that uses a message digest,
6316: such as the
6317: .Fl fingerprint , signkey ,
6318: and
6319: .Fl CA
6320: options.
6321: If not specified, MD5 is used.
1.80 jmc 6322: SHA1 is always used with DSA keys.
1.1 jsing 6323: .It Fl out Ar file
1.80 jmc 6324: The output file to write to,
6325: or standard output if none is specified.
6326: .It Fl outform Cm der | net | pem
6327: The output format.
1.1 jsing 6328: .It Fl passin Ar arg
6329: The key password source.
6330: .El
1.80 jmc 6331: .Pp
6332: The following are x509 display options:
1.1 jsing 6333: .Bl -tag -width "XXXX"
6334: .It Fl C
1.80 jmc 6335: Output the certificate in the form of a C source file.
1.1 jsing 6336: .It Fl certopt Ar option
6337: Customise the output format used with
1.80 jmc 6338: .Fl text ,
6339: either using a list of comma-separated options or by specifying
1.1 jsing 6340: .Fl certopt
1.80 jmc 6341: multiple times.
6342: The default behaviour is to print all fields.
6343: The options are as follows:
6344: .Pp
6345: .Bl -tag -width "no_extensions" -offset indent -compact
6346: .It Cm ca_default
6347: Equivalent to
6348: .Cm no_issuer , no_pubkey , no_header ,
6349: .Cm no_version , no_sigdump ,
6350: and
6351: .Cm no_signame .
6352: .It Cm compatible
6353: Equivalent to no output options at all.
6354: .It Cm ext_default
6355: Print unsupported certificate extensions.
6356: .It Cm ext_dump
6357: Hex dump unsupported extensions.
6358: .It Cm ext_error
6359: Print an error message for unsupported certificate extensions.
6360: .It Cm ext_parse
1.84 jmc 6361: ASN.1 parse unsupported extensions.
1.80 jmc 6362: .It Cm no_aux
6363: Do not print certificate trust information.
6364: .It Cm no_extensions
6365: Do not print X509V3 extensions.
6366: .It Cm no_header
6367: Do not print header (Certificate and Data) information.
6368: .It Cm no_issuer
6369: Do not print the issuer name.
6370: .It Cm no_pubkey
6371: Do not print the public key.
6372: .It Cm no_serial
6373: Do not print the serial number.
6374: .It Cm no_sigdump
6375: Do not give a hexadecimal dump of the certificate signature.
6376: .It Cm no_signame
6377: Do not print the signature algorithm used.
6378: .It Cm no_subject
6379: Do not print the subject name.
6380: .It Cm no_validity
6381: Do not print the
6382: .Cm notBefore
6383: and
6384: .Cm notAfter
6385: (validity) fields.
6386: .It Cm no_version
6387: Do not print the version number.
6388: .El
1.1 jsing 6389: .It Fl dates
1.80 jmc 6390: Print the start and expiry date of a certificate.
1.1 jsing 6391: .It Fl email
1.80 jmc 6392: Output the email addresses, if any.
1.1 jsing 6393: .It Fl enddate
1.80 jmc 6394: Print the expiry date of the certificate; that is, the
6395: .Cm notAfter
1.1 jsing 6396: date.
6397: .It Fl fingerprint
1.80 jmc 6398: Print the digest of the DER-encoded version of the whole certificate.
1.1 jsing 6399: .It Fl hash
6400: A synonym for
1.80 jmc 6401: .Fl subject_hash .
1.1 jsing 6402: .It Fl issuer
1.80 jmc 6403: Print the issuer name.
1.1 jsing 6404: .It Fl issuer_hash
1.80 jmc 6405: Print the hash of the certificate issuer name.
1.1 jsing 6406: .It Fl issuer_hash_old
1.80 jmc 6407: Print the hash of the certificate issuer name
6408: using the older algorithm as used by
6409: .Nm openssl
1.1 jsing 6410: versions before 1.0.0.
6411: .It Fl modulus
1.80 jmc 6412: Print the value of the modulus of the public key contained in the certificate.
1.1 jsing 6413: .It Fl nameopt Ar option
1.80 jmc 6414: Customise how the subject or issuer names are displayed,
6415: either using a list of comma-separated options or by specifying
1.1 jsing 6416: .Fl nameopt
1.80 jmc 6417: multiple times.
6418: The default behaviour is to use the
6419: .Cm oneline
6420: format.
6421: The options,
6422: which can be preceded by a dash to turn them off,
6423: are as follows:
6424: .Bl -tag -width "XXXX"
6425: .It Cm align
6426: Align field values for a more readable output.
6427: Only usable with
6428: .Ar sep_multiline .
6429: .It Cm compat
6430: Use the old format,
6431: equivalent to specifying no options at all.
6432: .It Cm dn_rev
6433: Reverse the fields of the DN, as required by RFC 2253.
6434: As a side effect, this also reverses the order of multiple AVAs.
6435: .It Cm dump_all
6436: Dump all fields.
6437: When used with
6438: .Ar dump_der ,
6439: it allows the DER encoding of the structure to be unambiguously determined.
6440: .It Cm dump_der
6441: Any fields that need to be hexdumped are
6442: dumped using the DER encoding of the field.
6443: Otherwise just the content octets will be displayed.
6444: Both options use the RFC 2253 #XXXX... format.
6445: .It Cm dump_nostr
6446: Dump non-character string types
6447: (for example OCTET STRING);
6448: usually, non-character string types are displayed
6449: as though each content octet represents a single character.
6450: .It Cm dump_unknown
6451: Dump any field whose OID is not recognised by
6452: .Nm openssl .
6453: .It Cm esc_2253
6454: Escape the
6455: .Qq special
6456: characters required by RFC 2253 in a field that is
6457: .Dq \& ,+"<>; .
6458: Additionally,
6459: .Sq #
6460: is escaped at the beginning of a string
6461: and a space character at the beginning or end of a string.
6462: .It Cm esc_ctrl
6463: Escape control characters.
6464: That is, those with ASCII values less than 0x20 (space)
6465: and the delete (0x7f) character.
6466: They are escaped using the RFC 2253 \eXX notation (where XX are two hex
6467: digits representing the character value).
6468: .It Cm esc_msb
6469: Escape characters with the MSB set; that is, with ASCII values larger than
6470: 127.
6471: .It Cm multiline
6472: A multiline format.
6473: Equivalent to
6474: .Cm esc_ctrl , esc_msb , sep_multiline ,
6475: .Cm space_eq , lname ,
6476: and
6477: .Cm align .
6478: .It Cm no_type
6479: Do not attempt to interpret multibyte characters.
6480: That is, content octets are merely dumped as though one octet
6481: represents each character.
6482: This is useful for diagnostic purposes
6483: but results in rather odd looking output.
6484: .It Cm nofname , sname , lname , oid
6485: Alter how the field name is displayed:
6486: .Cm nofname
6487: does not display the field at all;
6488: .Cm sname
6489: uses the short name form (CN for
6490: .Cm commonName ,
6491: for example);
6492: .Cm lname
6493: uses the long form.
6494: .Cm oid
6495: represents the OID in numerical form and is useful for diagnostic purpose.
6496: .It Cm oneline
6497: A one line format which is more readable than
6498: .Cm RFC2253 .
6499: Equivalent to
6500: .Cm esc_2253 , esc_ctrl , esc_msb , utf8 ,
6501: .Cm dump_nostr , dump_der , use_quote , sep_comma_plus_spc ,
6502: .Cm space_eq ,
6503: and
6504: .Cm sname .
6505: .It Cm RFC2253
6506: Displays names compatible with RFC 2253.
6507: Equivalent to
6508: .Cm esc_2253 , esc_ctrl ,
6509: .Cm esc_msb , utf8 , dump_nostr , dump_unknown ,
6510: .Cm dump_der , sep_comma_plus , dn_rev ,
6511: and
6512: .Cm sname .
6513: .It Cm sep_comma_plus , sep_comma_plus_space , sep_semi_plus_space , sep_multiline
6514: Determine the field separators:
6515: the first character is between RDNs and the second between multiple AVAs
6516: (multiple AVAs are very rare and their use is discouraged).
6517: The options ending in
6518: .Qq space
6519: additionally place a space after the separator to make it more readable.
6520: .Cm sep_multiline
6521: uses a linefeed character for the RDN separator and a spaced
6522: .Sq +
6523: for the AVA separator,
6524: as well as indenting the fields by four characters.
6525: .It Cm show_type
1.84 jmc 6526: Show the type of the ASN.1 character string.
1.80 jmc 6527: The type precedes the field contents.
6528: For example
6529: .Qq BMPSTRING: Hello World .
6530: .It Cm space_eq
6531: Place spaces round the
6532: .Sq =
6533: character which follows the field name.
6534: .It Cm use_quote
6535: Escape some characters by surrounding the whole string with
6536: .Sq \&"
6537: characters.
6538: Without the option, all escaping is done with the
6539: .Sq \e
6540: character.
6541: .It Cm utf8
6542: Convert all strings to UTF8 format first, as required by RFC 2253.
6543: On a UTF8 compatible terminal,
6544: the use of this option (and not setting
6545: .Cm esc_msb )
6546: may result in the correct display of multibyte characters.
6547: Usually, multibyte characters larger than 0xff
6548: are represented using the format \eUXXXX for 16 bits and \eWXXXXXXXX
6549: for 32 bits,
6550: and any UTF8Strings are converted to their character form first.
6551: .El
1.107 inoguchi 6552: .It Fl next_serial
6553: Print the next serial number.
1.1 jsing 6554: .It Fl noout
1.80 jmc 6555: Do not output the encoded version of the request.
1.1 jsing 6556: .It Fl ocsp_uri
1.80 jmc 6557: Print the OCSP responder addresses, if any.
1.1 jsing 6558: .It Fl ocspid
6559: Print OCSP hash values for the subject name and public key.
6560: .It Fl pubkey
1.80 jmc 6561: Print the public key.
1.1 jsing 6562: .It Fl serial
1.80 jmc 6563: Print the certificate serial number.
1.107 inoguchi 6564: .It Fl sigopt Ar nm:v
6565: Pass options to the signature algorithm during sign or certify operations.
6566: The names and values of these options are algorithm-specific.
1.1 jsing 6567: .It Fl startdate
1.80 jmc 6568: Print the start date of the certificate; that is, the
6569: .Cm notBefore
1.1 jsing 6570: date.
6571: .It Fl subject
1.80 jmc 6572: Print the subject name.
1.1 jsing 6573: .It Fl subject_hash
1.80 jmc 6574: Print the hash of the certificate subject name.
1.1 jsing 6575: This is used in
1.80 jmc 6576: .Nm openssl
1.1 jsing 6577: to form an index to allow certificates in a directory to be looked up
6578: by subject name.
6579: .It Fl subject_hash_old
1.80 jmc 6580: Print the hash of the certificate subject name
6581: using the older algorithm as used by
6582: .Nm openssl
1.1 jsing 6583: versions before 1.0.0.
6584: .It Fl text
1.80 jmc 6585: Print the full certificate in text form.
1.1 jsing 6586: .El
6587: .Pp
1.80 jmc 6588: A trusted certificate is a certificate which has several
1.1 jsing 6589: additional pieces of information attached to it such as the permitted
1.80 jmc 6590: and prohibited uses of the certificate and an alias.
1.127 jmc 6591: When a certificate is being verified, at least one certificate must be trusted.
1.80 jmc 6592: By default, a trusted certificate must be stored locally and be a root CA.
6593: The following are x509 trust settings options:
1.1 jsing 6594: .Bl -tag -width "XXXX"
6595: .It Fl addreject Ar arg
1.80 jmc 6596: Add a prohibited use.
6597: Accepts the same values as the
1.1 jsing 6598: .Fl addtrust
6599: option.
6600: .It Fl addtrust Ar arg
1.80 jmc 6601: Add a trusted certificate use.
1.1 jsing 6602: Any object name can be used here, but currently only
1.80 jmc 6603: .Cm clientAuth
6604: (SSL client use),
6605: .Cm serverAuth
6606: (SSL server use),
6607: and
6608: .Cm emailProtection
6609: (S/MIME email) are used.
1.1 jsing 6610: .It Fl alias
1.80 jmc 6611: Output the certificate alias.
1.1 jsing 6612: .It Fl clrreject
1.80 jmc 6613: Clear all the prohibited or rejected uses of the certificate.
1.1 jsing 6614: .It Fl clrtrust
1.80 jmc 6615: Clear all the permitted or trusted uses of the certificate.
1.1 jsing 6616: .It Fl purpose
1.80 jmc 6617: Perform tests on the certificate extensions.
6618: The same code is used when verifying untrusted certificates in chains,
6619: so this section is useful if a chain is rejected by the verify code.
6620: .Pp
6621: The
6622: .Cm basicConstraints
6623: extension CA flag is used to determine whether the
6624: certificate can be used as a CA.
6625: If the CA flag is true, it is a CA;
6626: if the CA flag is false, it is not a CA.
6627: All CAs should have the CA flag set to true.
6628: .Pp
6629: If the
6630: .Cm basicConstraints
6631: extension is absent, then the certificate is
6632: considered to be a possible CA;
6633: other extensions are checked according to the intended use of the certificate.
6634: A warning is given in this case because the certificate should really not
6635: be regarded as a CA.
6636: However it is allowed to be a CA to work around some broken software.
6637: .Pp
6638: If the certificate is a V1 certificate
6639: (and thus has no extensions) and it is self-signed,
6640: it is also assumed to be a CA but a warning is again given.
6641: This is to work around the problem of Verisign roots
6642: which are V1 self-signed certificates.
6643: .Pp
6644: If the
6645: .Cm keyUsage
6646: extension is present, then additional restraints are
6647: made on the uses of the certificate.
6648: A CA certificate must have the
6649: .Cm keyCertSign
6650: bit set if the
6651: .Cm keyUsage
6652: extension is present.
6653: .Pp
6654: The extended key usage extension places additional restrictions on the
6655: certificate uses.
6656: If this extension is present, whether critical or not,
6657: the key can only be used for the purposes specified.
6658: .Pp
6659: A complete description of each test is given below.
6660: The comments about
6661: .Cm basicConstraints
6662: and
6663: .Cm keyUsage
6664: and V1 certificates above apply to all CA certificates.
6665: .Bl -tag -width "XXXX"
6666: .It SSL Client
6667: The extended key usage extension must be absent or include the
6668: web client authentication OID.
6669: .Cm keyUsage
6670: must be absent or it must have the
6671: .Cm digitalSignature
6672: bit set.
6673: The Netscape certificate type must be absent
6674: or it must have the SSL client bit set.
6675: .It SSL Client CA
6676: The extended key usage extension must be absent or include the
6677: web client authentication OID.
6678: The Netscape certificate type must be absent
6679: or it must have the SSL CA bit set:
6680: this is used as a workaround if the
6681: .Cm basicConstraints
6682: extension is absent.
6683: .It SSL Server
6684: The extended key usage extension must be absent or include the
6685: web server authentication and/or one of the SGC OIDs.
6686: .Cm keyUsage
6687: must be absent or it must have the
6688: .Cm digitalSignature
6689: set, the
6690: .Cm keyEncipherment
6691: set, or both bits set.
6692: The Netscape certificate type must be absent or have the SSL server bit set.
6693: .It SSL Server CA
6694: The extended key usage extension must be absent or include the
6695: web server authentication and/or one of the SGC OIDs.
6696: The Netscape certificate type must be absent or the SSL CA bit must be set:
6697: this is used as a workaround if the
6698: .Cm basicConstraints
6699: extension is absent.
6700: .It Netscape SSL Server
6701: For Netscape SSL clients to connect to an SSL server; it must have the
6702: .Cm keyEncipherment
6703: bit set if the
6704: .Cm keyUsage
6705: extension is present.
6706: This isn't always valid because some cipher suites use the key for
6707: digital signing.
6708: Otherwise it is the same as a normal SSL server.
6709: .It Common S/MIME Client Tests
6710: The extended key usage extension must be absent or include the
6711: email protection OID.
6712: The Netscape certificate type must be absent or should have the S/MIME bit set.
6713: If the S/MIME bit is not set in Netscape certificate type, then the SSL
6714: client bit is tolerated as an alternative but a warning is shown:
6715: this is because some Verisign certificates don't set the S/MIME bit.
6716: .It S/MIME Signing
6717: In addition to the common S/MIME client tests, the
6718: .Cm digitalSignature
6719: bit must be set if the
6720: .Cm keyUsage
6721: extension is present.
6722: .It S/MIME Encryption
6723: In addition to the common S/MIME tests, the
6724: .Cm keyEncipherment
6725: bit must be set if the
6726: .Cm keyUsage
6727: extension is present.
6728: .It S/MIME CA
6729: The extended key usage extension must be absent or include the
6730: email protection OID.
6731: The Netscape certificate type must be absent
6732: or must have the S/MIME CA bit set:
6733: this is used as a workaround if the
6734: .Cm basicConstraints
6735: extension is absent.
6736: .It CRL Signing
6737: The
6738: .Cm keyUsage
6739: extension must be absent or it must have the CRL signing bit set.
6740: .It CRL Signing CA
6741: The normal CA tests apply, except the
6742: .Cm basicConstraints
6743: extension must be present.
6744: .El
1.1 jsing 6745: .It Fl setalias Ar arg
1.80 jmc 6746: Set the alias of the certificate,
6747: allowing the certificate to be referred to using a nickname,
6748: such as
1.1 jsing 6749: .Qq Steve's Certificate .
6750: .It Fl trustout
1.80 jmc 6751: Output a trusted certificate
6752: (the default if any trust settings are modified).
1.1 jsing 6753: An ordinary or trusted certificate can be input, but by default an ordinary
6754: certificate is output and any trust settings are discarded.
6755: .El
1.80 jmc 6756: .Pp
1.1 jsing 6757: The
6758: .Nm x509
1.80 jmc 6759: utility can be used to sign certificates and requests:
6760: it can thus behave like a mini CA.
6761: The following are x509 signing options:
1.1 jsing 6762: .Bl -tag -width "XXXX"
6763: .It Fl CA Ar file
1.80 jmc 6764: The CA certificate to be used for signing.
1.1 jsing 6765: When this option is present,
6766: .Nm x509
1.80 jmc 6767: behaves like a mini CA.
1.1 jsing 6768: The input file is signed by the CA using this option;
6769: that is, its issuer name is set to the subject name of the CA and it is
6770: digitally signed using the CA's private key.
6771: .Pp
6772: This option is normally combined with the
6773: .Fl req
6774: option.
6775: Without the
6776: .Fl req
6777: option, the input is a certificate which must be self-signed.
6778: .It Fl CAcreateserial
1.80 jmc 6779: Create the CA serial number file if it does not exist
6780: instead of generating an error.
6781: The file will contain the serial number
1.1 jsing 6782: .Sq 02
6783: and the certificate being signed will have
6784: .Sq 1
6785: as its serial number.
1.80 jmc 6786: .It Fl CAform Cm der | pem
1.1 jsing 6787: The format of the CA certificate file.
6788: The default is
1.80 jmc 6789: .Cm pem .
1.1 jsing 6790: .It Fl CAkey Ar file
1.80 jmc 6791: Set the CA private key to sign a certificate with.
6792: Otherwise it is assumed that the CA private key is present
6793: in the CA certificate file.
6794: .It Fl CAkeyform Cm der | pem
1.1 jsing 6795: The format of the CA private key.
6796: The default is
1.80 jmc 6797: .Cm pem .
1.1 jsing 6798: .It Fl CAserial Ar file
1.80 jmc 6799: Use the serial number in
6800: .Ar file
6801: to sign a certificate.
6802: The file should consist of one line containing an even number of hex digits
1.1 jsing 6803: with the serial number to use.
6804: After each use the serial number is incremented and written out
6805: to the file again.
6806: .Pp
6807: The default filename consists of the CA certificate file base name with
6808: .Pa .srl
6809: appended.
6810: For example, if the CA certificate file is called
6811: .Pa mycacert.pem ,
6812: it expects to find a serial number file called
6813: .Pa mycacert.srl .
6814: .It Fl checkend Ar arg
6815: Check whether the certificate expires in the next
6816: .Ar arg
6817: seconds.
6818: If so, exit with return value 1;
6819: otherwise exit with return value 0.
6820: .It Fl clrext
6821: Delete any extensions from a certificate.
6822: This option is used when a certificate is being created from another
6823: certificate (for example with the
6824: .Fl signkey
6825: or the
6826: .Fl CA
6827: options).
6828: Normally, all extensions are retained.
6829: .It Fl days Ar arg
1.80 jmc 6830: The number of days to make a certificate valid for.
1.1 jsing 6831: The default is 30 days.
6832: .It Fl extensions Ar section
6833: The section to add certificate extensions from.
6834: If this option is not specified, the extensions should either be
1.80 jmc 6835: contained in the unnamed (default) section
6836: or the default section should contain a variable called
1.1 jsing 6837: .Qq extensions
6838: which contains the section to use.
6839: .It Fl extfile Ar file
6840: File containing certificate extensions to use.
6841: If not specified, no extensions are added to the certificate.
1.80 jmc 6842: .It Fl keyform Cm der | pem
6843: The format of the private key file used in the
1.1 jsing 6844: .Fl signkey
6845: option.
6846: .It Fl req
1.80 jmc 6847: Expect a certificate request on input instead of a certificate.
1.1 jsing 6848: .It Fl set_serial Ar n
1.80 jmc 6849: The serial number to use.
1.1 jsing 6850: This option can be used with either the
6851: .Fl signkey
6852: or
6853: .Fl CA
6854: options.
6855: If used in conjunction with the
6856: .Fl CA
6857: option, the serial number file (as specified by the
6858: .Fl CAserial
6859: or
6860: .Fl CAcreateserial
6861: options) is not used.
6862: .Pp
6863: The serial number can be decimal or hex (if preceded by
6864: .Sq 0x ) .
6865: Negative serial numbers can also be specified but their use is not recommended.
6866: .It Fl signkey Ar file
1.80 jmc 6867: Self-sign
6868: .Ar file
6869: using the supplied private key.
1.1 jsing 6870: .Pp
6871: If the input file is a certificate, it sets the issuer name to the
1.80 jmc 6872: subject name (i.e. makes it self-signed),
1.1 jsing 6873: changes the public key to the supplied value,
6874: and changes the start and end dates.
6875: The start date is set to the current time and the end date is set to
6876: a value determined by the
6877: .Fl days
6878: option.
6879: Any certificate extensions are retained unless the
6880: .Fl clrext
6881: option is supplied.
6882: .Pp
6883: If the input is a certificate request, a self-signed certificate
6884: is created using the supplied private key using the subject name in
6885: the request.
6886: .It Fl x509toreq
1.80 jmc 6887: Convert a certificate into a certificate request.
1.1 jsing 6888: The
6889: .Fl signkey
6890: option is used to pass the required private key.
6891: .El
1.38 jmc 6892: .Sh COMMON NOTATION
6893: Several commands share a common syntax,
6894: as detailed below.
6895: .Pp
6896: Password arguments, typically specified using
1.33 jmc 6897: .Fl passin
6898: and
6899: .Fl passout
1.38 jmc 6900: for input and output passwords,
6901: allow passwords to be obtained from a variety of sources.
6902: Both of these options take a single argument, described below.
1.33 jmc 6903: If no password argument is given and a password is required,
6904: then the user is prompted to enter one:
6905: this will typically be read from the current terminal with echoing turned off.
1.38 jmc 6906: .Bl -tag -width "pass:password" -offset indent
6907: .It Cm pass : Ns Ar password
1.33 jmc 6908: The actual password is
6909: .Ar password .
1.38 jmc 6910: Since the password is visible to utilities,
1.33 jmc 6911: this form should only be used where security is not important.
1.38 jmc 6912: .It Cm env : Ns Ar var
1.33 jmc 6913: Obtain the password from the environment variable
6914: .Ar var .
1.38 jmc 6915: Since the environment of other processes is visible,
6916: this option should be used with caution.
6917: .It Cm file : Ns Ar path
1.33 jmc 6918: The first line of
6919: .Ar path
6920: is the password.
6921: If the same
6922: .Ar path
6923: argument is supplied to
6924: .Fl passin
6925: and
6926: .Fl passout ,
6927: then the first line will be used for the input password and the next line
6928: for the output password.
6929: .Ar path
6930: need not refer to a regular file:
6931: it could, for example, refer to a device or named pipe.
1.38 jmc 6932: .It Cm fd : Ns Ar number
1.33 jmc 6933: Read the password from the file descriptor
6934: .Ar number .
1.38 jmc 6935: This can be used to send the data via a pipe, for example.
6936: .It Cm stdin
1.33 jmc 6937: Read the password from standard input.
1.35 jmc 6938: .El
1.38 jmc 6939: .Pp
1.64 jmc 6940: Input/output formats,
1.38 jmc 6941: typically specified using
6942: .Fl inform
6943: and
6944: .Fl outform ,
1.64 jmc 6945: indicate the format being read from or written to.
1.38 jmc 6946: The argument is case insensitive.
6947: .Pp
6948: .Bl -tag -width Ds -offset indent -compact
6949: .It Cm der
6950: Distinguished Encoding Rules (DER)
6951: is a binary format.
1.64 jmc 6952: .It Cm net
6953: Insecure legacy format.
1.38 jmc 6954: .It Cm pem
6955: Privacy Enhanced Mail (PEM)
6956: is base64-encoded.
1.108 inoguchi 6957: .It Cm pvk
6958: Private Key format.
1.70 jmc 6959: .It Cm smime
6960: An SMIME format message.
1.38 jmc 6961: .It Cm txt
6962: Plain ASCII text.
6963: .El
1.35 jmc 6964: .Sh ENVIRONMENT
6965: The following environment variables affect the execution of
6966: .Nm openssl :
1.38 jmc 6967: .Bl -tag -width "/etc/ssl/openssl.cnf"
1.35 jmc 6968: .It Ev OPENSSL_CONF
6969: The location of the master configuration file.
1.33 jmc 6970: .El
1.1 jsing 6971: .Sh FILES
6972: .Bl -tag -width "/etc/ssl/openssl.cnf" -compact
1.17 sobrado 6973: .It Pa /etc/ssl/
1.1 jsing 6974: Default config directory for
6975: .Nm openssl .
1.17 sobrado 6976: .It Pa /etc/ssl/lib/
1.1 jsing 6977: Unused.
1.17 sobrado 6978: .It Pa /etc/ssl/private/
1.1 jsing 6979: Default private key directory.
1.17 sobrado 6980: .It Pa /etc/ssl/openssl.cnf
1.1 jsing 6981: Default configuration file for
6982: .Nm openssl .
1.17 sobrado 6983: .It Pa /etc/ssl/x509v3.cnf
1.1 jsing 6984: Default configuration file for
6985: .Nm x509
6986: certificates.
6987: .El
6988: .Sh SEE ALSO
1.74 jmc 6989: .Xr acme-client 1 ,
1.26 jmc 6990: .Xr nc 1 ,
1.90 schwarze 6991: .Xr openssl.cnf 5 ,
6992: .Xr x509v3.cnf 5 ,
1.1 jsing 6993: .Xr ssl 8 ,
6994: .Xr starttls 8
6995: .Sh STANDARDS
6996: .Rs
6997: .%A T. Dierks
6998: .%A C. Allen
6999: .%D January 1999
7000: .%R RFC 2246
7001: .%T The TLS Protocol Version 1.0
7002: .Re
7003: .Pp
7004: .Rs
7005: .%A M. Wahl
7006: .%A S. Killie
7007: .%A T. Howes
7008: .%D December 1997
7009: .%R RFC 2253
7010: .%T Lightweight Directory Access Protocol (v3): UTF-8 String Representation of Distinguished Names
7011: .Re
7012: .Pp
7013: .Rs
7014: .%A B. Kaliski
7015: .%D March 1998
7016: .%R RFC 2315
7017: .%T PKCS #7: Cryptographic Message Syntax Version 1.5
7018: .Re
7019: .Pp
7020: .Rs
7021: .%A R. Housley
7022: .%A W. Ford
7023: .%A W. Polk
7024: .%A D. Solo
7025: .%D January 1999
7026: .%R RFC 2459
7027: .%T Internet X.509 Public Key Infrastructure Certificate and CRL Profile
7028: .Re
7029: .Pp
7030: .Rs
7031: .%A M. Myers
7032: .%A R. Ankney
7033: .%A A. Malpani
7034: .%A S. Galperin
7035: .%A C. Adams
7036: .%D June 1999
7037: .%R RFC 2560
7038: .%T X.509 Internet Public Key Infrastructure Online Certificate Status Protocol \(en OCSP
7039: .Re
7040: .Pp
7041: .Rs
7042: .%A R. Housley
7043: .%D June 1999
7044: .%R RFC 2630
7045: .%T Cryptographic Message Syntax
7046: .Re
7047: .Pp
7048: .Rs
7049: .%A P. Chown
7050: .%D June 2002
7051: .%R RFC 3268
1.24 jmc 7052: .%T Advanced Encryption Standard (AES) Ciphersuites for Transport Layer Security (TLS)
1.1 jsing 7053: .Re