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

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