1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
|
.\" -*- mode: troff; coding: utf-8 -*-
.\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
.ie n \{\
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is >0, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{\
. if \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{\
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\" ========================================================================
.\"
.IX Title "CA.PL 1ssl"
.TH CA.PL 1ssl 2024-04-28 3.3.0 OpenSSL
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH NAME
CA.pl \- friendlier interface for OpenSSL certificate programs
.SH SYNOPSIS
.IX Header "SYNOPSIS"
\&\fBCA.pl\fR
\&\fB\-?\fR |
\&\fB\-h\fR |
\&\fB\-help\fR
.PP
\&\fBCA.pl\fR
\&\fB\-newcert\fR |
\&\fB\-newreq\fR |
\&\fB\-newreq\-nodes\fR |
\&\fB\-xsign\fR |
\&\fB\-sign\fR |
\&\fB\-signCA\fR |
\&\fB\-signcert\fR |
\&\fB\-crl\fR |
\&\fB\-newca\fR
[\fB\-extra\-\fR\f(BIcmd\fR \fIparameter\fR]
.PP
\&\fBCA.pl\fR \fB\-pkcs12\fR [\fIcertname\fR]
.PP
\&\fBCA.pl\fR \fB\-verify\fR \fIcertfile\fR ...
.PP
\&\fBCA.pl\fR \fB\-revoke\fR \fIcertfile\fR [\fIreason\fR]
.SH DESCRIPTION
.IX Header "DESCRIPTION"
The \fBCA.pl\fR script is a perl script that supplies the relevant command line
arguments to the \fBopenssl\fR\|(1) command for some common certificate operations.
It is intended to simplify the process of certificate creation and management
by the use of some simple options.
.PP
The script is intended as a simple front end for the \fBopenssl\fR\|(1) program for
use by a beginner. Its behaviour isn't always what is wanted. For more control
over the behaviour of the certificate commands call the \fBopenssl\fR\|(1) command
directly.
.PP
Most of the filenames mentioned below can be modified by editing the
\&\fBCA.pl\fR script.
.PP
Under some environments it may not be possible to run the \fBCA.pl\fR script
directly (for example Win32) and the default configuration file location may
be wrong. In this case the command:
.PP
.Vb 1
\& perl \-S CA.pl
.Ve
.PP
can be used and the \fBOPENSSL_CONF\fR environment variable can be set to point to
the correct path of the configuration file.
.SH OPTIONS
.IX Header "OPTIONS"
.IP "\fB\-?\fR, \fB\-h\fR, \fB\-help\fR" 4
.IX Item "-?, -h, -help"
Prints a usage message.
.IP \fB\-newcert\fR 4
.IX Item "-newcert"
Creates a new self signed certificate. The private key is written to the file
\&\fInewkey.pem\fR and the request written to the file \fInewreq.pem\fR.
Invokes \fBopenssl\-req\fR\|(1).
.IP \fB\-newreq\fR 4
.IX Item "-newreq"
Creates a new certificate request. The private key is written to the file
\&\fInewkey.pem\fR and the request written to the file \fInewreq.pem\fR.
Executes \fBopenssl\-req\fR\|(1) under the hood.
.IP \fB\-newreq\-nodes\fR 4
.IX Item "-newreq-nodes"
Is like \fB\-newreq\fR except that the private key will not be encrypted.
Uses \fBopenssl\-req\fR\|(1).
.IP \fB\-newca\fR 4
.IX Item "-newca"
Creates a new CA hierarchy for use with the \fBca\fR program (or the \fB\-signcert\fR
and \fB\-xsign\fR options). The user is prompted to enter the filename of the CA
certificates (which should also contain the private key) or by hitting ENTER
details of the CA will be prompted for. The relevant files and directories
are created in a directory called \fIdemoCA\fR in the current directory.
Uses \fBopenssl\-req\fR\|(1) and \fBopenssl\-ca\fR\|(1).
.Sp
If the \fIdemoCA\fR directory already exists then the \fB\-newca\fR command will not
overwrite it and will do nothing. This can happen if a previous call using
the \fB\-newca\fR option terminated abnormally. To get the correct behaviour
delete the directory if it already exists.
.IP \fB\-pkcs12\fR 4
.IX Item "-pkcs12"
Create a PKCS#12 file containing the user certificate, private key and CA
certificate. It expects the user certificate and private key to be in the
file \fInewcert.pem\fR and the CA certificate to be in the file \fIdemoCA/cacert.pem\fR,
it creates a file \fInewcert.p12\fR. This command can thus be called after the
\&\fB\-sign\fR option. The PKCS#12 file can be imported directly into a browser.
If there is an additional argument on the command line it will be used as the
"friendly name" for the certificate (which is typically displayed in the browser
list box), otherwise the name "My Certificate" is used.
Delegates work to \fBopenssl\-pkcs12\fR\|(1).
.IP "\fB\-sign\fR, \fB\-signcert\fR, \fB\-xsign\fR" 4
.IX Item "-sign, -signcert, -xsign"
Calls the \fBopenssl\-ca\fR\|(1) command to sign a certificate request. It expects the
request to be in the file \fInewreq.pem\fR. The new certificate is written to the
file \fInewcert.pem\fR except in the case of the \fB\-xsign\fR option when it is
written to standard output.
.IP \fB\-signCA\fR 4
.IX Item "-signCA"
This option is the same as the \fB\-sign\fR option except it uses the
configuration file section \fBv3_ca\fR and so makes the signed request a
valid CA certificate. This is useful when creating intermediate CA from
a root CA. Extra params are passed to \fBopenssl\-ca\fR\|(1).
.IP \fB\-signcert\fR 4
.IX Item "-signcert"
This option is the same as \fB\-sign\fR except it expects a self signed certificate
to be present in the file \fInewreq.pem\fR.
Extra params are passed to \fBopenssl\-x509\fR\|(1) and \fBopenssl\-ca\fR\|(1).
.IP \fB\-crl\fR 4
.IX Item "-crl"
Generate a CRL. Executes \fBopenssl\-ca\fR\|(1).
.IP "\fB\-revoke\fR \fIcertfile\fR [\fIreason\fR]" 4
.IX Item "-revoke certfile [reason]"
Revoke the certificate contained in the specified \fBcertfile\fR. An optional
reason may be specified, and must be one of: \fBunspecified\fR,
\&\fBkeyCompromise\fR, \fBCACompromise\fR, \fBaffiliationChanged\fR, \fBsuperseded\fR,
\&\fBcessationOfOperation\fR, \fBcertificateHold\fR, or \fBremoveFromCRL\fR.
Leverages \fBopenssl\-ca\fR\|(1).
.IP \fB\-verify\fR 4
.IX Item "-verify"
Verifies certificates against the CA certificate for \fIdemoCA\fR. If no
certificates are specified on the command line it tries to verify the file
\&\fInewcert.pem\fR. Invokes \fBopenssl\-verify\fR\|(1).
.IP "\fB\-extra\-\fR\f(BIcmd\fR \fIparameter\fR" 4
.IX Item "-extra-cmd parameter"
For each option \fBextra\-\fR\f(BIcmd\fR, pass \fIparameter\fR to the \fBopenssl\fR\|(1)
sub-command with the same name as \fIcmd\fR, if that sub-command is invoked.
For example, if \fBopenssl\-req\fR\|(1) is invoked, the \fIparameter\fR given with
\&\fB\-extra\-req\fR will be passed to it.
For multi-word parameters, either repeat the option or quote the \fIparameters\fR
so it looks like one word to your shell.
See the individual command documentation for more information.
.SH EXAMPLES
.IX Header "EXAMPLES"
Create a CA hierarchy:
.PP
.Vb 1
\& CA.pl \-newca
.Ve
.PP
Complete certificate creation example: create a CA, create a request, sign
the request and finally create a PKCS#12 file containing it.
.PP
.Vb 4
\& CA.pl \-newca
\& CA.pl \-newreq
\& CA.pl \-sign
\& CA.pl \-pkcs12 "My Test Certificate"
.Ve
.SH ENVIRONMENT
.IX Header "ENVIRONMENT"
The environment variable \fBOPENSSL\fR may be used to specify the name of
the OpenSSL program. It can be a full pathname, or a relative one.
.PP
The environment variable \fBOPENSSL_CONFIG\fR may be used to specify a
configuration option and value to the \fBreq\fR and \fBca\fR commands invoked by
this script. It's value should be the option and pathname, as in
\&\f(CW\*(C`\-config /path/to/conf\-file\*(C'\fR.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
\&\fBopenssl\fR\|(1),
\&\fBopenssl\-x509\fR\|(1),
\&\fBopenssl\-ca\fR\|(1),
\&\fBopenssl\-req\fR\|(1),
\&\fBopenssl\-pkcs12\fR\|(1),
\&\fBconfig\fR\|(5)
.SH COPYRIGHT
.IX Header "COPYRIGHT"
Copyright 2000\-2021 The OpenSSL Project Authors. All Rights Reserved.
.PP
Licensed under the Apache License 2.0 (the "License"). You may not use
this file except in compliance with the License. You can obtain a copy
in the file LICENSE in the source distribution or at
<https://www.openssl.org/source/license.html>.
|