Update copyright year
[openssl.git] / doc / man1 / openssl-x509.pod.in
index ae9957117a3016081553ec6f4993af7c40d92804..77c5e64ee0da2d38588d87aaebd4093ea7289e4c 100644 (file)
@@ -3,79 +3,89 @@
 
 =head1 NAME
 
-openssl-x509 - Certificate display and signing utility
+openssl-x509 - Certificate display and signing command
 
 =head1 SYNOPSIS
 
 B<openssl> B<x509>
 [B<-help>]
+[B<-in> I<filename>|I<uri>]
+[B<-passin> I<arg>]
+[B<-new>]
+[B<-x509toreq>]
+[B<-req>]
+[B<-copy_extensions> I<arg>]
 [B<-inform> B<DER>|B<PEM>]
-[B<-outform> B<DER>|B<PEM>]
-[B<-keyform> B<DER>|B<PEM>|B<ENGINE>]
-[B<-CAform> B<DER>|B<PEM>]
-[B<-CAkeyform> B<DER>|B<PEM>|B<ENGINE>]
-[B<-in> I<filename>]
+[B<-vfyopt> I<nm>:I<v>]
+[B<-signkey> I<filename>|I<uri>]
+[B<-keyform> B<DER>|B<PEM>|B<P12>|B<ENGINE>]
 [B<-out> I<filename>]
+[B<-outform> B<DER>|B<PEM>]
+[B<-nocert>]
+[B<-noout>]
+[B<-text>]
+[B<-certopt> I<option>]
+[B<-fingerprint>]
+[B<-alias>]
 [B<-serial>]
+[B<-startdate>]
+[B<-enddate>]
+[B<-dates>]
+[B<-subject>]
+[B<-issuer>]
+{- $OpenSSL::safe::opt_name_synopsis -}
+[B<-email>]
 [B<-hash>]
 [B<-subject_hash>]
+[B<-subject_hash_old>]
 [B<-issuer_hash>]
+[B<-issuer_hash_old>]
+[B<-ext> I<extensions>]
 [B<-ocspid>]
-[B<-subject>]
-[B<-issuer>]
-[B<-nameopt> I<option>]
-[B<-email>]
 [B<-ocsp_uri>]
-[B<-startdate>]
-[B<-enddate>]
 [B<-purpose>]
-[B<-dates>]
-[B<-checkend> I<num>]
-[B<-modulus>]
 [B<-pubkey>]
-[B<-fingerprint>]
-[B<-alias>]
-[B<-noout>]
-[B<-trustout>]
-[B<-clrtrust>]
-[B<-clrreject>]
-[B<-addtrust> I<arg>]
-[B<-addreject> I<arg>]
-[B<-setalias> I<arg>]
-[B<-days> I<arg>]
+[B<-modulus>]
+[B<-checkend> I<num>]
+[B<-checkhost> I<host>]
+[B<-checkemail> I<host>]
+[B<-checkip> I<ipaddr>]
 [B<-set_serial> I<n>]
-[B<-signkey> I<filename>]
-[B<-passin> I<arg>]
-[B<-x509toreq>]
-[B<-req>]
-[B<-CA> I<filename>]
-[B<-CAkey> I<filename>]
-[B<-CAcreateserial>]
-[B<-CAserial> I<filename>]
-[B<-new>]
-[B<-force_pubkey> I<filename>]
+[B<-next_serial>]
+[B<-days> I<arg>]
+[B<-preserve_dates>]
 [B<-subj> I<arg>]
-[B<-text>]
-[B<-ext> I<extensions>]
-[B<-certopt> I<option>]
-[B<-C>]
-[B<-I<digest>>]
+[B<-force_pubkey> I<filename>]
 [B<-clrext>]
 [B<-extfile> I<filename>]
 [B<-extensions> I<section>]
 [B<-sigopt> I<nm>:I<v>]
-[B<-engine> I<id>]
-[B<-preserve_dates>]
+[B<-badsig>]
+[B<-I<digest>>]
+[B<-CA> I<filename>|I<uri>]
+[B<-CAform> B<DER>|B<PEM>|B<P12>]
+[B<-CAkey> I<filename>|I<uri>]
+[B<-CAkeyform> B<DER>|B<PEM>|B<P12>|B<ENGINE>]
+[B<-CAserial> I<filename>]
+[B<-CAcreateserial>]
+[B<-trustout>]
+[B<-setalias> I<arg>]
+[B<-clrtrust>]
+[B<-addtrust> I<arg>]
+[B<-clrreject>]
+[B<-addreject> I<arg>]
 {- $OpenSSL::safe::opt_r_synopsis -}
+{- $OpenSSL::safe::opt_engine_synopsis -}{- $OpenSSL::safe::opt_provider_synopsis -}
 
 =for openssl ifdef engine subject_hash_old issuer_hash_old
 
 =head1 DESCRIPTION
 
-This command is a multi purpose certificate utility. It can
-be used to display certificate information, convert certificates to
-various forms, sign certificate requests like a "mini CA" or edit
-certificate trust settings.
+This command is a multi-purposes certificate handling command.
+It can be used to print certificate information,
+convert certificates to various forms, edit certificate trust settings,
+generate certificates from scratch or from certificating requests
+and then self-signing them or signing them like a "micro CA".
 
 Since there are a large number of options they will split up into
 various sections.
