[BACK]Return to openssl.1 CVS log [TXT][DIR] Up to [local] / src / usr.bin / openssl

Annotation of src/usr.bin/openssl/openssl.1, Revision 1.117

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