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

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