@@ -90,143 +100,140 @@ various sections.
 
 Print out a usage message.
 
-=item B<-inform> B<DER>|B<PEM>, B<-outform> B<DER>|B<PEM>
-
-The input and formats; the default is B<PEM>.
-See L<openssl(1)/Format Options> for details.
-
-The input is normally an X.509 certificate, but this can change if other
-options such as B<-req> are used.
-
-=item B<-in> I<filename>
+=item B<-in> I<filename>|I<uri>
 
-This specifies the input filename to read a certificate from or standard input
-if this option is not specified.
+If the B<-req> option is not used this specifies the input
+to read a certificate from or standard input if this option is not specified.
+With the B<-req> option this specifies a certificate request file.
 
-=item B<-out> I<filename>
-
-This specifies the output filename to write to or standard output by
-default.
-
-=item B<-I<digest>>
-
-The digest to use.
-This affects any signing or display option that uses a message
-digest, such as the B<-fingerprint>, B<-signkey> and B<-CA> options.
-Any digest supported by the L<openssl-dgst(1)> command can be used.
-If not specified then SHA1 is used with B<-fingerprint> or
-the default digest for the signing algorithm is used, typically SHA256.
-
-=item B<-engine> I<id>
-
-Specifying an engine (by its unique I<id> string) will cause this command
-to attempt to obtain a functional reference to the specified engine,
-thus initialising it if needed. The engine will then be set as the default
-for all available algorithms.
+=item B<-passin> I<arg>
 
-=item B<-preserve_dates>
+The key and certificate file password source.
+For more information about the format of I<arg>
+see L<openssl-passphrase-options(1)>.
 
-When signing a certificate, preserve the "notBefore" and "notAfter" dates
-instead of adjusting them to current time and duration.
-Cannot be used with the B<-days> option.
+=item B<-new>
 
-{- $OpenSSL::safe::opt_r_synopsis -}
+Generate a certificate from scratch, not using an input certificate
+or certificate request. So the B<-in> option must not be used in this case.
+Instead, the B<-subj> option needs to be given.
+The public key to include can be given with the B<-force_pubkey> option
+and defaults to the key given with the B<-signkey> option,
+which implies self-signature.
 
-=back
+=item B<-x509toreq>
 
-=head2 Display Options
+Output a PKCS#10 certificate request (rather than a certificate).
+The B<-signkey> option must be used to provide the private key for self-signing;
+the corresponding public key is placed in the subjectPKInfo field.
 
-Note: the B<-alias> and B<-purpose> options are also display options
-but are described in the L</Trust Settings> section.
+X.509 extensions included in a certificate input are not copied by default.
+X.509 extensions to be added can be specified using the B<-extfile> option.
 
-=over 4
+=item B<-req>
 
-=item B<-text>
+By default a certificate is expected on input.
+With this option a PKCS#10 certificate request is expected instead,
+which must be correctly self-signed.
 
-Prints out the certificate in text form. Full details are output including the
-public key, signature algorithms, issuer and subject names, serial number
-any extensions present and any trust settings.
+X.509 extensions included in the request are not copied by default.
+X.509 extensions to be added can be specified using the B<-extfile> option.
 
-=item B<-ext> I<extensions>
+=item B<-copy_extensions> I<arg>
 
-Prints out the certificate extensions in text form. Extensions are specified
-with a comma separated string, e.g., "subjectAltName,subjectKeyIdentifier".
-See the L<x509v3_config(5)> manual page for the extension names.
+Determines how to handle X.509 extensions
+when converting from a certificate to a request using the B<-x509toreq> option
+or converting from a request to a certificate using the B<-req> option.
+If I<arg> is B<none> or this option is not present then extensions are ignored.
+If I<arg> is B<copy> or B<copyall> then all extensions are copied,
+except that subject identifier and authority key identifier extensions
+are not taken over when producing a certificate request.
 
-=item B<-certopt> I<option>
+The B<-ext> option can be used to further restrict which extensions to copy.
 
-Customise the output format used with B<-text>. The I<option> argument
-can be a single option or multiple options separated by commas. The
-B<-certopt> switch may be also be used more than once to set multiple
-options. See the L</Text Options> section for more information.
+=item B<-inform> B<DER>|B<PEM>
 
-=item B<-noout>
+The CSR input file format; the default is B<PEM>.
+See L<openssl-format-options(1)> for details.
 
-This option prevents output of the encoded version of the certificate.
+=item B<-vfyopt> I<nm>:I<v>
 
-=item B<-pubkey>
+Pass options to the signature algorithm during verify operations.
+Names and values of these options are algorithm-specific.
 
-Outputs the certificate's SubjectPublicKeyInfo block in PEM format.
+=item B<-signkey> I<filename>|I<uri>
 
-=item B<-modulus>
+This option causes the new certificate or certificate request
+to be self-signed using the supplied private key.
+This cannot be used in conjunction with the B<-CA> option.
 
-This option prints out the value of the modulus of the public key
-contained in the certificate.
+It sets the issuer name to the subject name (i.e., makes it self-issued)
+and changes the public key to the supplied value (unless overridden
+by B<-force_pubkey>).
+Unless the B<-preserve_dates> option is supplied,
+it sets the validity start date to the current time
+and the end date to a value determined by the B<-days> option.
 
