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