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