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

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