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