-=item B<-serial>
+=item B<-keyform> B<DER>|B<PEM>|B<P12>|B<ENGINE>
 
-Outputs the certificate serial number.
+The key input format; the default is B<PEM>.
+The only value with effect is B<ENGINE>; all others have become obsolete.
+See L<openssl-format-options(1)> for details.
 
-=item B<-subject_hash>
+=item B<-out> I<filename>
 
-Outputs the "hash" of the certificate subject name. This is used in OpenSSL to
-form an index to allow certificates in a directory to be looked up by subject
-name.
+This specifies the output filename to write to or standard output by default.
 
-=item B<-issuer_hash>
+=item B<-outform> B<DER>|B<PEM>
 
-Outputs the "hash" of the certificate issuer name.
+The output format; the default is B<PEM>.
+See L<openssl-format-options(1)> for details.
 
-=item B<-ocspid>
+=item B<-nocert>
 
-Outputs the OCSP hash values for the subject name and public key.
+Do not output a certificate (except for printing as requested by below options).
 
-=item B<-hash>
+=item B<-noout>
 
-Synonym for "-subject_hash" for backward compatibility reasons.
+This option prevents output except for printing as requested by below options.
 
-=item B<-subject_hash_old>
+=back
 
-Outputs the "hash" of the certificate subject name using the older algorithm
-as used by OpenSSL before version 1.0.0.
+=head2 Certificate Printing Options
 
-=item B<-issuer_hash_old>
+Note: the B<-alias> and B<-purpose> options are also printing options
+but are described in the L</Trust Settings> section.
 
-Outputs the "hash" of the certificate issuer name using the older algorithm
-as used by OpenSSL before version 1.0.0.
+=over 4
 
-=item B<-subject>
+=item B<-text>
 
-Outputs the subject name.
+Prints out the certificate in text form. Full details are printed including the
+public key, signature algorithms, issuer and subject names, serial number
+any extensions present and any trust settings.
 
-=item B<-issuer>
+=item B<-certopt> I<option>
 
-Outputs the issuer name.
+Customise the print format used with B<-text>. The I<option> argument
+can be a single option or multiple options separated by commas.
+The B<-certopt> switch may be also be used more than once to set multiple
+options. See the L</Text Printing Flags> section for more information.
 
-=item B<-nameopt> I<option>
+=item B<-fingerprint>
 
-Option which determines how the subject or issuer names are displayed. The
-I<option> argument can be a single option or multiple options separated by
-commas.  Alternatively the B<-nameopt> switch may be used more than once to
-set multiple options. See the L</Name Options> section for more information.
+Calculates and prints the digest of the DER encoded version of the entire
+certificate (see digest options).
+This is commonly called a "fingerprint". Because of the nature of message
+digests, the fingerprint of a certificate is unique to that certificate and
+two certificates with the same fingerprint can be considered to be the same.
 
-=item B<-email>
+=item B<-alias>
 
-Outputs the email address(es) if any.
+Prints the certificate "alias" (nickname), if any.
 
-=item B<-ocsp_uri>
+=item B<-serial>
 
-Outputs the OCSP responder address(es) if any.
+Prints the certificate serial number.
 
 =item B<-startdate>
 
@@ -240,409 +247,345 @@ Prints out the expiry date of the certificate, that is the notAfter date.
 
 Prints out the start and expiry dates of a certificate.
 
-=item B<-checkend> I<arg>
-
-Checks if the certificate expires within the next I<arg> seconds and exits
-nonzero if yes it will expire or zero if not.
-
-=item B<-fingerprint>
-
-Calculates and outputs the digest of the DER encoded version of the entire
-certificate (see digest options).
-This is commonly called a "fingerprint". Because of the nature of message
-digests, the fingerprint of a certificate is unique to that certificate and
-two certificates with the same fingerprint can be considered to be the same.
-
-=item B<-C>
-
-This outputs the certificate in the form of a C source file.
-
-=back
+=item B<-subject>
 
-=head2 Trust Settings
+Prints the subject name.
 
-A B<trusted certificate> is an ordinary certificate which has several
-additional pieces of information attached to it such as the permitted
-and prohibited uses of the certificate and an "alias".
+=item B<-issuer>
 
-Normally when a certificate is being verified at least one certificate
-must be "trusted". By default a trusted certificate must be stored
-locally and must be a root CA: any certificate chain ending in this CA
-is then usable for any purpose.
+Prints the issuer name.
 
-Trust settings currently are only used with a root CA. They allow a finer
-control over the purposes the root CA can be used for. For example a CA
-may be trusted for SSL client but not SSL server use.
+{- $OpenSSL::safe::opt_name_item -}
 
-See the description in L<openssl-verify(1)> for more information
-on the meaning of trust settings.
+=item B<-email>
 
-Future versions of OpenSSL will recognize trust settings on any
-certificate: not just root CAs.
+Prints the email address(es) if any.
 
+=item B<-hash>
 
-=over 4
+Synonym for "-subject_hash" for backward compatibility reasons.
 
-=item B<-trustout>
+=item B<-subject_hash>
 
