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