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