2000-01-28 09:37:08 +08:00
|
|
|
=pod
|
|
|
|
|
|
|
|
=head1 NAME
|
|
|
|
|
|
|
|
CA.pl - friendlier interface for OpenSSL certificate programs
|
|
|
|
|
|
|
|
=head1 SYNOPSIS
|
|
|
|
|
|
|
|
B<CA.pl>
|
2016-10-28 15:01:02 +08:00
|
|
|
B<-?> |
|
|
|
|
B<-h> |
|
|
|
|
B<-help>
|
|
|
|
|
|
|
|
B<CA.pl>
|
|
|
|
B<-newcert> |
|
|
|
|
B<-newreq> |
|
|
|
|
B<-newreq-nodes> |
|
|
|
|
B<-xsign> |
|
|
|
|
B<-sign> |
|
|
|
|
B<-signCA> |
|
|
|
|
B<-signcert> |
|
|
|
|
B<-crl> |
|
|
|
|
B<-newca>
|
2019-09-26 03:20:11 +08:00
|
|
|
[B<-extra-cmd> I<extra-params>]
|
2016-10-28 15:01:02 +08:00
|
|
|
|
2019-09-26 03:20:11 +08:00
|
|
|
B<CA.pl> B<-pkcs12> [B<-extra-pkcs12> I<extra-params>] [I<certname>]
|
2016-10-28 15:01:02 +08:00
|
|
|
|
2019-10-01 15:57:37 +08:00
|
|
|
B<CA.pl> B<-verify> [B<-extra-verify> I<extra-params>] I<certfile> ...
|
2016-10-28 15:01:02 +08:00
|
|
|
|
2019-09-26 03:20:11 +08:00
|
|
|
B<CA.pl> B<-revoke> [B<-extra-ca> I<extra-params>] I<certfile> [I<reason>]
|
2000-01-28 09:37:08 +08:00
|
|
|
|
2016-12-13 00:14:40 +08:00
|
|
|
=head1 DESCRIPTION
|
|
|
|
|
2000-01-28 09:37:08 +08:00
|
|
|
The B<CA.pl> script is a perl script that supplies the relevant command line
|
Command docs: fix up command references
Almost all OpenSSL commands are in reality 'openssl cmd', so make sure
they are refered to like that and not just as the sub-command.
Self-references are avoided as much as is possible, and replaced with
"this command". In some cases, we even avoid that with a slight
rewrite of the sentence or paragrah they were in. However, in the few
cases where a self-reference is still admissible, they are done in
bold, i.e. openssl-speed.pod references itself like this:
B<openssl speed>
References to other commands are done as manual links, i.e. CA.pl.pod
references 'openssl req' like this: L<openssl-req(1)>
Some commands are examples rather than references; we enclose those in
C<>.
While we are it, we abolish "utility", replacing it with "command", or
remove it entirely in some cases.
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/10065)
2019-10-02 01:43:36 +08:00
|
|
|
arguments to the L<openssl(1)> command for some common certificate operations.
|
2000-01-28 09:37:08 +08:00
|
|
|
It is intended to simplify the process of certificate creation and management
|
|
|
|
by the use of some simple options.
|
|
|
|
|
2016-12-13 00:14:40 +08:00
|
|
|
=head1 OPTIONS
|
2000-01-28 09:37:08 +08:00
|
|
|
|
|
|
|
=over 4
|
|
|
|
|
|
|
|
=item B<?>, B<-h>, B<-help>
|
|
|
|
|
2017-03-30 05:38:30 +08:00
|
|
|
Prints a usage message.
|
2000-01-28 09:37:08 +08:00
|
|
|
|
|
|
|
=item B<-newcert>
|
|
|
|
|
2017-03-30 05:38:30 +08:00
|
|
|
Creates a new self signed certificate. The private key is written to the file
|
2019-10-02 02:19:45 +08:00
|
|
|
F<newkey.pem> and the request written to the file F<newreq.pem>.
|
2019-10-02 03:57:00 +08:00
|
|
|
Invokes L<openssl-req(1)>.
|
2000-01-28 09:37:08 +08:00
|
|
|
|
|
|
|
=item B<-newreq>
|
|
|
|
|
2017-03-30 05:38:30 +08:00
|
|
|
Creates a new certificate request. The private key is written to the file
|
2019-10-02 02:19:45 +08:00
|
|
|
F<newkey.pem> and the request written to the file F<newreq.pem>.
|
2019-10-02 03:57:00 +08:00
|
|
|
Executes L<openssl-req(1)> under the hood.
|
2000-01-28 09:37:08 +08:00
|
|
|
|
2005-05-04 02:34:01 +08:00
|
|
|
=item B<-newreq-nodes>
|
2001-01-11 21:23:19 +08:00
|
|
|
|
2017-03-30 05:38:30 +08:00
|
|
|
Is like B<-newreq> except that the private key will not be encrypted.
|
2019-10-02 03:57:00 +08:00
|
|
|
Uses L<openssl-req(1)>.
|
2001-01-11 21:23:19 +08:00
|
|
|
|
2000-01-28 09:37:08 +08:00
|
|
|
=item B<-newca>
|
|
|
|
|
2017-03-30 05:38:30 +08:00
|
|
|
Creates a new CA hierarchy for use with the B<ca> program (or the B<-signcert>
|
2000-01-28 09:37:08 +08:00
|
|
|
and B<-xsign> options). The user is prompted to enter the filename of the CA
|
|
|
|
certificates (which should also contain the private key) or by hitting ENTER
|
|
|
|
details of the CA will be prompted for. The relevant files and directories
|
2019-10-02 02:19:45 +08:00
|
|
|
are created in a directory called F<demoCA> in the current directory.
|
2019-10-02 03:57:00 +08:00
|
|
|
Uses L<openssl-req(1)> and L<openssl-ca(1)>.
|
2000-01-28 09:37:08 +08:00
|
|
|
|
|
|
|
=item B<-pkcs12>
|
|
|
|
|
2017-03-30 05:38:30 +08:00
|
|
|
Create a PKCS#12 file containing the user certificate, private key and CA
|
2000-01-28 09:37:08 +08:00
|
|
|
certificate. It expects the user certificate and private key to be in the
|
2019-10-02 02:19:45 +08:00
|
|
|
file F<newcert.pem> and the CA certificate to be in the file F<demoCA/cacert.pem>,
|
|
|
|
it creates a file F<newcert.p12>. This command can thus be called after the
|
2000-01-28 09:37:08 +08:00
|
|
|
B<-sign> option. The PKCS#12 file can be imported directly into a browser.
|
|
|
|
If there is an additional argument on the command line it will be used as the
|
|
|
|
"friendly name" for the certificate (which is typically displayed in the browser
|
2000-02-04 07:23:24 +08:00
|
|
|
list box), otherwise the name "My Certificate" is used.
|
2019-10-02 03:57:00 +08:00
|
|
|
Delegates work to L<openssl-pkcs12(1)>.
|
2000-01-28 09:37:08 +08:00
|
|
|
|
2016-10-28 15:01:02 +08:00
|
|
|
=item B<-sign>, B<-signcert>, B<-xsign>
|
2000-01-28 09:37:08 +08:00
|
|
|
|
Command docs: fix up command references
Almost all OpenSSL commands are in reality 'openssl cmd', so make sure
they are refered to like that and not just as the sub-command.
Self-references are avoided as much as is possible, and replaced with
"this command". In some cases, we even avoid that with a slight
rewrite of the sentence or paragrah they were in. However, in the few
cases where a self-reference is still admissible, they are done in
bold, i.e. openssl-speed.pod references itself like this:
B<openssl speed>
References to other commands are done as manual links, i.e. CA.pl.pod
references 'openssl req' like this: L<openssl-req(1)>
Some commands are examples rather than references; we enclose those in
C<>.
While we are it, we abolish "utility", replacing it with "command", or
remove it entirely in some cases.
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/10065)
2019-10-02 01:43:36 +08:00
|
|
|
Calls the L<openssl-ca(1)> command to sign a certificate request. It expects the
|
2019-10-02 02:19:45 +08:00
|
|
|
request to be in the file F<newreq.pem>. The new certificate is written to the
|
|
|
|
file F<newcert.pem> except in the case of the B<-xsign> option when it is
|
2019-10-02 03:57:00 +08:00
|
|
|
written to standard output.
|
2000-08-25 07:24:18 +08:00
|
|
|
|
|
|
|
=item B<-signCA>
|
|
|
|
|
2017-03-30 05:38:30 +08:00
|
|
|
This option is the same as the B<-signreq> option except it uses the
|
|
|
|
configuration file section B<v3_ca> and so makes the signed request a
|
|
|
|
valid CA certificate. This is useful when creating intermediate CA from
|
2019-10-02 03:57:00 +08:00
|
|
|
a root CA. Extra params are passed to L<openssl-ca(1)>.
|
2000-08-25 07:24:18 +08:00
|
|
|
|
2000-01-28 09:37:08 +08:00
|
|
|
=item B<-signcert>
|
|
|
|
|
2017-03-30 05:38:30 +08:00
|
|
|
This option is the same as B<-sign> except it expects a self signed certificate
|
2019-10-02 02:19:45 +08:00
|
|
|
to be present in the file F<newreq.pem>.
|
2019-10-02 03:57:00 +08:00
|
|
|
Extra params are passed to L<openssl-x509(1)> and L<openssl-ca(1)>.
|
2000-01-28 09:37:08 +08:00
|
|
|
|
2014-09-19 09:45:41 +08:00
|
|
|
=item B<-crl>
|
|
|
|
|
2019-10-02 03:57:00 +08:00
|
|
|
Generate a CRL. Executes L<openssl-ca(1)>.
|
2014-09-19 09:45:41 +08:00
|
|
|
|
2019-09-26 03:20:11 +08:00
|
|
|
=item B<-revoke> I<certfile> [I<reason>]
|
2014-09-19 09:45:41 +08:00
|
|
|
|
2017-03-30 05:38:30 +08:00
|
|
|
Revoke the certificate contained in the specified B<certfile>. An optional
|
2014-09-19 09:45:41 +08:00
|
|
|
reason may be specified, and must be one of: B<unspecified>,
|
|
|
|
B<keyCompromise>, B<CACompromise>, B<affiliationChanged>, B<superseded>,
|
|
|
|
B<cessationOfOperation>, B<certificateHold>, or B<removeFromCRL>.
|
2019-10-02 03:57:00 +08:00
|
|
|
Leverages L<openssl-ca(1)>.
|
2014-09-19 09:45:41 +08:00
|
|
|
|
2000-01-28 09:37:08 +08:00
|
|
|
=item B<-verify>
|
|
|
|
|
2019-10-02 02:19:45 +08:00
|
|
|
Verifies certificates against the CA certificate for F<demoCA>. If no
|
2017-03-30 05:38:30 +08:00
|
|
|
certificates are specified on the command line it tries to verify the file
|
2019-10-02 03:57:00 +08:00
|
|
|
F<newcert.pem>. Invokes L<openssl-verify(1)>.
|
2000-01-28 09:37:08 +08:00
|
|
|
|
2019-10-02 00:16:29 +08:00
|
|
|
=item B<-extra-req> | B<-extra-ca> | B<-extra-pkcs12> | B<-extra-x509> | B<-extra-verify> I<extra-params>
|
2016-12-13 00:14:40 +08:00
|
|
|
|
2019-10-02 03:10:17 +08:00
|
|
|
For each option B<extra-I<cmd>>, pass I<extra-params> to the L<openssl(1)>
|
|
|
|
sub-command with the same name as I<cmd>, if that sub-command is invoked.
|
|
|
|
For example, if L<openssl-req(1)> is invoked, the I<extra-params> given with
|
|
|
|
B<-extra-req> will be passed to it.
|
Command docs: fix up command references
Almost all OpenSSL commands are in reality 'openssl cmd', so make sure
they are refered to like that and not just as the sub-command.
Self-references are avoided as much as is possible, and replaced with
"this command". In some cases, we even avoid that with a slight
rewrite of the sentence or paragrah they were in. However, in the few
cases where a self-reference is still admissible, they are done in
bold, i.e. openssl-speed.pod references itself like this:
B<openssl speed>
References to other commands are done as manual links, i.e. CA.pl.pod
references 'openssl req' like this: L<openssl-req(1)>
Some commands are examples rather than references; we enclose those in
C<>.
While we are it, we abolish "utility", replacing it with "command", or
remove it entirely in some cases.
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/10065)
2019-10-02 01:43:36 +08:00
|
|
|
Users should consult L<openssl(1)> command documentation for more information.
|
2016-12-13 00:14:40 +08:00
|
|
|
|
2000-01-28 09:37:08 +08:00
|
|
|
=back
|
|
|
|
|
|
|
|
=head1 EXAMPLES
|
|
|
|
|
|
|
|
Create a CA hierarchy:
|
|
|
|
|
|
|
|
CA.pl -newca
|
|
|
|
|
|
|
|
Complete certificate creation example: create a CA, create a request, sign
|
|
|
|
the request and finally create a PKCS#12 file containing it.
|
|
|
|
|
|
|
|
CA.pl -newca
|
|
|
|
CA.pl -newreq
|
|
|
|
CA.pl -signreq
|
|
|
|
CA.pl -pkcs12 "My Test Certificate"
|
|
|
|
|
2000-03-25 10:38:28 +08:00
|
|
|
=head1 DSA CERTIFICATES
|
|
|
|
|
|
|
|
Although the B<CA.pl> creates RSA CAs and requests it is still possible to
|
2019-10-02 03:57:00 +08:00
|
|
|
use it with DSA certificates and requests using the L<openssl-req(1)> command
|
2000-03-25 10:38:28 +08:00
|
|
|
directly. The following example shows the steps that would typically be taken.
|
|
|
|
|
|
|
|
Create some DSA parameters:
|
|
|
|
|
|
|
|
openssl dsaparam -out dsap.pem 1024
|
|
|
|
|
|
|
|
Create a DSA CA certificate and private key:
|
|
|
|
|
|
|
|
openssl req -x509 -newkey dsa:dsap.pem -keyout cacert.pem -out cacert.pem
|
|
|
|
|
|
|
|
Create the CA directories and files:
|
|
|
|
|
|
|
|
CA.pl -newca
|
|
|
|
|
2019-10-02 03:10:17 +08:00
|
|
|
enter a filename (for example, F<cacert.pem>) when prompted for the CA file
|
|
|
|
name.
|
2000-03-25 10:38:28 +08:00
|
|
|
|
2000-07-30 09:27:59 +08:00
|
|
|
Create a DSA certificate request and private key (a different set of parameters
|
2000-03-25 10:38:28 +08:00
|
|
|
can optionally be created first):
|
|
|
|
|
2016-05-20 20:11:46 +08:00
|
|
|
openssl req -out newreq.pem -newkey dsa:dsap.pem
|
2000-03-25 10:38:28 +08:00
|
|
|
|
|
|
|
Sign the request:
|
|
|
|
|
|
|
|
CA.pl -signreq
|
|
|
|
|
2020-02-27 04:25:43 +08:00
|
|
|
=head1 ENVIRONMENT
|
|
|
|
|
|
|
|
The environment variable B<OPENSSL_CONFIG> may be used to specify a
|
|
|
|
configuration option and value to the B<req> and B<ca> commands invoked by
|
|
|
|
this script. It's value should be the option and pathname, as in
|
|
|
|
C<-config /path/to/conf-file>.
|
|
|
|
|
2000-01-28 09:37:08 +08:00
|
|
|
=head1 NOTES
|
|
|
|
|
|
|
|
Most of the filenames mentioned can be modified by editing the B<CA.pl> script.
|
|
|
|
|
2020-02-27 04:25:43 +08:00
|
|
|
If the F<demoCA> directory already exists then the B<-newca> command will not
|
2000-01-28 09:37:08 +08:00
|
|
|
overwrite it and will do nothing. This can happen if a previous call using
|
|
|
|
the B<-newca> option terminated abnormally. To get the correct behaviour
|
|
|
|
delete the demoCA directory if it already exists.
|
|
|
|
|
|
|
|
Under some environments it may not be possible to run the B<CA.pl> script
|
|
|
|
directly (for example Win32) and the default configuration file location may
|
|
|
|
be wrong. In this case the command:
|
|
|
|
|
|
|
|
perl -S CA.pl
|
|
|
|
|
2016-05-20 20:11:46 +08:00
|
|
|
can be used and the B<OPENSSL_CONF> environment variable changed to point to
|
2017-02-08 00:33:21 +08:00
|
|
|
the correct path of the configuration file.
|
2000-01-28 09:37:08 +08:00
|
|
|
|
Command docs: fix up command references
Almost all OpenSSL commands are in reality 'openssl cmd', so make sure
they are refered to like that and not just as the sub-command.
Self-references are avoided as much as is possible, and replaced with
"this command". In some cases, we even avoid that with a slight
rewrite of the sentence or paragrah they were in. However, in the few
cases where a self-reference is still admissible, they are done in
bold, i.e. openssl-speed.pod references itself like this:
B<openssl speed>
References to other commands are done as manual links, i.e. CA.pl.pod
references 'openssl req' like this: L<openssl-req(1)>
Some commands are examples rather than references; we enclose those in
C<>.
While we are it, we abolish "utility", replacing it with "command", or
remove it entirely in some cases.
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/10065)
2019-10-02 01:43:36 +08:00
|
|
|
The script is intended as a simple front end for the L<openssl(1)> program for
|
|
|
|
use by a beginner. Its behaviour isn't always what is wanted. For more control
|
|
|
|
over the behaviour of the certificate commands call the L<openssl(1)> command
|
|
|
|
directly.
|
2000-01-28 09:37:08 +08:00
|
|
|
|
|
|
|
=head1 SEE ALSO
|
|
|
|
|
2019-08-22 07:04:41 +08:00
|
|
|
L<openssl(1)>,
|
|
|
|
L<openssl-x509(1)>,
|
|
|
|
L<openssl-ca(1)>,
|
|
|
|
L<openssl-req(1)>,
|
|
|
|
L<openssl-pkcs12(1)>,
|
2015-08-18 03:21:33 +08:00
|
|
|
L<config(5)>
|
2000-01-28 09:37:08 +08:00
|
|
|
|
2016-05-18 23:44:05 +08:00
|
|
|
=head1 COPYRIGHT
|
|
|
|
|
2017-03-30 05:38:30 +08:00
|
|
|
Copyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved.
|
2016-05-18 23:44:05 +08:00
|
|
|
|
2018-12-06 21:04:11 +08:00
|
|
|
Licensed under the Apache License 2.0 (the "License"). You may not use
|
2016-05-18 23:44:05 +08:00
|
|
|
this file except in compliance with the License. You can obtain a copy
|
|
|
|
in the file LICENSE in the source distribution or at
|
|
|
|
L<https://www.openssl.org/source/license.html>.
|
|
|
|
|
|
|
|
=cut
|