-Output a B<trusted> certificate rather than an ordinary. An ordinary
-or trusted certificate can be input but by default an ordinary
-certificate is output and any trust settings are discarded. With the
-B<-trustout> option a trusted certificate is output. A trusted
-certificate is automatically output if any trust settings are modified.
+Prints the "hash" of the certificate subject name. This is used in OpenSSL to
+form an index to allow certificates in a directory to be looked up by subject
+name.
 
-=item B<-setalias> I<arg>
+=item B<-subject_hash_old>
 
-Sets the alias of the certificate. This will allow the certificate
-to be referred to using a nickname for example "Steve's Certificate".
+Prints the "hash" of the certificate subject name using the older algorithm
+as used by OpenSSL before version 1.0.0.
 
-=item B<-alias>
+=item B<-issuer_hash>
 
-Outputs the certificate alias, if any.
+Prints the "hash" of the certificate issuer name.
 
-=item B<-clrtrust>
+=item B<-issuer_hash_old>
 
-Clears all the permitted or trusted uses of the certificate.
+Prints the "hash" of the certificate issuer name using the older algorithm
+as used by OpenSSL before version 1.0.0.
 
-=item B<-clrreject>
+=item B<-ext> I<extensions>
 
-Clears all the prohibited or rejected uses of the certificate.
+Prints out the certificate extensions in text form.
+Can also be used to restrict which extensions to copy.
+Extensions are specified
+with a comma separated string, e.g., "subjectAltName,subjectKeyIdentifier".
+See the L<x509v3_config(5)> manual page for the extension names.
 
-=item B<-addtrust> I<arg>
+=item B<-ocspid>
 
-Adds a trusted certificate use.
-Any object name can be used here but currently only B<clientAuth> (SSL client
-use), B<serverAuth> (SSL server use), B<emailProtection> (S/MIME email) and
-B<anyExtendedKeyUsage> are used.
-As of OpenSSL 1.1.0, the last of these blocks all purposes when rejected or
-enables all purposes when trusted.
-Other OpenSSL applications may define additional uses.
+Prints the OCSP hash values for the subject name and public key.
 
-=item B<-addreject> I<arg>
+=item B<-ocsp_uri>
 
-Adds a prohibited use. It accepts the same values as the B<-addtrust>
-option.
+Prints the OCSP responder address(es) if any.
 
 =item B<-purpose>
 
-This option performs tests on the certificate extensions and outputs
+This option performs tests on the certificate extensions and prints
 the results. For a more complete description see the
 L</CERTIFICATE EXTENSIONS> section.
 
-=back
+=item B<-pubkey>
 
-=head2 Signing Options
+Prints the certificate's SubjectPublicKeyInfo block in PEM format.
 
-This command can be used to sign certificates and requests: it
-can thus behave like a "mini CA".
+=item B<-modulus>
 
-=over 4
+This option prints out the value of the modulus of the public key
+contained in the certificate.
 
-=item B<-signkey> I<filename>
+=back
 
-This option causes the input file to be self signed using the supplied
-private key.
+=head2 Certificate Checking Options
 
-It sets the issuer name to the subject name (i.e., makes it self-issued)
-and changes the public key to the supplied value (unless overridden by
-B<-force_pubkey>). It sets the validity start date to the current time
-and the end date to a value determined by the B<-days> option.
-It retains any certificate extensions unless the B<-clrext> option is supplied;
-this includes, for example, any existing key identifier extensions.
+=over 4
 
-=item B<-sigopt> I<nm>:I<v>
+=item B<-checkend> I<arg>
 
-Pass options to the signature algorithm during sign or verify operations.
-Names and values of these options are algorithm-specific.
+Checks if the certificate expires within the next I<arg> seconds and exits
+nonzero if yes it will expire or zero if not.
 
-=item B<-passin> I<arg>
+=item B<-checkhost> I<host>
 
-The key password source. For more information about the format of I<arg>
-see L<openssl(1)/Pass Phrase Options>.
+Check that the certificate matches the specified host.
 
-=item B<-clrext>
+=item B<-checkemail> I<email>
 
-Delete any extensions from a certificate. This option is used when a
-certificate is being created from another certificate (for example with
-the B<-signkey> or the B<-CA> options). Normally all extensions are
-retained.
+Check that the certificate matches the specified email address.
 
-=item B<-keyform> B<DER>|B<PEM>
+=item B<-checkip> I<ipaddr>
 
-The key format; the default is B<PEM>.
-See L<openssl(1)/Format Options> for details.
+Check that the certificate matches the specified IP address.
 
-=item B<-CAform> B<DER>|B<PEM>, B<-CAkeyform> B<DER>|B<PEM>
+=back
 
-The format for the CA certificate and key; the default is B<PEM>.
-See L<openssl(1)/Format Options> for details.
+=head2 Certificate Output Options
 
-=item B<-days> I<arg>
+=over 4
 
-Specifies the number of days to make a certificate valid for. The default
-is 30 days. Cannot be used with the B<-preserve_dates> option.
+=item B<-set_serial> I<n>
 
-=item B<-x509toreq>
+Specifies the serial number to use. This option can be used with either
+the B<-signkey> or B<-CA> options. If used in conjunction with the B<-CA> option
+the serial number file (as specified by the B<-CAserial> option) is not used.
 
-Converts a certificate into a certificate request. The B<-signkey> option
-is used to pass the required private key.
+The serial number can be decimal or hex (if preceded by C<0x>).
 
