=pod {- OpenSSL::safe::output_do_not_edit_headers(); -} =head1 NAME openssl-req - PKCS#10 certificate request and certificate generating utility =head1 SYNOPSIS B B [B<-help>] [B<-inform> B|B] [B<-outform> B|B] [B<-in> I] [B<-passin> I] [B<-out> I] [B<-passout> I] [B<-text>] [B<-pubkey>] [B<-noout>] [B<-verify>] [B<-modulus>] [B<-new>] [B<-newkey> I] [B<-pkeyopt> I:I] [B<-nodes>] [B<-key> I] [B<-keyform> B|B] [B<-keyout> I] [B<-keygen_engine> I] [B<-I>] [B<-config> I] [B<-multivalue-rdn>] [B<-x509>] [B<-days> I] [B<-set_serial> I] [B<-newhdr>] [B<-addext> I] [B<-extensions> I
] [B<-reqexts> I
] [B<-precert>] [B<-utf8>] [B<-reqopt>] [B<-subject>] [B<-subj> I] [B<-sigopt> I:I] [B<-batch>] [B<-verbose>] [B<-sm2-id> I] [B<-sm2-hex-id> I] {- $OpenSSL::safe::opt_name_synopsis -} {- $OpenSSL::safe::opt_r_synopsis -} {- $OpenSSL::safe::opt_engine_synopsis -} {- $OpenSSL::safe::opt_provider_synopsis -} =for openssl ifdef engine keygen_engine sm2-id sm2-hex-id =head1 DESCRIPTION This command primarily creates and processes certificate requests in PKCS#10 format. It can additionally create self signed certificates for use as root CAs for example. =head1 OPTIONS =over 4 =item B<-help> Print out a usage message. =item B<-inform> B|B, B<-outform> B|B The input and formats; the default is B. See L for details. The data is a PKCS#10 object. =item B<-in> I This specifies the input filename to read a request from or standard input if this option is not specified. A request is only read if the creation options (B<-new> and B<-newkey>) are not specified. =item B<-sigopt> I:I Pass options to the signature algorithm during sign or verify operations. Names and values of these options are algorithm-specific. =item B<-passin> I, B<-passout> I The password source for the input and output file. For more information about the format of B see L. =item B<-out> I This specifies the output filename to write to or standard output by default. =item B<-text> Prints out the certificate request in text form. =item B<-subject> Prints out the request subject (or certificate subject if B<-x509> is specified) =item B<-pubkey> Outputs the public key. =item B<-noout> This option prevents output of the encoded version of the request. =item B<-modulus> This option prints out the value of the modulus of the public key contained in the request. =item B<-verify> Verifies the signature on the request. =item B<-new> This option generates a new certificate request. It will prompt the user for the relevant field values. The actual fields prompted for and their maximum and minimum sizes are specified in the configuration file and any requested extensions. If the B<-key> option is not used it will generate a new RSA private key using information specified in the configuration file. =item B<-newkey> I This option creates a new certificate request and a new private key. The argument takes one of several forms. BI, where I is the number of bits, generates an RSA key I in size. If I is omitted, i.e. B<-newkey> I specified, the default key size, specified in the configuration file is used. All other algorithms support the B<-newkey> I:I form, where file may be an algorithm parameter file, created with C or an X.509 certificate for a key with appropriate algorithm. BI generates a key using the parameter file or certificate I, the algorithm is determined by the parameters. I:I use algorithm I and parameter file I: the two algorithms must match or an error occurs. I just uses algorithm I, and parameters, if necessary should be specified via B<-pkeyopt> parameter. BI generates a DSA key using the parameters in the file I. BI generates EC key (usable both with ECDSA or ECDH algorithms), BI generates GOST R 34.10-2001 key (requires B engine configured in the configuration file). If just B is specified a parameter set should be specified by B<-pkeyopt> I =item B<-pkeyopt> I:I Set the public key algorithm option I to I. The precise set of options supported depends on the public key algorithm used and its implementation. See L for more details. =item B<-key> I This specifies the file to read the private key from. It also accepts PKCS#8 format private keys for PEM format files. =item B<-keyform> B|B The format of the private key; the default is B. See L for details. =item B<-keyout> I This gives the filename to write the newly created private key to. If this option is not specified then the filename present in the configuration file is used. =item B<-nodes> If this option is specified then if a private key is created it will not be encrypted. =item B<-I> This specifies the message digest to sign the request. Any digest supported by the OpenSSL B command can be used. This overrides the digest algorithm specified in the configuration file. Some public key algorithms may override this choice. For instance, DSA signatures always use SHA1, GOST R 34.10 signatures always use GOST R 34.11-94 (B<-md_gost94>), Ed25519 and Ed448 never use any digest. =item B<-config> I This allows an alternative configuration file to be specified. Optional; for a description of the default value, see L. =item B<-subj> I Sets subject name for new request or supersedes the subject name when processing a request. The arg must be formatted as C. 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 request. =item B<-multivalue-rdn> This option causes the -subj argument to be interpreted with full support for multivalued RDNs. Example: C If -multi-rdn is not used then the UID value is C<123456+CN=John Doe>. =item B<-x509> This option outputs a self signed certificate instead of a certificate request. This is typically used to generate a test certificate or a self signed root CA. The extensions added to the certificate (if any) are specified in the configuration file. Unless specified using the B<-set_serial> option, a large random number will be used for the serial number. If existing request is specified with the B<-in> option, it is converted to the self signed certificate otherwise new request is created. =item B<-days> I When the B<-x509> option is being used this specifies the number of days to certify the certificate for, otherwise it is ignored. I should be a positive integer. The default is 30 days. =item B<-set_serial> I Serial number to use when outputting a self signed certificate. This may be specified as a decimal value or a hex value if preceded by C<0x>. =item B<-addext> I Add a specific extension to the certificate (if the B<-x509> option is present) or certificate request. The argument must have the form of a key=value pair as it would appear in a config file. This option can be given multiple times. =item B<-extensions> I
=item B<-reqexts> I
These options specify alternative sections to include certificate extensions (if the B<-x509> option is present) or certificate request extensions. This allows several different sections to be used in the same configuration file to specify requests for a variety of purposes. =item B<-precert> A poison extension will be added to the certificate, making it a "pre-certificate" (see RFC6962). This can be submitted to Certificate Transparency logs in order to obtain signed certificate timestamps (SCTs). These SCTs can then be embedded into the pre-certificate as an extension, before removing the poison and signing the certificate. This implies the B<-new> flag. =item B<-utf8> This option causes field values to be interpreted as UTF8 strings, by default they are interpreted as ASCII. This means that the field values, whether prompted from a terminal or obtained from a configuration file, must be valid UTF8 strings. =item B<-reqopt> I