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