-=item B<-req>
+=item B<-next_serial>
 
-By default a certificate is expected on input. With this option a
-certificate request is expected instead.
+Set the serial to be one more than the number in the certificate.
 
-=item B<-set_serial> I<n>
+=item B<-days> I<arg>
 
-Specifies the serial number to use. This option can be used with either
-the B<-signkey> or B<-CA> options. If used in conjunction with the B<-CA>
-option the serial number file (as specified by the B<-CAserial> or
-B<-CAcreateserial> options) is not used.
+Specifies the number of days until a newly generated certificate expires.
+The default is 30.
+Cannot be used together with the B<-preserve_dates> option.
 
-The serial number can be decimal or hex (if preceded by C<0x>).
+=item B<-preserve_dates>
 
-=item B<-CA> I<filename>
+When signing a certificate, preserve "notBefore" and "notAfter" dates of any
+input certificate instead of adjusting them to current time and duration.
+Cannot be used together with the B<-days> option.
 
-Specifies the CA certificate to be used for signing. When this option is
-present, this command behaves like a "mini CA". The input file is signed by
-this CA using this option: that is its issuer name is set to the subject name
-of the CA and it is digitally signed using the CAs private key.
+=item B<-subj> I<arg>
 
-This option is normally combined with the B<-req> option. Without the
-B<-req> option the input is a certificate which must be self signed.
+When a certificate is created set its subject name to the given value.
+When the certificate is self-signed the issuer name is set to the same value.
 
-=item B<-CAkey> I<filename>
+The arg must be formatted as C</type0=value0/type1=value1/type2=...>.
+Special characters may be escaped by C<\> (backslash), whitespace is retained.
+Empty values are permitted, but the corresponding type will not be included
+in the certificate.
+Giving a single C</> will lead to an empty sequence of RDNs (a NULL-DN).
+Multi-valued RDNs can be formed by placing a C<+> character instead of a C</>
+between the AttributeValueAssertions (AVAs) that specify the members of the set.
+Example:
 
-Sets the CA private key to sign a certificate with. If this option is
-not specified then it is assumed that the CA private key is present in
-the CA certificate file.
+C</DC=org/DC=OpenSSL/DC=users/UID=123456+CN=John Doe>
 
-=item B<-CAserial> I<filename>
+This option can be used in conjunction with the B<-force_pubkey> option
+to create a certificate even without providing an input certificate
+or certificate request.
 
-Sets the CA serial number file to use.
+=item B<-force_pubkey> I<filename>
 
-When the B<-CA> option is used to sign a certificate it uses a serial
-number specified in a file. This file consists of one line containing
-an even number of hex digits with the serial number to use. After each
-use the serial number is incremented and written out to the file again.
+When a certificate is created set its public key to the key in I<filename>
+instead of the key contained in the input or given with the B<-signkey> option.
 
-The default filename consists of the CA certificate file base name with
-F<.srl> appended. For example if the CA certificate file is called
-F<mycacert.pem> it expects to find a serial number file called
-F<mycacert.srl>.
+This option is useful for creating self-issued certificates that are not
+self-signed, for instance when the key cannot be used for signing, such as DH.
+It can also be used in conjunction with b<-new> and B<-subj> to directly
+generate a certificate containing any desired public key.
 
-=item B<-CAcreateserial>
+=item B<-clrext>
 
-With this option the CA serial number file is created if it does not exist:
-it will contain the serial number "02" and the certificate being signed will
-have the 1 as its serial number. If the B<-CA> option is specified
-and the serial number file does not exist a random number is generated;
-this is the recommended practice.
+When transforming a certificate to a new certificate
+by default all certificate extensions are retained.
+
+When transforming a certificate or certificate request,
+the B<-clrext> option prevents taking over any extensions from the source.
+In any case, when producing a certificate request,
+neither subject identifier nor authority key identifier extensions are included.
 
 =item B<-extfile> I<filename>
 
-File containing certificate extensions to use. If not specified then
-no extensions are added to the certificate.
+Configuration file containing certificate and request X.509 extensions to add.
 
 =item B<-extensions> I<section>
 
-The section to add certificate extensions from. If this option is not
+The section in the extfile to add X.509 extensions from.
+If this option is not
 specified then the extensions should either be contained in the unnamed
 (default) section or the default section should contain a variable called
-"extensions" which contains the section to use. See the
-L<x509v3_config(5)> manual page for details of the
+"extensions" which contains the section to use.
+See the L<x509v3_config(5)> manual page for details of the
 extension section format.
 
-=item B<-new>
-
-Generate a certificate from scratch, not using an input certificate
-or certificate request. So the B<-in> option must not be used in this case.
-Instead, the B<-subj> and <-force_pubkey> options need to be given.
-
-=item B<-force_pubkey> I<filename>
-
-When a certificate is created set its public key to the key in I<filename>
-instead of the key contained in the input or given with the B<-signkey> option.
-
-This option is useful for creating self-issued certificates that are not
-self-signed, for instance when the key cannot be used for signing, such as DH.
-It can also be used in conjunction with b<-new> and B<-subj> to directly
-generate a certificate containing any desired public key.
+=item B<-sigopt> I<nm>:I<v>
 
