5 CA.pl - friendlier interface for OpenSSL certificate programs
24 [B<-extra-I<cmd>> I<parameter>]
26 B<CA.pl> B<-pkcs12> [B<-extra-pkcs12> I<parameter>] [I<certname>]
28 B<CA.pl> B<-verify> [B<-extra-verify> I<parameter>] I<certfile> ...
30 B<CA.pl> B<-revoke> [B<-extra-ca> I<parameter>] I<certfile> [I<reason>]
34 The B<CA.pl> script is a perl script that supplies the relevant command line
35 arguments to the L<openssl(1)> command for some common certificate operations.
36 It is intended to simplify the process of certificate creation and management
37 by the use of some simple options.
39 The script is intended as a simple front end for the L<openssl(1)> program for
40 use by a beginner. Its behaviour isn't always what is wanted. For more control
41 over the behaviour of the certificate commands call the L<openssl(1)> command
44 Most of the filenames mentioned below can be modified by editing the
47 Under some environments it may not be possible to run the B<CA.pl> script
48 directly (for example Win32) and the default configuration file location may
49 be wrong. In this case the command:
53 can be used and the B<OPENSSL_CONF> environment variable can be set to point to
54 the correct path of the configuration file.
60 =item B<?>, B<-h>, B<-help>
62 Prints a usage message.
66 Creates a new self signed certificate. The private key is written to the file
67 F<newkey.pem> and the request written to the file F<newreq.pem>.
68 Invokes L<openssl-req(1)>.
72 Creates a new certificate request. The private key is written to the file
73 F<newkey.pem> and the request written to the file F<newreq.pem>.
74 Executes L<openssl-req(1)> under the hood.
76 =item B<-newreq-nodes>
78 Is like B<-newreq> except that the private key will not be encrypted.
79 Uses L<openssl-req(1)>.
83 Creates a new CA hierarchy for use with the B<ca> program (or the B<-signcert>
84 and B<-xsign> options). The user is prompted to enter the filename of the CA
85 certificates (which should also contain the private key) or by hitting ENTER
86 details of the CA will be prompted for. The relevant files and directories
87 are created in a directory called F<demoCA> in the current directory.
88 Uses L<openssl-req(1)> and L<openssl-ca(1)>.
90 If the F<demoCA> directory already exists then the B<-newca> command will not
91 overwrite it and will do nothing. This can happen if a previous call using
92 the B<-newca> option terminated abnormally. To get the correct behaviour
93 delete the directory if it already exists.
97 Create a PKCS#12 file containing the user certificate, private key and CA
98 certificate. It expects the user certificate and private key to be in the
99 file F<newcert.pem> and the CA certificate to be in the file F<demoCA/cacert.pem>,
100 it creates a file F<newcert.p12>. This command can thus be called after the
101 B<-sign> option. The PKCS#12 file can be imported directly into a browser.
102 If there is an additional argument on the command line it will be used as the
103 "friendly name" for the certificate (which is typically displayed in the browser
104 list box), otherwise the name "My Certificate" is used.
105 Delegates work to L<openssl-pkcs12(1)>.
107 =item B<-sign>, B<-signcert>, B<-xsign>
109 Calls the L<openssl-ca(1)> command to sign a certificate request. It expects the
110 request to be in the file F<newreq.pem>. The new certificate is written to the
111 file F<newcert.pem> except in the case of the B<-xsign> option when it is
112 written to standard output.
116 This option is the same as the B<-sign> option except it uses the
117 configuration file section B<v3_ca> and so makes the signed request a
118 valid CA certificate. This is useful when creating intermediate CA from
119 a root CA. Extra params are passed to L<openssl-ca(1)>.
123 This option is the same as B<-sign> except it expects a self signed certificate
124 to be present in the file F<newreq.pem>.
125 Extra params are passed to L<openssl-x509(1)> and L<openssl-ca(1)>.
129 Generate a CRL. Executes L<openssl-ca(1)>.
131 =item B<-revoke> I<certfile> [I<reason>]
133 Revoke the certificate contained in the specified B<certfile>. An optional
134 reason may be specified, and must be one of: B<unspecified>,
135 B<keyCompromise>, B<CACompromise>, B<affiliationChanged>, B<superseded>,
136 B<cessationOfOperation>, B<certificateHold>, or B<removeFromCRL>.
137 Leverages L<openssl-ca(1)>.
141 Verifies certificates against the CA certificate for F<demoCA>. If no
142 certificates are specified on the command line it tries to verify the file
143 F<newcert.pem>. Invokes L<openssl-verify(1)>.
145 =item B<-extra-I<cmd>> I<parameter>
147 For each option B<extra-I<cmd>>, pass I<parameter> to the L<openssl(1)>
148 sub-command with the same name as I<cmd>, if that sub-command is invoked.
149 For example, if L<openssl-req(1)> is invoked, the I<parameter> given with
150 B<-extra-req> will be passed to it.
151 For multi-word parameters, either repeat the option or quote the I<parameters>
152 so it looks like one word to your shell.
153 See the individual command documentation for more information.
159 Create a CA hierarchy:
163 Complete certificate creation example: create a CA, create a request, sign
164 the request and finally create a PKCS#12 file containing it.
169 CA.pl -pkcs12 "My Test Certificate"
173 The environment variable B<OPENSSL> may be used to specify the name of
174 the OpenSSL program. It can be a full pathname, or a relative one.
176 The environment variable B<OPENSSL_CONFIG> may be used to specify a
177 configuration option and value to the B<req> and B<ca> commands invoked by
178 this script. It's value should be the option and pathname, as in
179 C<-config /path/to/conf-file>.
187 L<openssl-pkcs12(1)>,
192 Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.
194 Licensed under the Apache License 2.0 (the "License"). You may not use
195 this file except in compliance with the License. You can obtain a copy
196 in the file LICENSE in the source distribution or at
197 L<https://www.openssl.org/source/license.html>.