[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.107

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