-The format of the key file can be specified using the B<-keyform> option.
+Pass options to the signature algorithm during sign operations.
+This option may be given multiple times.
+Names and values provided using this option are algorithm-specific.
 
-=item B<-subj> I<arg>
+=item B<-badsig>
 
-When a certificate is created set its subject name to the given value.
-The arg must be formatted as C</type0=value0/type1=value1/type2=...>.
-Keyword characters may be escaped by \ (backslash), and whitespace is retained.
-Empty values are permitted, but the corresponding type will not be included
-in the certificate. Giving a single C</> will lead to an empty sequence of RDNs
-(a NULL subject DN).
+Corrupt the signature before writing it; this can be useful
+for testing.
 
-Unless the B<-CA> option is given the issuer is set to the same value.
+=item B<-I<digest>>
 
-This option can be used in conjunction with the B<-force_pubkey> option
-to create a certificate even without providing an input certificate
-or certificate request.
+The digest to use.
+This affects any signing or printing option that uses a message
+digest, such as the B<-fingerprint>, B<-signkey> and B<-CA> options.
+Any digest supported by the L<openssl-dgst(1)> command can be used.
+If not specified then SHA1 is used with B<-fingerprint> or
+the default digest for the signing algorithm is used, typically SHA256.
 
 =back
 
-=head2 Name Options
-
-The B<-nameopt> command line switch determines how the subject and issuer
-names are displayed. If no B<-nameopt> switch is present the default "oneline"
-format is used which is compatible with previous versions of OpenSSL.
-Each option is described in detail below, all options can be preceded by
-a B<-> to turn the option off. Only the first four will normally be used.
+=head2 Micro-CA Options
 
 =over 4
 
-=item B<compat>
+=item B<-CA> I<filename>|I<uri>
 
-Use the old format.
+Specifies the "CA" certificate to be used for signing.
+When present, this behaves like a "micro CA" as follows:
+The subject name of the "CA" certificate is placed as issuer name in the new
+certificate, which is then signed using the "CA" key given as detailed below.
 
-=item B<RFC2253>
+This option cannot be used in conjunction with the B<-signkey> option.
+This option is normally combined with the B<-req> option referencing a CSR.
+Without the B<-req> option the input must be a self-signed certificate
+unless the B<-new> option is given, which generates a certificate from scratch.
 
-Displays names compatible with RFC2253 equivalent to B<esc_2253>, B<esc_ctrl>,
-B<esc_msb>, B<utf8>, B<dump_nostr>, B<dump_unknown>, B<dump_der>,
-B<sep_comma_plus>, B<dn_rev> and B<sname>.
+=item B<-CAform> B<DER>|B<PEM>|B<P12>,
 
-=item B<oneline>
+The format for the CA certificate.
+This option has no effect and is retained for backward compatibility.
 
-A oneline format which is more readable than RFC2253. It is equivalent to
-specifying the  B<esc_2253>, B<esc_ctrl>, B<esc_msb>, B<utf8>, B<dump_nostr>,
-B<dump_der>, B<use_quote>, B<sep_comma_plus_space>, B<space_eq> and B<sname>
-options.  This is the I<default> of no name options are given explicitly.
+=item B<-CAkey> I<filename>|I<uri>
 
-=item B<multiline>
+Sets the CA private key to sign a certificate with.
+The private key must match the public key of the certificate given with B<-CA>.
+If this option is not provided then the key must be present in the B<-CA> input.
 
-A multiline format. It is equivalent B<esc_ctrl>, B<esc_msb>, B<sep_multiline>,
-B<space_eq>, B<lname> and B<align>.
+=item B<-CAkeyform> B<DER>|B<PEM>|B<P12>|B<ENGINE>
 
-=item B<esc_2253>
+The format for the CA key; the default is B<PEM>.
+The only value with effect is B<ENGINE>; all others have become obsolete.
+See L<openssl-format-options(1)> for details.
 
-Escape the "special" characters required by RFC2253 in a field. That is
-B<,+"E<lt>E<gt>;>. Additionally B<#> is escaped at the beginning of a string
-and a space character at the beginning or end of a string.
-
-=item B<esc_2254>
+=item B<-CAserial> I<filename>
 
-Escape the "special" characters required by RFC2254 in a field. That is
-the B<NUL> character as well as and B<()*>.
+Sets the CA serial number file to use.
 
-=item B<esc_ctrl>
+When the B<-CA> option is used to sign a certificate it uses a serial
+number specified in a file. This file consists of one line containing
+an even number of hex digits with the serial number to use. After each
+use the serial number is incremented and written out to the file again.
 
-Escape control characters. That is those with ASCII values less than
-0x20 (space) and the delete (0x7f) character. They are escaped using the
-RFC2253 \XX notation (where XX are two hex digits representing the
-character value).
+The default filename consists of the CA certificate file base name with
+F<.srl> appended. For example if the CA certificate file is called
+F<mycacert.pem> it expects to find a serial number file called
+F<mycacert.srl>.
 
-=item B<esc_msb>
+=item B<-CAcreateserial>
 
-Escape characters with the MSB set, that is with ASCII values larger than
-127.
+With this option the CA serial number file is created if it does not exist:
+it will contain the serial number "02" and the certificate being signed will
+have the 1 as its serial number. If the B<-CA> option is specified
+and the serial number file does not exist a random number is generated;
+this is the recommended practice.
 
