diff options
author | Dr. David von Oheimb <David.von.Oheimb@siemens.com> | 2020-12-19 19:46:14 +0100 |
---|---|---|
committer | Dr. David von Oheimb <dev@ddvo.net> | 2021-01-13 11:53:15 +0100 |
commit | 6ad957f1273e9918c22b27d0f1b1812360964a4e (patch) | |
tree | b2a5fe3524e017b8910b81acbc4a3fb935b55a80 /doc/man1 | |
parent | APPS: Allow OPENSSL_CONF to be empty, not loading a config file (diff) | |
download | openssl-6ad957f1273e9918c22b27d0f1b1812360964a4e.tar.xz openssl-6ad957f1273e9918c22b27d0f1b1812360964a4e.zip |
apps/req.c: add -CA and -CAkey options; improve code and doc
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/13658)
Diffstat (limited to 'doc/man1')
-rw-r--r-- | doc/man1/openssl-ca.pod.in | 49 | ||||
-rw-r--r-- | doc/man1/openssl-req.pod.in | 81 |
2 files changed, 81 insertions, 49 deletions
diff --git a/doc/man1/openssl-ca.pod.in b/doc/man1/openssl-ca.pod.in index d2d3bfb13d..e222f6f2a8 100644 --- a/doc/man1/openssl-ca.pod.in +++ b/doc/man1/openssl-ca.pod.in @@ -69,15 +69,20 @@ B<openssl> B<ca> =head1 DESCRIPTION -This command is a minimal CA application. It can be used -to sign certificate requests in a variety of forms and generate -CRLs. It also maintains a text database of issued certificates -and their status. -When signing certificates, a single certificate request can be specified +This command emulates a CA application. +See the B<WARNINGS> especially when considering to use it productively. +It can be used to sign certificate requests (CSRs) in a variety of forms +and generate certificate revocation lists (CRLs). +It also maintains a text database of issued certificates and their status. +When signing certificates, a single request can be specified with the B<-in> option, or multiple requests can be processed by specifying a set of B<certreq> files after all options. -The options descriptions will be divided into each purpose. +Note that there are also very lean ways of generating certificates: +the B<req> and B<x509> commands can be used for directly creating certificates. +See L<openssl-req(1)> and L<openssl-x509(1)> for details. + +The descriptions of the B<ca> command options are divided into each purpose. =head1 OPTIONS @@ -104,12 +109,12 @@ B<default_ca> in the B<ca> section). =item B<-in> I<filename> -An input filename containing a single certificate request to be +An input filename containing a single certificate request (CSR) to be signed by the CA. =item B<-inform> B<DER>|B<PEM> -The format of the data in CSR input files. +The format of the data in certificate request input files. The default is PEM. =item B<-ss_cert> I<filename> @@ -150,7 +155,8 @@ This option has no effect and is retained for backward compatibility only. =item B<-keyfile> I<filename>|I<uri> -The CA private key to sign requests with. This must match with B<-cert>. +The CA private key to sign certificate requests with. +This must match with B<-cert>. =item B<-keyform> B<DER>|B<PEM>|B<P12>|B<ENGINE> @@ -168,8 +174,8 @@ Names and values of these options are algorithm-specific. Pass options to the signature algorithm during verify operations. Names and values of these options are algorithm-specific. -This often needs to be given while signing too, because the input -certificate signature request is verified against its own public key, +This often needs to be given while signing too, because the self-signature of +a certificate signing request (CSR) is verified against the included public key, and that verification may need its own set of options. =item B<-key> I<password> @@ -192,9 +198,8 @@ see L<openssl-passphrase-options(1)>. Indicates the issued certificates are to be signed with the key the certificate requests were signed with (given with B<-keyfile>). -Certificate requests signed with a different key are ignored. If -B<-spkac>, B<-ss_cert> or B<-gencrl> are given, B<-selfsign> is -ignored. +Certificate requests signed with a different key are ignored. +If B<-spkac>, B<-ss_cert> or B<-gencrl> are given, B<-selfsign> is ignored. A consequence of using B<-selfsign> is that the self-signed certificate appears among the entries in the certificate database @@ -739,6 +744,8 @@ possible to include one SPKAC or self-signed certificate. =head1 BUGS +This command is quirky and at times downright unfriendly. + The use of an in-memory text database can cause problems when large numbers of certificates are present because, as the name implies the database has to be kept in memory. @@ -760,11 +767,14 @@ create an empty file. =head1 WARNINGS -This command is quirky and at times downright unfriendly. - -This command was originally meant as an example of how to do -things in a CA. It was not supposed to be used as a full blown CA itself: -nevertheless some people are using it for this purpose. +This command was originally meant as an example of how to do things in a CA. +Its code does not have production quality. +It was not supposed to be used as a full blown CA itself, +nevertheless some people are using it for this purpose at least internally. +When doing so, specific care should be taken to +properly secure the private key(s) used for signing certificates. +It is advisable to keep them in a secure HW storage such as a smart card or HSM +and access them via a suitable engine or crypto provider. This command command is effectively a single user command: no locking is done on the various files and attempts to run more than one B<openssl ca> @@ -776,7 +786,6 @@ request contains a basicConstraints extension with CA:TRUE and the B<copy_extensions> value is set to B<copyall> and the user does not spot this when the certificate is displayed then this will hand the requester a valid CA certificate. - This situation can be avoided by setting B<copy_extensions> to B<copy> and including basicConstraints with CA:FALSE in the configuration file. Then if the request contains a basicConstraints extension it will be diff --git a/doc/man1/openssl-req.pod.in b/doc/man1/openssl-req.pod.in index f778ec5cea..56de841981 100644 --- a/doc/man1/openssl-req.pod.in +++ b/doc/man1/openssl-req.pod.in @@ -33,6 +33,8 @@ B<openssl> B<req> [B<-config> I<filename>] [B<-section> I<name>] [B<-x509>] +[B<-CA> I<filename>|I<uri>] +[B<-CAkey> I<filename>|I<uri>] [B<-days> I<n>] [B<-set_serial> I<n>] [B<-newhdr>] @@ -57,8 +59,8 @@ B<openssl> B<req> =head1 DESCRIPTION -This command primarily creates and processes certificate requests -in PKCS#10 format. It can additionally create self signed certificates +This command primarily creates and processes certificate requests (CSRs) +in PKCS#10 format. It can additionally create self-signed certificates for use as root CAs for example. =head1 OPTIONS @@ -80,7 +82,7 @@ The data is a PKCS#10 object. 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. +options (B<-new> or B<-newkey>) are not specified. =item B<-sigopt> I<nm>:I<v> @@ -100,16 +102,21 @@ which supports both options for good reasons. =end comment -=item B<-passin> I<arg>, B<-passout> I<arg> +=item B<-passin> I<arg> -The password source for the input and output file. +The password source for the request input file and the certificate input. +For more information about the format of B<arg> +see L<openssl-passphrase-options(1)>. + +=item B<-passout> I<arg> + +The password source for the output file. For more information about the format of B<arg> see L<openssl-passphrase-options(1)>. =item B<-out> I<filename> -This specifies the output filename to write to or standard output by -default. +This specifies the output filename to write to or standard output by default. =item B<-text> @@ -117,21 +124,20 @@ Prints out the certificate request in text form. =item B<-subject> -Prints out the request subject (or certificate subject if B<-x509> is -specified) +Prints out the certificate request subject +(or certificate subject if B<-x509> is specified). =item B<-pubkey> -Outputs the public key. +Prints out the public key. =item B<-noout> -This option prevents output of the encoded version of the request. +This option prevents output of the encoded version of the certificate request. =item B<-modulus> -This option prints out the value of the modulus of the public key -contained in the request. +Prints out the value of the modulus of the public key contained in the request. =item B<-verify> @@ -144,8 +150,9 @@ 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. +If the B<-key> option is not given it will generate a new RSA private key +using information specified in the configuration file or given with +the B<-newkey> and B<-pkeyopt> options, else by default with 2048 bits length. =item B<-newkey> I<arg> @@ -183,8 +190,8 @@ See L<openssl-genpkey(1)/KEY GENERATION OPTIONS> for more details. =item B<-key> I<filename>|I<uri> -This specifies the private key to use. It also -accepts PKCS#8 format private keys for PEM format files. +This specifies the private key to use for self-signature. +It also accepts PKCS#8 format private keys for PEM format files. =item B<-keyform> B<DER>|B<PEM>|B<P12>|B<ENGINE> @@ -231,7 +238,7 @@ Specifies the name of the section to use; the default is B<req>. =item B<-subj> I<arg> Sets subject name for new request or supersedes the subject name -when processing a request. +when processing a certificate request. The arg must be formatted as C</type0=value0/type1=value1/type2=...>. Special characters may be escaped by C<\> (backslash), whitespace is retained. @@ -250,15 +257,31 @@ This option has been deprecated and has no effect. =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. +This option outputs a certificate instead of a certificate request. +This is typically used to generate test certificates. + +If an existing request is specified with the B<-in> option, it is converted +to the a certificate; otherwise a request is created from scratch. + +Unless specified using the B<-set_serial> option, +a large random number will be used for the serial number. + +X.509 extensions are not copied from any provided request input file. +X.509 extensions to be added can be specified in the configuration file +or using the B<-addext> option. + +=item B<-CA> I<filename>|I<uri> + +Specifies the "CA" certificate to be used for signing with the B<-x509> option. +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 specified below. + +=item B<-CAkey> I<filename>|I<uri> -If existing request is specified with the B<-in> option, it is converted -to the self signed certificate otherwise new request is created. +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. =item B<-days> I<n> @@ -268,7 +291,7 @@ be a positive integer. The default is 30 days. =item B<-set_serial> I<n> -Serial number to use when outputting a self signed certificate. This +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<ext> @@ -308,7 +331,7 @@ configuration file, must be valid UTF8 strings. =item B<-reqopt> I<option> -Customise the output format used with B<-text>. The I<option> argument can be +Customise the printing format used with B<-text>. The I<option> argument can be a single option or multiple options separated by commas. See discussion of the B<-certopt> parameter in the L<openssl-x509(1)> @@ -533,7 +556,7 @@ The same but just using req: openssl req -newkey rsa:2048 -keyout key.pem -out req.pem -Generate a self signed root certificate: +Generate a self-signed root certificate: openssl req -x509 -newkey rsa:2048 -keyout key.pem -out req.pem |