6cdcd26a3154811736cc3637f7a28125f87fce8a
[dragonfly.git] / secure / usr.bin / openssl / man / CA.pl.1
1 .\" Automatically generated by Pod::Man version 1.15
2 .\" Wed Feb 19 16:49:30 2003
3 .\"
4 .\" Standard preamble:
5 .\" ======================================================================
6 .de Sh \" Subsection heading
7 .br
8 .if t .Sp
9 .ne 5
10 .PP
11 \fB\\$1\fR
12 .PP
13 ..
14 .de Sp \" Vertical space (when we can't use .PP)
15 .if t .sp .5v
16 .if n .sp
17 ..
18 .de Ip \" List item
19 .br
20 .ie \\n(.$>=3 .ne \\$3
21 .el .ne 3
22 .IP "\\$1" \\$2
23 ..
24 .de Vb \" Begin verbatim text
25 .ft CW
26 .nf
27 .ne \\$1
28 ..
29 .de Ve \" End verbatim text
30 .ft R
31
32 .fi
33 ..
34 .\" Set up some character translations and predefined strings.  \*(-- will
35 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
36 .\" double quote, and \*(R" will give a right double quote.  | will give a
37 .\" real vertical bar.  \*(C+ will give a nicer C++.  Capital omega is used
38 .\" to do unbreakable dashes and therefore won't be available.  \*(C` and
39 .\" \*(C' expand to `' in nroff, nothing in troff, for use with C<>
40 .tr \(*W-|\(bv\*(Tr
41 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
42 .ie n \{\
43 .    ds -- \(*W-
44 .    ds PI pi
45 .    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
46 .    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
47 .    ds L" ""
48 .    ds R" ""
49 .    ds C` ""
50 .    ds C' ""
51 'br\}
52 .el\{\
53 .    ds -- \|\(em\|
54 .    ds PI \(*p
55 .    ds L" ``
56 .    ds R" ''
57 'br\}
58 .\"
59 .\" If the F register is turned on, we'll generate index entries on stderr
60 .\" for titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and
61 .\" index entries marked with X<> in POD.  Of course, you'll have to process
62 .\" the output yourself in some meaningful fashion.
63 .if \nF \{\
64 .    de IX
65 .    tm Index:\\$1\t\\n%\t"\\$2"
66 ..
67 .    nr % 0
68 .    rr F
69 .\}
70 .\"
71 .\" For nroff, turn off justification.  Always turn off hyphenation; it
72 .\" makes way too many mistakes in technical documents.
73 .hy 0
74 .if n .na
75 .\"
76 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
77 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
78 .bd B 3
79 .    \" fudge factors for nroff and troff
80 .if n \{\
81 .    ds #H 0
82 .    ds #V .8m
83 .    ds #F .3m
84 .    ds #[ \f1
85 .    ds #] \fP
86 .\}
87 .if t \{\
88 .    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
89 .    ds #V .6m
90 .    ds #F 0
91 .    ds #[ \&
92 .    ds #] \&
93 .\}
94 .    \" simple accents for nroff and troff
95 .if n \{\
96 .    ds ' \&
97 .    ds ` \&
98 .    ds ^ \&
99 .    ds , \&
100 .    ds ~ ~
101 .    ds /
102 .\}
103 .if t \{\
104 .    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
105 .    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
106 .    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
107 .    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
108 .    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
109 .    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
110 .\}
111 .    \" troff and (daisy-wheel) nroff accents
112 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
113 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
114 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
115 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
116 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
117 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
118 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
119 .ds ae a\h'-(\w'a'u*4/10)'e
120 .ds Ae A\h'-(\w'A'u*4/10)'E
121 .    \" corrections for vroff
122 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
123 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
124 .    \" for low resolution devices (crt and lpr)
125 .if \n(.H>23 .if \n(.V>19 \
126 \{\
127 .    ds : e
128 .    ds 8 ss
129 .    ds o a
130 .    ds d- d\h'-1'\(ga
131 .    ds D- D\h'-1'\(hy
132 .    ds th \o'bp'
133 .    ds Th \o'LP'
134 .    ds ae ae
135 .    ds Ae AE
136 .\}
137 .rm #[ #] #H #V #F C
138 .\" ======================================================================
139 .\"
140 .IX Title "CA.PL 1"
141 .TH CA.PL 1 "0.9.7a" "2003-02-19" "OpenSSL"
142 .UC
143 .SH "NAME"
144 \&\s-1CA\s0.pl \- friendlier interface for OpenSSL certificate programs
145 .SH "SYNOPSIS"
146 .IX Header "SYNOPSIS"
147 \&\fB\s-1CA\s0.pl\fR
148 [\fB\-?\fR]
149 [\fB\-h\fR]
150 [\fB\-help\fR]
151 [\fB\-newcert\fR]
152 [\fB\-newreq\fR]
153 [\fB\-newreq-nodes\fR]
154 [\fB\-newca\fR]
155 [\fB\-xsign\fR]
156 [\fB\-sign\fR]
157 [\fB\-signreq\fR]
158 [\fB\-signcert\fR]
159 [\fB\-verify\fR]
160 [\fBfiles\fR]
161 .SH "DESCRIPTION"
162 .IX Header "DESCRIPTION"
163 The \fB\s-1CA\s0.pl\fR script is a perl script that supplies the relevant command line
164 arguments to the \fBopenssl\fR command for some common certificate operations.
165 It is intended to simplify the process of certificate creation and management
166 by the use of some simple options.
167 .SH "COMMAND OPTIONS"
168 .IX Header "COMMAND OPTIONS"
169 .Ip "\fB?\fR, \fB\-h\fR, \fB\-help\fR" 4
170 .IX Item "?, -h, -help"
171 prints a usage message.
172 .Ip "\fB\-newcert\fR" 4
173 .IX Item "-newcert"
174 creates a new self signed certificate. The private key and certificate are
175 written to the file \*(L"newreq.pem\*(R".
176 .Ip "\fB\-newreq\fR" 4
177 .IX Item "-newreq"
178 creates a new certificate request. The private key and request are
179 written to the file \*(L"newreq.pem\*(R".
180 .Ip "\fB\-newreq-nowdes\fR" 4
181 .IX Item "-newreq-nowdes"
182 is like \fB\-newreq\fR except that the private key will not be encrypted.
183 .Ip "\fB\-newca\fR" 4
184 .IX Item "-newca"
185 creates a new \s-1CA\s0 hierarchy for use with the \fBca\fR program (or the \fB\-signcert\fR
186 and \fB\-xsign\fR options). The user is prompted to enter the filename of the \s-1CA\s0
187 certificates (which should also contain the private key) or by hitting \s-1ENTER\s0
188 details of the \s-1CA\s0 will be prompted for. The relevant files and directories
189 are created in a directory called \*(L"demoCA\*(R" in the current directory.
190 .Ip "\fB\-pkcs12\fR" 4
191 .IX Item "-pkcs12"
192 create a PKCS#12 file containing the user certificate, private key and \s-1CA\s0
193 certificate. It expects the user certificate and private key to be in the
194 file \*(L"newcert.pem\*(R" and the \s-1CA\s0 certificate to be in the file demoCA/cacert.pem,
195 it creates a file \*(L"newcert.p12\*(R". This command can thus be called after the
196 \&\fB\-sign\fR option. The PKCS#12 file can be imported directly into a browser.
197 If there is an additional argument on the command line it will be used as the
198 \&\*(L"friendly name\*(R" for the certificate (which is typically displayed in the browser
199 list box), otherwise the name \*(L"My Certificate\*(R" is used.
200 .Ip "\fB\-sign\fR, \fB\-signreq\fR, \fB\-xsign\fR" 4
201 .IX Item "-sign, -signreq, -xsign"
202 calls the \fBca\fR program to sign a certificate request. It expects the request
203 to be in the file \*(L"newreq.pem\*(R". The new certificate is written to the file
204 \&\*(L"newcert.pem\*(R" except in the case of the \fB\-xsign\fR option when it is written
205 to standard output.
206 .Ip "\fB\-signCA\fR" 4
207 .IX Item "-signCA"
208 this option is the same as the \fB\-signreq\fR option except it uses the configuration
209 file section \fBv3_ca\fR and so makes the signed request a valid \s-1CA\s0 certificate. This
210 is useful when creating intermediate \s-1CA\s0 from a root \s-1CA\s0.
211 .Ip "\fB\-signcert\fR" 4
212 .IX Item "-signcert"
213 this option is the same as \fB\-sign\fR except it expects a self signed certificate
214 to be present in the file \*(L"newreq.pem\*(R".
215 .Ip "\fB\-verify\fR" 4
216 .IX Item "-verify"
217 verifies certificates against the \s-1CA\s0 certificate for \*(L"demoCA\*(R". If no certificates
218 are specified on the command line it tries to verify the file \*(L"newcert.pem\*(R". 
219 .Ip "\fBfiles\fR" 4
220 .IX Item "files"
221 one or more optional certificate file names for use with the \fB\-verify\fR command.
222 .SH "EXAMPLES"
223 .IX Header "EXAMPLES"
224 Create a \s-1CA\s0 hierarchy:
225 .PP
226 .Vb 1
227 \& CA.pl -newca
228 .Ve
229 Complete certificate creation example: create a \s-1CA\s0, create a request, sign
230 the request and finally create a PKCS#12 file containing it.
231 .PP
232 .Vb 4
233 \& CA.pl -newca
234 \& CA.pl -newreq
235 \& CA.pl -signreq
236 \& CA.pl -pkcs12 "My Test Certificate"
237 .Ve
238 .SH "DSA CERTIFICATES"
239 .IX Header "DSA CERTIFICATES"
240 Although the \fB\s-1CA\s0.pl\fR creates \s-1RSA\s0 CAs and requests it is still possible to
241 use it with \s-1DSA\s0 certificates and requests using the req(1) command
242 directly. The following example shows the steps that would typically be taken.
243 .PP
244 Create some \s-1DSA\s0 parameters:
245 .PP
246 .Vb 1
247 \& openssl dsaparam -out dsap.pem 1024
248 .Ve
249 Create a \s-1DSA\s0 \s-1CA\s0 certificate and private key:
250 .PP
251 .Vb 1
252 \& openssl req -x509 -newkey dsa:dsap.pem -keyout cacert.pem -out cacert.pem
253 .Ve
254 Create the \s-1CA\s0 directories and files:
255 .PP
256 .Vb 1
257 \& CA.pl -newca
258 .Ve
259 enter cacert.pem when prompted for the \s-1CA\s0 file name.
260 .PP
261 Create a \s-1DSA\s0 certificate request and private key (a different set of parameters
262 can optionally be created first):
263 .PP
264 .Vb 1
265 \& openssl req -out newreq.pem -newkey dsa:dsap.pem
266 .Ve
267 Sign the request:
268 .PP
269 .Vb 1
270 \& CA.pl -signreq
271 .Ve
272 .SH "NOTES"
273 .IX Header "NOTES"
274 Most of the filenames mentioned can be modified by editing the \fB\s-1CA\s0.pl\fR script.
275 .PP
276 If the demoCA directory already exists then the \fB\-newca\fR command will not
277 overwrite it and will do nothing. This can happen if a previous call using
278 the \fB\-newca\fR option terminated abnormally. To get the correct behaviour
279 delete the demoCA directory if it already exists.
280 .PP
281 Under some environments it may not be possible to run the \fB\s-1CA\s0.pl\fR script
282 directly (for example Win32) and the default configuration file location may
283 be wrong. In this case the command:
284 .PP
285 .Vb 1
286 \& perl -S CA.pl
287 .Ve
288 can be used and the \fB\s-1OPENSSL_CONF\s0\fR environment variable changed to point to 
289 the correct path of the configuration file \*(L"openssl.cnf\*(R".
290 .PP
291 The script is intended as a simple front end for the \fBopenssl\fR program for use
292 by a beginner. Its behaviour isn't always what is wanted. For more control over the
293 behaviour of the certificate commands call the \fBopenssl\fR command directly.
294 .SH "ENVIRONMENT VARIABLES"
295 .IX Header "ENVIRONMENT VARIABLES"
296 The variable \fB\s-1OPENSSL_CONF\s0\fR if defined allows an alternative configuration
297 file location to be specified, it should contain the full path to the
298 configuration file, not just its directory.
299 .SH "SEE ALSO"
300 .IX Header "SEE ALSO"
301 x509(1), ca(1), req(1), pkcs12(1),
302 config(5)