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

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