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