CA.pl.pod revision 1.1 1 1.1 christos =pod
2 1.1 christos
3 1.1 christos =head1 NAME
4 1.1 christos
5 1.1 christos CA.pl - friendlier interface for OpenSSL certificate programs
6 1.1 christos
7 1.1 christos =head1 SYNOPSIS
8 1.1 christos
9 1.1 christos B<CA.pl>
10 1.1 christos B<-?> |
11 1.1 christos B<-h> |
12 1.1 christos B<-help>
13 1.1 christos
14 1.1 christos B<CA.pl>
15 1.1 christos B<-newcert> |
16 1.1 christos B<-newreq> |
17 1.1 christos B<-newreq-nodes> |
18 1.1 christos B<-xsign> |
19 1.1 christos B<-sign> |
20 1.1 christos B<-signCA> |
21 1.1 christos B<-signcert> |
22 1.1 christos B<-crl> |
23 1.1 christos B<-newca>
24 1.1 christos [B<-extra-cmd> extra-params]
25 1.1 christos
26 1.1 christos B<CA.pl> B<-pkcs12> [B<-extra-pkcs12> extra-params] [B<certname>]
27 1.1 christos
28 1.1 christos B<CA.pl> B<-verify> [B<-extra-verify> extra-params] B<certfile>...
29 1.1 christos
30 1.1 christos B<CA.pl> B<-revoke> [B<-extra-ca> extra-params] B<certfile> [B<reason>]
31 1.1 christos
32 1.1 christos =head1 DESCRIPTION
33 1.1 christos
34 1.1 christos The B<CA.pl> script is a perl script that supplies the relevant command line
35 1.1 christos arguments to the B<openssl> command for some common certificate operations.
36 1.1 christos It is intended to simplify the process of certificate creation and management
37 1.1 christos by the use of some simple options.
38 1.1 christos
39 1.1 christos =head1 OPTIONS
40 1.1 christos
41 1.1 christos =over 4
42 1.1 christos
43 1.1 christos =item B<?>, B<-h>, B<-help>
44 1.1 christos
45 1.1 christos Prints a usage message.
46 1.1 christos
47 1.1 christos =item B<-newcert>
48 1.1 christos
49 1.1 christos Creates a new self signed certificate. The private key is written to the file
50 1.1 christos "newkey.pem" and the request written to the file "newreq.pem".
51 1.1 christos This argument invokes B<openssl req> command.
52 1.1 christos
53 1.1 christos =item B<-newreq>
54 1.1 christos
55 1.1 christos Creates a new certificate request. The private key is written to the file
56 1.1 christos "newkey.pem" and the request written to the file "newreq.pem".
57 1.1 christos Executes B<openssl req> command below the hood.
58 1.1 christos
59 1.1 christos =item B<-newreq-nodes>
60 1.1 christos
61 1.1 christos Is like B<-newreq> except that the private key will not be encrypted.
62 1.1 christos Uses B<openssl req> command.
63 1.1 christos
64 1.1 christos =item B<-newca>
65 1.1 christos
66 1.1 christos Creates a new CA hierarchy for use with the B<ca> program (or the B<-signcert>
67 1.1 christos and B<-xsign> options). The user is prompted to enter the filename of the CA
68 1.1 christos certificates (which should also contain the private key) or by hitting ENTER
69 1.1 christos details of the CA will be prompted for. The relevant files and directories
70 1.1 christos are created in a directory called "demoCA" in the current directory.
71 1.1 christos B<openssl req> and B<openssl ca> commands are get invoked.
72 1.1 christos
73 1.1 christos =item B<-pkcs12>
74 1.1 christos
75 1.1 christos Create a PKCS#12 file containing the user certificate, private key and CA
76 1.1 christos certificate. It expects the user certificate and private key to be in the
77 1.1 christos file "newcert.pem" and the CA certificate to be in the file demoCA/cacert.pem,
78 1.1 christos it creates a file "newcert.p12". This command can thus be called after the
79 1.1 christos B<-sign> option. The PKCS#12 file can be imported directly into a browser.
80 1.1 christos If there is an additional argument on the command line it will be used as the
81 1.1 christos "friendly name" for the certificate (which is typically displayed in the browser
82 1.1 christos list box), otherwise the name "My Certificate" is used.
83 1.1 christos Delegates work to B<openssl pkcs12> command.
84 1.1 christos
85 1.1 christos =item B<-sign>, B<-signcert>, B<-xsign>
86 1.1 christos
87 1.1 christos Calls the B<ca> program to sign a certificate request. It expects the request
88 1.1 christos to be in the file "newreq.pem". The new certificate is written to the file
89 1.1 christos "newcert.pem" except in the case of the B<-xsign> option when it is written
90 1.1 christos to standard output. Leverages B<openssl ca> command.
91 1.1 christos
92 1.1 christos =item B<-signCA>
93 1.1 christos
94 1.1 christos This option is the same as the B<-sign> option except it uses the
95 1.1 christos configuration file section B<v3_ca> and so makes the signed request a
96 1.1 christos valid CA certificate. This is useful when creating intermediate CA from
97 1.1 christos a root CA. Extra params are passed on to B<openssl ca> command.
98 1.1 christos
99 1.1 christos =item B<-signcert>
100 1.1 christos
101 1.1 christos This option is the same as B<-sign> except it expects a self signed certificate
102 1.1 christos to be present in the file "newreq.pem".
103 1.1 christos Extra params are passed on to B<openssl x509> and B<openssl ca> commands.
104 1.1 christos
105 1.1 christos =item B<-crl>
106 1.1 christos
107 1.1 christos Generate a CRL. Executes B<openssl ca> command.
108 1.1 christos
109 1.1 christos =item B<-revoke certfile [reason]>
110 1.1 christos
111 1.1 christos Revoke the certificate contained in the specified B<certfile>. An optional
112 1.1 christos reason may be specified, and must be one of: B<unspecified>,
113 1.1 christos B<keyCompromise>, B<CACompromise>, B<affiliationChanged>, B<superseded>,
114 1.1 christos B<cessationOfOperation>, B<certificateHold>, or B<removeFromCRL>.
115 1.1 christos Leverages B<openssl ca> command.
116 1.1 christos
117 1.1 christos =item B<-verify>
118 1.1 christos
119 1.1 christos Verifies certificates against the CA certificate for "demoCA". If no
120 1.1 christos certificates are specified on the command line it tries to verify the file
121 1.1 christos "newcert.pem". Invokes B<openssl verify> command.
122 1.1 christos
123 1.1 christos =item B<-extra-req> | B<-extra-ca> | B<-extra-pkcs12> | B<-extra-x509> | B<-extra-verify> <extra-params>
124 1.1 christos
125 1.1 christos The purpose of these parameters is to allow optional parameters to be supplied
126 1.1 christos to B<openssl> that this command executes. The B<-extra-cmd> are specific to the
127 1.1 christos option being used and the B<openssl> command getting invoked. For example
128 1.1 christos when this command invokes B<openssl req> extra parameters can be passed on
129 1.1 christos with the B<-extra-req> parameter. The
130 1.1 christos B<openssl> commands being invoked per option are documented below.
131 1.1 christos Users should consult B<openssl> command documentation for more information.
132 1.1 christos
133 1.1 christos =back
134 1.1 christos
135 1.1 christos =head1 EXAMPLES
136 1.1 christos
137 1.1 christos Create a CA hierarchy:
138 1.1 christos
139 1.1 christos CA.pl -newca
140 1.1 christos
141 1.1 christos Complete certificate creation example: create a CA, create a request, sign
142 1.1 christos the request and finally create a PKCS#12 file containing it.
143 1.1 christos
144 1.1 christos CA.pl -newca
145 1.1 christos CA.pl -newreq
146 1.1 christos CA.pl -sign
147 1.1 christos CA.pl -pkcs12 "My Test Certificate"
148 1.1 christos
149 1.1 christos =head1 DSA CERTIFICATES
150 1.1 christos
151 1.1 christos Although the B<CA.pl> creates RSA CAs and requests it is still possible to
152 1.1 christos use it with DSA certificates and requests using the L<req(1)> command
153 1.1 christos directly. The following example shows the steps that would typically be taken.
154 1.1 christos
155 1.1 christos Create some DSA parameters:
156 1.1 christos
157 1.1 christos openssl dsaparam -out dsap.pem 1024
158 1.1 christos
159 1.1 christos Create a DSA CA certificate and private key:
160 1.1 christos
161 1.1 christos openssl req -x509 -newkey dsa:dsap.pem -keyout cacert.pem -out cacert.pem
162 1.1 christos
163 1.1 christos Create the CA directories and files:
164 1.1 christos
165 1.1 christos CA.pl -newca
166 1.1 christos
167 1.1 christos enter cacert.pem when prompted for the CA filename.
168 1.1 christos
169 1.1 christos Create a DSA certificate request and private key (a different set of parameters
170 1.1 christos can optionally be created first):
171 1.1 christos
172 1.1 christos openssl req -out newreq.pem -newkey dsa:dsap.pem
173 1.1 christos
174 1.1 christos Sign the request:
175 1.1 christos
176 1.1 christos CA.pl -sign
177 1.1 christos
178 1.1 christos =head1 NOTES
179 1.1 christos
180 1.1 christos Most of the filenames mentioned can be modified by editing the B<CA.pl> script.
181 1.1 christos
182 1.1 christos If the demoCA directory already exists then the B<-newca> command will not
183 1.1 christos overwrite it and will do nothing. This can happen if a previous call using
184 1.1 christos the B<-newca> option terminated abnormally. To get the correct behaviour
185 1.1 christos delete the demoCA directory if it already exists.
186 1.1 christos
187 1.1 christos Under some environments it may not be possible to run the B<CA.pl> script
188 1.1 christos directly (for example Win32) and the default configuration file location may
189 1.1 christos be wrong. In this case the command:
190 1.1 christos
191 1.1 christos perl -S CA.pl
192 1.1 christos
193 1.1 christos can be used and the B<OPENSSL_CONF> environment variable changed to point to
194 1.1 christos the correct path of the configuration file.
195 1.1 christos
196 1.1 christos The script is intended as a simple front end for the B<openssl> program for use
197 1.1 christos by a beginner. Its behaviour isn't always what is wanted. For more control over the
198 1.1 christos behaviour of the certificate commands call the B<openssl> command directly.
199 1.1 christos
200 1.1 christos =head1 SEE ALSO
201 1.1 christos
202 1.1 christos L<x509(1)>, L<ca(1)>, L<req(1)>, L<pkcs12(1)>,
203 1.1 christos L<config(5)>
204 1.1 christos
205 1.1 christos =head1 COPYRIGHT
206 1.1 christos
207 1.1 christos Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.
208 1.1 christos
209 1.1 christos Licensed under the OpenSSL license (the "License"). You may not use
210 1.1 christos this file except in compliance with the License. You can obtain a copy
211 1.1 christos in the file LICENSE in the source distribution or at
212 1.1 christos L<https://www.openssl.org/source/license.html>.
213 1.1 christos
214 1.1 christos =cut
215