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