-=item B<use_quote>
+=back
 
-Escapes some characters by surrounding the whole string with B<"> characters,
-without the option all escaping is done with the B<\> character.
+=head2 Trust Settings
 
-=item B<utf8>
+A B<trusted certificate> is an ordinary certificate which has several
+additional pieces of information attached to it such as the permitted
+and prohibited uses of the certificate and possibly an "alias" (nickname).
 
-Convert all strings to UTF8 format first. This is required by RFC2253. If
-you are lucky enough to have a UTF8 compatible terminal then the use
-of this option (and B<not> setting B<esc_msb>) may result in the correct
-display of multibyte (international) characters. Is this option is not
-present then multibyte characters larger than 0xff will be represented
-using the format \UXXXX for 16 bits and \WXXXXXXXX for 32 bits.
-Also if this option is off any UTF8Strings will be converted to their
-character form first.
+Normally when a certificate is being verified at least one certificate
+must be "trusted". By default a trusted certificate must be stored
+locally and must be a root CA: any certificate chain ending in this CA
+is then usable for any purpose.
 
-=item B<ignore_type>
+Trust settings currently are only used with a root CA.
+They allow a finer control over the purposes the root CA can be used for.
+For example, a CA may be trusted for SSL client but not SSL server use.
 
-This option does not attempt to interpret multibyte characters in any
-way. That is their content octets are merely dumped as though one octet
-represents each character. This is useful for diagnostic purposes but
-will result in rather odd looking output.
+See the description in L<openssl-verify(1)> for more information
+on the meaning of trust settings.
 
-=item B<show_type>
+Future versions of OpenSSL will recognize trust settings on any
+certificate: not just root CAs.
 
-Show the type of the ASN1 character string. The type precedes the
-field contents. For example "BMPSTRING: Hello World".
+=over 4
 
-=item B<dump_der>
+=item B<-trustout>
 
-When this option is set any fields that need to be hexdumped will
-be dumped using the DER encoding of the field. Otherwise just the
-content octets will be displayed. Both options use the RFC2253
-B<#XXXX...> format.
+Mark any certificate PEM output as <trusted> certificate rather than ordinary.
+An ordinary or trusted certificate can be input but by default an ordinary
+certificate is output and any trust settings are discarded.
+With the B<-trustout> option a trusted certificate is output. A trusted
+certificate is automatically output if any trust settings are modified.
 
-=item B<dump_nostr>
+=item B<-setalias> I<arg>
 
-Dump non character string types (for example OCTET STRING) if this
-option is not set then non character string types will be displayed
-as though each content octet represents a single character.
+Sets the "alias" of the certificate. This will allow the certificate
+to be referred to using a nickname for example "Steve's Certificate".
 
-=item B<dump_all>
+=item B<-clrtrust>
 
-Dump all fields. This option when used with B<dump_der> allows the
-DER encoding of the structure to be unambiguously determined.
+Clears all the permitted or trusted uses of the certificate.
 
-=item B<dump_unknown>
+=item B<-addtrust> I<arg>
 
-Dump any field whose OID is not recognised by OpenSSL.
+Adds a trusted certificate use.
+Any object name can be used here but currently only B<clientAuth> (SSL client
+use), B<serverAuth> (SSL server use), B<emailProtection> (S/MIME email)
+and B<anyExtendedKeyUsage> are used.
+As of OpenSSL 1.1.0, the last of these blocks all purposes when rejected or
+enables all purposes when trusted.
+Other OpenSSL applications may define additional uses.
 
-=item B<sep_comma_plus>, B<sep_comma_plus_space>, B<sep_semi_plus_space>,
-B<sep_multiline>
+=item B<-clrreject>
 
-These options determine the field separators. The first character is
-between Relative Distinguished Names (RDNs) and the second is between
-multiple Attribute Value Assertions (AVAs, multiple AVAs are
-very rare and their use is discouraged). The options ending in
-"space" additionally place a space after the separator to make it
-more readable. The B<sep_multiline> uses a linefeed character for
-the RDN separator and a spaced B<+> for the AVA separator. It also
-indents the fields by four characters. If no field separator is specified
-then B<sep_comma_plus_space> is used by default.
+Clears all the prohibited or rejected uses of the certificate.
 
-=item B<dn_rev>
+=item B<-addreject> I<arg>
 
-Reverse the fields of the DN. This is required by RFC2253. As a side
-effect this also reverses the order of multiple AVAs but this is
-permissible.
+Adds a prohibited use.
+It accepts the same values as the B<-addtrust> option.
 
-=item B<nofname>, B<sname>, B<lname>, B<oid>
+=back
 
-These options alter how the field name is displayed. B<nofname> does
-not display the field at all. B<sname> uses the "short name" form
-(CN for commonName for example). B<lname> uses the long form.
-B<oid> represents the OID in numerical form and is useful for
-diagnostic purpose.
+=head2 Generic options
 
-=item B<align>
+=over 4
 
-Align field values for a more readable output. Only usable with
-B<sep_multiline>.
+{- $OpenSSL::safe::opt_r_item -}
 
-=item B<space_eq>
+{- $OpenSSL::safe::opt_engine_item -}
 
-Places spaces round the B<=> character which follows the field
-name.
+{- $OpenSSL::safe::opt_provider_item -}
 
 =back
 
