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] [-newcert] [-newreq] [-newreq-nodes] [-newca]
10 [-xsign] [-sign] [-signreq] [-signcert] [-verify] [files]
11
13 The CA.pl script is a perl script that supplies the relevant command
14 line arguments to the openssl command for some common certificate
15 operations. It is intended to simplify the process of certificate
16 creation and management by the use of some simple options.
17
19 ?, -h, -help
20 prints a usage message.
21
22 -newcert
23 creates a new self signed certificate. The private key is written
24 to the file "newkey.pem" and the request written to the file
25 "newreq.pem".
26
27 -newreq
28 creates a new certificate request. The private key is written to
29 the file "newkey.pem" and the request written to the file
30 "newreq.pem".
31
32 -newreq-nodes
33 is like -newreq except that the private key will not be encrypted.
34
35 -newca
36 creates a new CA hierarchy for use with the ca program (or the
37 -signcert and -xsign options). The user is prompted to enter the
38 filename of the CA certificates (which should also contain the
39 private key) or by hitting ENTER details of the CA will be prompted
40 for. The relevant files and directories are created in a directory
41 called "demoCA" in the current directory.
42
43 -pkcs12
44 create a PKCS#12 file containing the user certificate, private key
45 and CA certificate. It expects the user certificate and private key
46 to be in the file "newcert.pem" and the CA certificate to be in the
47 file demoCA/cacert.pem, it creates a file "newcert.p12". This
48 command can thus be called after the -sign option. The PKCS#12 file
49 can be imported directly into a browser. If there is an additional
50 argument on the command line it will be used as the "friendly name"
51 for the certificate (which is typically displayed in the browser
52 list box), otherwise the name "My Certificate" is used.
53
54 -sign, -signreq, -xsign
55 calls the ca program to sign a certificate request. It expects the
56 request to be in the file "newreq.pem". The new certificate is
57 written to the file "newcert.pem" except in the case of the -xsign
58 option when it is written to standard output.
59
60 -signCA
61 this option is the same as the -signreq option except it uses the
62 configuration file section v3_ca and so makes the signed request a
63 valid CA certificate. This is useful when creating intermediate CA
64 from a root CA.
65
66 -signcert
67 this option is the same as -sign except it expects a self signed
68 certificate to be present in the file "newreq.pem".
69
70 -verify
71 verifies certificates against the CA certificate for "demoCA". If
72 no certificates are specified on the command line it tries to
73 verify the file "newcert.pem".
74
75 files
76 one or more optional certificate file names for use with the
77 -verify command.
78
80 Create a CA hierarchy:
81
82 CA.pl -newca
83
84 Complete certificate creation example: create a CA, create a request,
85 sign the request and finally create a PKCS#12 file containing it.
86
87 CA.pl -newca
88 CA.pl -newreq
89 CA.pl -signreq
90 CA.pl -pkcs12 "My Test Certificate"
91
93 Although the CA.pl creates RSA CAs and requests it is still possible to
94 use it with DSA certificates and requests using the req(1) command
95 directly. The following example shows the steps that would typically be
96 taken.
97
98 Create some DSA parameters:
99
100 openssl dsaparam -out dsap.pem 1024
101
102 Create a DSA CA certificate and private key:
103
104 openssl req -x509 -newkey dsa:dsap.pem -keyout cacert.pem -out cacert.pem
105
106 Create the CA directories and files:
107
108 CA.pl -newca
109
110 enter cacert.pem when prompted for the CA file name.
111
112 Create a DSA certificate request and private key (a different set of
113 parameters can optionally be created first):
114
115 openssl req -out newreq.pem -newkey dsa:dsap.pem
116
117 Sign the request:
118
119 CA.pl -signreq
120
122 Most of the filenames mentioned can be modified by editing the CA.pl
123 script.
124
125 If the demoCA directory already exists then the -newca command will not
126 overwrite it and will do nothing. This can happen if a previous call
127 using the -newca option terminated abnormally. To get the correct
128 behaviour delete the demoCA directory if it already exists.
129
130 Under some environments it may not be possible to run the CA.pl script
131 directly (for example Win32) and the default configuration file
132 location may be wrong. In this case the command:
133
134 perl -S CA.pl
135
136 can be used and the OPENSSL_CONF environment variable changed to point
137 to the correct path of the configuration file "openssl.cnf".
138
139 The script is intended as a simple front end for the openssl program
140 for use by a beginner. Its behaviour isn't always what is wanted. For
141 more control over the behaviour of the certificate commands call the
142 openssl command directly.
143
145 The variable OPENSSL_CONF if defined allows an alternative
146 configuration file location to be specified, it should contain the full
147 path to the configuration file, not just its directory.
148
150 x509(1), ca(1), req(1), pkcs12(1), config(5)
151
152
153
1541.0.2k 2017-01-26 CA.PL(1)