xref: /freebsd/crypto/openssl/doc/man1/CA.pl.pod (revision b077aed33b7b6aefca7b17ddb250cf521f938613)
1e71b7053SJung-uk Kim=pod
2e71b7053SJung-uk Kim
3e71b7053SJung-uk Kim=head1 NAME
4e71b7053SJung-uk Kim
5e71b7053SJung-uk KimCA.pl - friendlier interface for OpenSSL certificate programs
6e71b7053SJung-uk Kim
7e71b7053SJung-uk Kim=head1 SYNOPSIS
8e71b7053SJung-uk Kim
9e71b7053SJung-uk KimB<CA.pl>
10e71b7053SJung-uk KimB<-?> |
11e71b7053SJung-uk KimB<-h> |
12e71b7053SJung-uk KimB<-help>
13e71b7053SJung-uk Kim
14e71b7053SJung-uk KimB<CA.pl>
15e71b7053SJung-uk KimB<-newcert> |
16e71b7053SJung-uk KimB<-newreq> |
17e71b7053SJung-uk KimB<-newreq-nodes> |
18e71b7053SJung-uk KimB<-xsign> |
19e71b7053SJung-uk KimB<-sign> |
20e71b7053SJung-uk KimB<-signCA> |
21e71b7053SJung-uk KimB<-signcert> |
22e71b7053SJung-uk KimB<-crl> |
23e71b7053SJung-uk KimB<-newca>
24*b077aed3SPierre Pronchery[B<-extra-I<cmd>> I<parameter>]
25e71b7053SJung-uk Kim
26*b077aed3SPierre ProncheryB<CA.pl> B<-pkcs12> [I<certname>]
27e71b7053SJung-uk Kim
28*b077aed3SPierre ProncheryB<CA.pl> B<-verify> I<certfile> ...
29e71b7053SJung-uk Kim
30*b077aed3SPierre ProncheryB<CA.pl> B<-revoke> I<certfile> [I<reason>]
31e71b7053SJung-uk Kim
32e71b7053SJung-uk Kim=head1 DESCRIPTION
33e71b7053SJung-uk Kim
34e71b7053SJung-uk KimThe B<CA.pl> script is a perl script that supplies the relevant command line
35*b077aed3SPierre Proncheryarguments to the L<openssl(1)> command for some common certificate operations.
36e71b7053SJung-uk KimIt is intended to simplify the process of certificate creation and management
37e71b7053SJung-uk Kimby the use of some simple options.
38e71b7053SJung-uk Kim
39*b077aed3SPierre ProncheryThe script is intended as a simple front end for the L<openssl(1)> program for
40*b077aed3SPierre Proncheryuse by a beginner. Its behaviour isn't always what is wanted. For more control
41*b077aed3SPierre Proncheryover the behaviour of the certificate commands call the L<openssl(1)> command
42*b077aed3SPierre Proncherydirectly.
43*b077aed3SPierre Pronchery
44*b077aed3SPierre ProncheryMost of the filenames mentioned below can be modified by editing the
45*b077aed3SPierre ProncheryB<CA.pl> script.
46*b077aed3SPierre Pronchery
47*b077aed3SPierre ProncheryUnder some environments it may not be possible to run the B<CA.pl> script
48*b077aed3SPierre Proncherydirectly (for example Win32) and the default configuration file location may
49*b077aed3SPierre Proncherybe wrong. In this case the command:
50*b077aed3SPierre Pronchery
51*b077aed3SPierre Pronchery perl -S CA.pl
52*b077aed3SPierre Pronchery
53*b077aed3SPierre Proncherycan be used and the B<OPENSSL_CONF> environment variable can be set to point to
54*b077aed3SPierre Proncherythe correct path of the configuration file.
55*b077aed3SPierre Pronchery
56e71b7053SJung-uk Kim=head1 OPTIONS
57e71b7053SJung-uk Kim
58e71b7053SJung-uk Kim=over 4
59e71b7053SJung-uk Kim
60*b077aed3SPierre Pronchery=item B<-?>, B<-h>, B<-help>
61e71b7053SJung-uk Kim
62e71b7053SJung-uk KimPrints a usage message.
63e71b7053SJung-uk Kim
64e71b7053SJung-uk Kim=item B<-newcert>
65e71b7053SJung-uk Kim
66e71b7053SJung-uk KimCreates a new self signed certificate. The private key is written to the file
67*b077aed3SPierre ProncheryF<newkey.pem> and the request written to the file F<newreq.pem>.
68*b077aed3SPierre ProncheryInvokes L<openssl-req(1)>.
69e71b7053SJung-uk Kim
70e71b7053SJung-uk Kim=item B<-newreq>
71e71b7053SJung-uk Kim
72e71b7053SJung-uk KimCreates a new certificate request. The private key is written to the file
73*b077aed3SPierre ProncheryF<newkey.pem> and the request written to the file F<newreq.pem>.
74*b077aed3SPierre ProncheryExecutes L<openssl-req(1)> under the hood.
75e71b7053SJung-uk Kim
76e71b7053SJung-uk Kim=item B<-newreq-nodes>
77e71b7053SJung-uk Kim
78e71b7053SJung-uk KimIs like B<-newreq> except that the private key will not be encrypted.
79*b077aed3SPierre ProncheryUses L<openssl-req(1)>.
80e71b7053SJung-uk Kim
81e71b7053SJung-uk Kim=item B<-newca>
82e71b7053SJung-uk Kim
83e71b7053SJung-uk KimCreates a new CA hierarchy for use with the B<ca> program (or the B<-signcert>
84e71b7053SJung-uk Kimand B<-xsign> options). The user is prompted to enter the filename of the CA
85e71b7053SJung-uk Kimcertificates (which should also contain the private key) or by hitting ENTER
86e71b7053SJung-uk Kimdetails of the CA will be prompted for. The relevant files and directories
87*b077aed3SPierre Proncheryare created in a directory called F<demoCA> in the current directory.
88*b077aed3SPierre ProncheryUses L<openssl-req(1)> and L<openssl-ca(1)>.
89*b077aed3SPierre Pronchery
90*b077aed3SPierre ProncheryIf the F<demoCA> directory already exists then the B<-newca> command will not
91*b077aed3SPierre Proncheryoverwrite it and will do nothing. This can happen if a previous call using
92*b077aed3SPierre Proncherythe B<-newca> option terminated abnormally. To get the correct behaviour
93*b077aed3SPierre Proncherydelete the directory if it already exists.
94e71b7053SJung-uk Kim
95e71b7053SJung-uk Kim=item B<-pkcs12>
96e71b7053SJung-uk Kim
97e71b7053SJung-uk KimCreate a PKCS#12 file containing the user certificate, private key and CA
98e71b7053SJung-uk Kimcertificate. It expects the user certificate and private key to be in the
99*b077aed3SPierre Proncheryfile F<newcert.pem> and the CA certificate to be in the file F<demoCA/cacert.pem>,
100*b077aed3SPierre Proncheryit creates a file F<newcert.p12>. This command can thus be called after the
101e71b7053SJung-uk KimB<-sign> option. The PKCS#12 file can be imported directly into a browser.
102e71b7053SJung-uk KimIf there is an additional argument on the command line it will be used as the
103e71b7053SJung-uk Kim"friendly name" for the certificate (which is typically displayed in the browser
104e71b7053SJung-uk Kimlist box), otherwise the name "My Certificate" is used.
105*b077aed3SPierre ProncheryDelegates work to L<openssl-pkcs12(1)>.
106e71b7053SJung-uk Kim
107e71b7053SJung-uk Kim=item B<-sign>, B<-signcert>, B<-xsign>
108e71b7053SJung-uk Kim
109*b077aed3SPierre ProncheryCalls the L<openssl-ca(1)> command to sign a certificate request. It expects the
110*b077aed3SPierre Proncheryrequest to be in the file F<newreq.pem>. The new certificate is written to the
111*b077aed3SPierre Proncheryfile F<newcert.pem> except in the case of the B<-xsign> option when it is
112*b077aed3SPierre Proncherywritten to standard output.
113e71b7053SJung-uk Kim
114e71b7053SJung-uk Kim=item B<-signCA>
115e71b7053SJung-uk Kim
11658f35182SJung-uk KimThis option is the same as the B<-sign> option except it uses the
117e71b7053SJung-uk Kimconfiguration file section B<v3_ca> and so makes the signed request a
118e71b7053SJung-uk Kimvalid CA certificate. This is useful when creating intermediate CA from
119*b077aed3SPierre Proncherya root CA.  Extra params are passed to L<openssl-ca(1)>.
120e71b7053SJung-uk Kim
121e71b7053SJung-uk Kim=item B<-signcert>
122e71b7053SJung-uk Kim
123e71b7053SJung-uk KimThis option is the same as B<-sign> except it expects a self signed certificate
124*b077aed3SPierre Proncheryto be present in the file F<newreq.pem>.
125*b077aed3SPierre ProncheryExtra params are passed to L<openssl-x509(1)> and L<openssl-ca(1)>.
126e71b7053SJung-uk Kim
127e71b7053SJung-uk Kim=item B<-crl>
128e71b7053SJung-uk Kim
129*b077aed3SPierre ProncheryGenerate a CRL. Executes L<openssl-ca(1)>.
130e71b7053SJung-uk Kim
131*b077aed3SPierre Pronchery=item B<-revoke> I<certfile> [I<reason>]
132e71b7053SJung-uk Kim
133e71b7053SJung-uk KimRevoke the certificate contained in the specified B<certfile>. An optional
134e71b7053SJung-uk Kimreason may be specified, and must be one of: B<unspecified>,
135e71b7053SJung-uk KimB<keyCompromise>, B<CACompromise>, B<affiliationChanged>, B<superseded>,
136e71b7053SJung-uk KimB<cessationOfOperation>, B<certificateHold>, or B<removeFromCRL>.
137*b077aed3SPierre ProncheryLeverages L<openssl-ca(1)>.
138e71b7053SJung-uk Kim
139e71b7053SJung-uk Kim=item B<-verify>
140e71b7053SJung-uk Kim
141*b077aed3SPierre ProncheryVerifies certificates against the CA certificate for F<demoCA>. If no
142e71b7053SJung-uk Kimcertificates are specified on the command line it tries to verify the file
143*b077aed3SPierre ProncheryF<newcert.pem>.  Invokes L<openssl-verify(1)>.
144e71b7053SJung-uk Kim
145*b077aed3SPierre Pronchery=item B<-extra-I<cmd>> I<parameter>
146e71b7053SJung-uk Kim
147*b077aed3SPierre ProncheryFor each option B<extra-I<cmd>>, pass I<parameter> to the L<openssl(1)>
148*b077aed3SPierre Proncherysub-command with the same name as I<cmd>, if that sub-command is invoked.
149*b077aed3SPierre ProncheryFor example, if L<openssl-req(1)> is invoked, the I<parameter> given with
150*b077aed3SPierre ProncheryB<-extra-req> will be passed to it.
151*b077aed3SPierre ProncheryFor multi-word parameters, either repeat the option or quote the I<parameters>
152*b077aed3SPierre Proncheryso it looks like one word to your shell.
153*b077aed3SPierre ProncherySee the individual command documentation for more information.
154e71b7053SJung-uk Kim
155e71b7053SJung-uk Kim=back
156e71b7053SJung-uk Kim
157e71b7053SJung-uk Kim=head1 EXAMPLES
158e71b7053SJung-uk Kim
159e71b7053SJung-uk KimCreate a CA hierarchy:
160e71b7053SJung-uk Kim
161e71b7053SJung-uk Kim CA.pl -newca
162e71b7053SJung-uk Kim
163e71b7053SJung-uk KimComplete certificate creation example: create a CA, create a request, sign
164e71b7053SJung-uk Kimthe request and finally create a PKCS#12 file containing it.
165e71b7053SJung-uk Kim
166e71b7053SJung-uk Kim CA.pl -newca
167e71b7053SJung-uk Kim CA.pl -newreq
16858f35182SJung-uk Kim CA.pl -sign
169e71b7053SJung-uk Kim CA.pl -pkcs12 "My Test Certificate"
170e71b7053SJung-uk Kim
171*b077aed3SPierre Pronchery=head1 ENVIRONMENT
172e71b7053SJung-uk Kim
173*b077aed3SPierre ProncheryThe environment variable B<OPENSSL> may be used to specify the name of
174*b077aed3SPierre Proncherythe OpenSSL program. It can be a full pathname, or a relative one.
175e71b7053SJung-uk Kim
176*b077aed3SPierre ProncheryThe environment variable B<OPENSSL_CONFIG> may be used to specify a
177*b077aed3SPierre Proncheryconfiguration option and value to the B<req> and B<ca> commands invoked by
178*b077aed3SPierre Proncherythis script. It's value should be the option and pathname, as in
179*b077aed3SPierre ProncheryC<-config /path/to/conf-file>.
180e71b7053SJung-uk Kim
181e71b7053SJung-uk Kim=head1 SEE ALSO
182e71b7053SJung-uk Kim
183*b077aed3SPierre ProncheryL<openssl(1)>,
184*b077aed3SPierre ProncheryL<openssl-x509(1)>,
185*b077aed3SPierre ProncheryL<openssl-ca(1)>,
186*b077aed3SPierre ProncheryL<openssl-req(1)>,
187*b077aed3SPierre ProncheryL<openssl-pkcs12(1)>,
188e71b7053SJung-uk KimL<config(5)>
189e71b7053SJung-uk Kim
190e71b7053SJung-uk Kim=head1 COPYRIGHT
191e71b7053SJung-uk Kim
192*b077aed3SPierre ProncheryCopyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.
193e71b7053SJung-uk Kim
194*b077aed3SPierre ProncheryLicensed under the Apache License 2.0 (the "License").  You may not use
195e71b7053SJung-uk Kimthis file except in compliance with the License.  You can obtain a copy
196e71b7053SJung-uk Kimin the file LICENSE in the source distribution or at
197e71b7053SJung-uk KimL<https://www.openssl.org/source/license.html>.
198e71b7053SJung-uk Kim
199e71b7053SJung-uk Kim=cut
200