-=head2 Text Options
+=head2 Text Printing Flags
 
-As well as customising the name output format, it is also possible to
-customise the actual fields printed using the B<certopt> options when
+As well as customising the name printing format, it is also possible to
+customise the actual fields printed using the B<certopt> option when
 the B<text> option is present. The default behaviour is to print all fields.
 
 =over 4
 
 =item B<compatible>
 
-Use the old format. This is equivalent to specifying no output options at all.
+Use the old format. This is equivalent to specifying no printing options at all.
 
 =item B<no_header>
 
@@ -718,36 +661,36 @@ B<no_header>, and B<no_version>.
 Note: in these examples the '\' means the example should be all on one
 line.
 
-Display the contents of a certificate:
+Print the contents of a certificate:
 
  openssl x509 -in cert.pem -noout -text
 
-Display the "Subject Alternative Name" extension of a certificate:
+Print the "Subject Alternative Name" extension of a certificate:
 
  openssl x509 -in cert.pem -noout -ext subjectAltName
 
-Display more extensions of a certificate:
+Print more extensions of a certificate:
 
  openssl x509 -in cert.pem -noout -ext subjectAltName,nsCertType
 
-Display the certificate serial number:
+Print the certificate serial number:
 
  openssl x509 -in cert.pem -noout -serial
 
-Display the certificate subject name:
+Print the certificate subject name:
 
  openssl x509 -in cert.pem -noout -subject
 
-Display the certificate subject name in RFC2253 form:
+Print the certificate subject name in RFC2253 form:
 
  openssl x509 -in cert.pem -noout -subject -nameopt RFC2253
 
-Display the certificate subject name in oneline form on a terminal
+Print the certificate subject name in oneline form on a terminal
 supporting UTF8:
 
  openssl x509 -in cert.pem -noout -subject -nameopt oneline,-esc_msb
 
-Display the certificate SHA1 fingerprint:
+Print the certificate SHA1 fingerprint:
 
  openssl x509 -sha1 -in cert.pem -noout -fingerprint
 
@@ -759,7 +702,7 @@ Convert a certificate to a certificate request:
 
  openssl x509 -x509toreq -in cert.pem -out req.pem -signkey key.pem
 
-Convert a certificate request into a self signed certificate using
+Convert a certificate request into a self-signed certificate using
 extensions for a CA:
 
  openssl x509 -req -in careq.pem -extfile openssl.cnf -extensions v3_ca \
@@ -771,7 +714,6 @@ certificate extensions:
  openssl x509 -req -in req.pem -extfile openssl.cnf -extensions v3_usr \
         -CA cacert.pem -CAkey key.pem -CAcreateserial
 
-
 Set a certificate to be trusted for SSL client use and change set its alias to
 "Steve's Class 1 CA"
 
@@ -783,7 +725,7 @@ Set a certificate to be trusted for SSL client use and change set its alias to
 The conversion to UTF8 format used with the name options assumes that
 T61Strings use the ISO8859-1 character set. This is wrong but Netscape
 and MSIE do this as do many certificates. So although this is incorrect
-it is more likely to display the majority of certificates correctly.
+it is more likely to print the majority of certificates correctly.
 
 The B<-email> option searches the subject name and the subject alternative
 name extension. Only unique email addresses will be printed out: it will
@@ -811,9 +753,9 @@ because the certificate should really not be regarded as a CA: however
 it is allowed to be a CA to work around some broken software.
 
 If the certificate is a V1 certificate (and thus has no extensions) and
-it is self signed it is also assumed to be a CA but a warning is again
+it is self-signed it is also assumed to be a CA but a warning is again
 given: this is to work around the problem of Verisign roots which are V1
-self signed certificates.
+self-signed certificates.
 
 If the keyUsage extension is present then additional restraints are
 made on the uses of the certificate. A CA certificate B<must> have the
@@ -904,12 +846,9 @@ must be present.
 
 =head1 BUGS
 
-Extensions in certificates are not transferred to certificate requests and
-vice versa.
-
 It is possible to produce invalid certificates or requests by specifying the
-wrong private key or using inconsistent options in some cases: these should
-be checked.
+wrong private key, using unsuitable X.509 extensions,
+or using inconsistent options in some cases: these should be checked.
 
 There should be options to explicitly set such things as start and end
 dates rather than an offset from the current time.
@@ -932,9 +871,18 @@ of the distinguished name. In OpenSSL 1.0.0 and later it is based on a canonical
 version of the DN using SHA1. This means that any directories using the old
 form must have their links rebuilt using L<openssl-rehash(1)> or similar.
 
+All B<-keyform> and B<-CAkeyform> values except B<ENGINE>
+have become obsolete in OpenSSL 3.0.0 and have no effect.
+
+The B<-CAform> option has become obsolete in OpenSSL 3.0.0 and has no effect.
+
+The B<-engine> option was deprecated in OpenSSL 3.0.
+
+The B<-C> option was removed in OpenSSL 3.0.
+
 =head1 COPYRIGHT
 
-Copyright 2000-2019 The OpenSSL Project Authors. All Rights Reserved.
+Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.
 
 Licensed under the Apache License 2.0 (the "License").  You may not use
 this file except in compliance with the License.  You can obtain a copy