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