diff options
-rw-r--r-- | src/lib/libssl/man/Makefile | 3 | ||||
-rw-r--r-- | src/usr.sbin/openssl/Makefile | 2 | ||||
-rw-r--r-- | src/usr.sbin/openssl/openssl.1 | 7616 |
3 files changed, 7618 insertions, 3 deletions
diff --git a/src/lib/libssl/man/Makefile b/src/lib/libssl/man/Makefile index 0ab8c2e360..930c5f56af 100644 --- a/src/lib/libssl/man/Makefile +++ b/src/lib/libssl/man/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: Makefile,v 1.3 2002/10/09 08:22:49 fgsch Exp $ | 1 | # $OpenBSD: Makefile,v 1.4 2003/03/05 20:59:15 deraadt Exp $ |
2 | 2 | ||
3 | .include <bsd.own.mk> # for NOMAN | 3 | .include <bsd.own.mk> # for NOMAN |
4 | 4 | ||
@@ -173,7 +173,6 @@ MANALL= \ | |||
173 | dsa.cat3 \ | 173 | dsa.cat3 \ |
174 | lh_stats.cat3 \ | 174 | lh_stats.cat3 \ |
175 | lhash.cat3 \ | 175 | lhash.cat3 \ |
176 | openssl.cat1 \ | ||
177 | rsa.cat3 \ | 176 | rsa.cat3 \ |
178 | ssl.cat3 | 177 | ssl.cat3 |
179 | 178 | ||
diff --git a/src/usr.sbin/openssl/Makefile b/src/usr.sbin/openssl/Makefile index ee8f5b8c5c..c1563892b3 100644 --- a/src/usr.sbin/openssl/Makefile +++ b/src/usr.sbin/openssl/Makefile | |||
@@ -6,7 +6,7 @@ BINGRP= bin | |||
6 | BINMODE= 555 | 6 | BINMODE= 555 |
7 | BINDIR= /usr/sbin | 7 | BINDIR= /usr/sbin |
8 | LDADD= -lssl -lcrypto | 8 | LDADD= -lssl -lcrypto |
9 | NOMAN= not yet kiddies | 9 | MAN1= openssl.1 |
10 | 10 | ||
11 | SSLEAYDIST= lib/libssl/src | 11 | SSLEAYDIST= lib/libssl/src |
12 | 12 | ||
diff --git a/src/usr.sbin/openssl/openssl.1 b/src/usr.sbin/openssl/openssl.1 new file mode 100644 index 0000000000..1d826d8b0f --- /dev/null +++ b/src/usr.sbin/openssl/openssl.1 | |||
@@ -0,0 +1,7616 @@ | |||
1 | .\" ==================================================================== | ||
2 | .\" Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. | ||
3 | .\" | ||
4 | .\" Redistribution and use in source and binary forms, with or without | ||
5 | .\" modification, are permitted provided that the following conditions | ||
6 | .\" are met: | ||
7 | .\" | ||
8 | .\" 1. Redistributions of source code must retain the above copyright | ||
9 | .\" notice, this list of conditions and the following disclaimer. | ||
10 | .\" | ||
11 | .\" 2. Redistributions in binary form must reproduce the above copyright | ||
12 | .\" notice, this list of conditions and the following disclaimer in | ||
13 | .\" the documentation and/or other materials provided with the | ||
14 | .\" distribution. | ||
15 | .\" | ||
16 | .\" 3. All advertising materials mentioning features or use of this | ||
17 | .\" software must display the following acknowledgment: | ||
18 | .\" "This product includes software developed by the OpenSSL Project | ||
19 | .\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
20 | .\" | ||
21 | .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
22 | .\" endorse or promote products derived from this software without | ||
23 | .\" prior written permission. For written permission, please contact | ||
24 | .\" openssl-core@openssl.org. | ||
25 | .\" | ||
26 | .\" 5. Products derived from this software may not be called "OpenSSL" | ||
27 | .\" nor may "OpenSSL" appear in their names without prior written | ||
28 | .\" permission of the OpenSSL Project. | ||
29 | .\" | ||
30 | .\" 6. Redistributions of any form whatsoever must retain the following | ||
31 | .\" acknowledgment: | ||
32 | .\" "This product includes software developed by the OpenSSL Project | ||
33 | .\" for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
34 | .\" | ||
35 | .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
36 | .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
37 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
38 | .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
39 | .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
40 | .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
41 | .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
42 | .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
43 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
44 | .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
45 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
46 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | ||
47 | .\" ==================================================================== | ||
48 | .\" | ||
49 | .\" This product includes cryptographic software written by Eric Young | ||
50 | .\" (eay@cryptsoft.com). This product includes software written by Tim | ||
51 | .\" Hudson (tjh@cryptsoft.com). | ||
52 | .\" | ||
53 | .\" | ||
54 | .\" Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
55 | .\" All rights reserved. | ||
56 | .\" | ||
57 | .\" This package is an SSL implementation written | ||
58 | .\" by Eric Young (eay@cryptsoft.com). | ||
59 | .\" The implementation was written so as to conform with Netscapes SSL. | ||
60 | .\" | ||
61 | .\" This library is free for commercial and non-commercial use as long as | ||
62 | .\" the following conditions are aheared to. The following conditions | ||
63 | .\" apply to all code found in this distribution, be it the RC4, RSA, | ||
64 | .\" lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
65 | .\" included with this distribution is covered by the same copyright terms | ||
66 | .\" except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
67 | .\" | ||
68 | .\" Copyright remains Eric Young's, and as such any Copyright notices in | ||
69 | .\" the code are not to be removed. | ||
70 | .\" If this package is used in a product, Eric Young should be given attribution | ||
71 | .\" as the author of the parts of the library used. | ||
72 | .\" This can be in the form of a textual message at program startup or | ||
73 | .\" in documentation (online or textual) provided with the package. | ||
74 | .\" | ||
75 | .\" Redistribution and use in source and binary forms, with or without | ||
76 | .\" modification, are permitted provided that the following conditions | ||
77 | .\" are met: | ||
78 | .\" 1. Redistributions of source code must retain the copyright | ||
79 | .\" notice, this list of conditions and the following disclaimer. | ||
80 | .\" 2. Redistributions in binary form must reproduce the above copyright | ||
81 | .\" notice, this list of conditions and the following disclaimer in the | ||
82 | .\" documentation and/or other materials provided with the distribution. | ||
83 | .\" 3. All advertising materials mentioning features or use of this software | ||
84 | .\" must display the following acknowledgement: | ||
85 | .\" "This product includes cryptographic software written by | ||
86 | .\" Eric Young (eay@cryptsoft.com)" | ||
87 | .\" The word 'cryptographic' can be left out if the rouines from the library | ||
88 | .\" being used are not cryptographic related :-). | ||
89 | .\" 4. If you include any Windows specific code (or a derivative thereof) from | ||
90 | .\" the apps directory (application code) you must include an | ||
91 | .\" acknowledgement: | ||
92 | .\" "This product includes software written by Tim Hudson | ||
93 | .\" (tjh@cryptsoft.com)" | ||
94 | .\" | ||
95 | .\" THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
96 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
97 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
98 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
99 | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
100 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
101 | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
102 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
103 | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
104 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
105 | .\" SUCH DAMAGE. | ||
106 | .\" | ||
107 | .\" The licence and distribution terms for any publically available version or | ||
108 | .\" derivative of this code cannot be changed. i.e. this code cannot simply be | ||
109 | .\" copied and put under another distribution licence | ||
110 | .\" [including the GNU Public Licence.] | ||
111 | .\" | ||
112 | .\" ssl(1) | ||
113 | .\" | ||
114 | .Dd February, 28 2003 | ||
115 | .Dt OPENSSL 1 | ||
116 | .Os | ||
117 | .Sh NAME | ||
118 | .Nm openssl | ||
119 | .Nd OpenSSL command line tool | ||
120 | .Sh SYNOPSIS | ||
121 | .Nm | ||
122 | .Cm command | ||
123 | .Op Ar command_opts | ||
124 | .Op Ar command_args | ||
125 | .Pp | ||
126 | .Nm | ||
127 | .Bk -words | ||
128 | .Oo Cm list-standard-commands Li |\ \& | ||
129 | .Cm list-message-digest-commands | | ||
130 | .Cm \ \ \ \ list-cipher-commands | ||
131 | .Oc | ||
132 | .Ek | ||
133 | .Pp | ||
134 | .Nm | ||
135 | .Cm no- Ns Ar XXX | ||
136 | .Op Ar arbitrary options | ||
137 | .Pp | ||
138 | .Sh DESCRIPTION | ||
139 | .Nm OpenSSL | ||
140 | is a cryptography toolkit implementing the Secure Sockets Layer | ||
141 | (SSL v2/v3) and Transport Layer Security (TLS v1) network protocols and | ||
142 | related cryptography standards required by them. | ||
143 | .Pp | ||
144 | The | ||
145 | .Nm | ||
146 | program is a command line tool for using the various | ||
147 | cryptography functions of | ||
148 | .Nm OpenSSL Ns Li 's | ||
149 | .Em crypto | ||
150 | library from the shell. | ||
151 | It can be used for | ||
152 | .Pp | ||
153 | .Bl -bullet -compact | ||
154 | .It | ||
155 | Creation of RSA, DH and DSA key parameters | ||
156 | .It | ||
157 | Creation of X.509 certificates, CSRs and CRLs | ||
158 | .It | ||
159 | Calculation of Message Digests | ||
160 | .It | ||
161 | Encryption and Decryption with Ciphers | ||
162 | .It | ||
163 | SSL/TLS Client and Server Tests | ||
164 | .It | ||
165 | Handling of S/MIME signed or encrypted mail | ||
166 | .El | ||
167 | .Sh COMMAND SUMMARY | ||
168 | The | ||
169 | .Nm | ||
170 | program provides a rich variety of commands | ||
171 | .Po Cm command\ \& | ||
172 | in the | ||
173 | .Sx SYNOPSIS | ||
174 | above | ||
175 | .Pc , | ||
176 | each of which often has a wealth of options and arguments | ||
177 | .Po Ar command_opts\ \& | ||
178 | and | ||
179 | .Ar command_args | ||
180 | in the | ||
181 | .Sx SYNOPSIS | ||
182 | .Pc . | ||
183 | .Pp | ||
184 | The pseudo-commands | ||
185 | .Cm list-standard-commands , list-message-digest-commands , | ||
186 | and | ||
187 | .Cm list-cipher-commands | ||
188 | output a list (one entry per line) of the names | ||
189 | of all standard commands, message digest commands, or cipher commands, | ||
190 | respectively, that are available in the present | ||
191 | .Nm | ||
192 | utility. | ||
193 | .Pp | ||
194 | The pseudo-command | ||
195 | .Cm no- Ns Ar XXX | ||
196 | tests whether a command of the | ||
197 | specified name is available. | ||
198 | If no command named | ||
199 | .Ar XXX | ||
200 | exists, | ||
201 | it returns 0 (success) and prints | ||
202 | .Cm no- Ns Ar XXX ; | ||
203 | otherwise it returns 1 and prints | ||
204 | .Ar XXX . | ||
205 | In both cases, the output goes to | ||
206 | .Em stdout | ||
207 | and nothing is printed to | ||
208 | .Em stderr . | ||
209 | Additional command line arguments are always ignored. | ||
210 | Since for each cipher there is a command of the same name, | ||
211 | this provides an easy way for shell scripts to test for the | ||
212 | availability of ciphers in the | ||
213 | .Nm | ||
214 | program. | ||
215 | .Pp | ||
216 | .Sy Note: | ||
217 | .Cm no- Ns Ar XXX | ||
218 | is not able to detect pseudo-commands such as | ||
219 | .Cm quit , | ||
220 | .Cm list- Ns Ar ... Ns Cm -commands , | ||
221 | or | ||
222 | .Cm no- Ns Ar XXX | ||
223 | itself. | ||
224 | .Sh STANDARD COMMANDS | ||
225 | .Bl -tag -width "asn1parse" | ||
226 | .It Cm asn1parse | ||
227 | Parse an ASN.1 sequence. | ||
228 | .It Cm ca | ||
229 | Certificate Authority (CA) Management. | ||
230 | .It Cm ciphers | ||
231 | Cipher Suite Description Determination. | ||
232 | .It Cm crl | ||
233 | Certificate Revocation List (CRL) Management. | ||
234 | .It Cm crl2pkcs7 | ||
235 | CRL to PKCS#7 Conversion. | ||
236 | .It Cm dgst | ||
237 | Message Digest Calculation. | ||
238 | .It Cm dh | ||
239 | Diffie-Hellman Parameter Management. | ||
240 | Obsoleted by | ||
241 | .Cm dhparam . | ||
242 | .It Cm dhparam | ||
243 | Generation and Management of Diffie-Hellman Parameters. | ||
244 | .It Cm dsa | ||
245 | DSA Data Management. | ||
246 | .It Cm dsaparam | ||
247 | DSA Parameter Generation. | ||
248 | .It Cm enc | ||
249 | Encoding with Ciphers. | ||
250 | .It Cm errstr | ||
251 | Error Number to Error String Conversion. | ||
252 | .It Cm gendh | ||
253 | Generation of Diffie-Hellman Parameters. | ||
254 | Obsoleted by | ||
255 | .Cm dhparam . | ||
256 | .It Cm gendsa | ||
257 | Generation of DSA Parameters. | ||
258 | .It Cm genrsa | ||
259 | Generation of RSA Parameters. | ||
260 | .It Cm nseq | ||
261 | Create or examine a netscape certificate sequence. | ||
262 | .It Cm ocsp | ||
263 | Online Certificate Status Protocol utility. | ||
264 | .It Cm passwd | ||
265 | Generation of hashed passwords. | ||
266 | .It Cm pkcs7 | ||
267 | PKCS#7 Data Management. | ||
268 | .It Cm pkcs8 | ||
269 | PKCS#8 Data Management. | ||
270 | .It Cm pkcs12 | ||
271 | PKCS#12 Data Management. | ||
272 | .It Cm rand | ||
273 | Generate pseudo-random bytes. | ||
274 | .It Cm req | ||
275 | X.509 Certificate Signing Request (CSR) Management. | ||
276 | .It Cm rsa | ||
277 | RSA Data Management. | ||
278 | .It Cm rsautl | ||
279 | RSA utility for signing, verification, encryption, and decryption. | ||
280 | .It Cm s_client | ||
281 | This implements a generic SSL/TLS client which can establish a transparent | ||
282 | connection to a remote server speaking SSL/TLS. | ||
283 | It's intended for testing purposes only and provides only rudimentary | ||
284 | interface functionality but internally uses mostly all functionality of the | ||
285 | .Nm OpenSSL | ||
286 | .Em ssl | ||
287 | library. | ||
288 | .It Cm s_server | ||
289 | This implements a generic SSL/TLS server which accepts connections from remote | ||
290 | clients speaking SSL/TLS. | ||
291 | It's intended for testing purposes only and provides only rudimentary | ||
292 | interface functionality but internally uses mostly all functionality of the | ||
293 | .Nm OpenSSL | ||
294 | .Em ssl | ||
295 | library. | ||
296 | It provides both an own command line oriented protocol for testing | ||
297 | SSL functions and a simple HTTP response | ||
298 | facility to emulate an SSL/TLS-aware webserver. | ||
299 | .It Cm s_time | ||
300 | SSL Connection Timer. | ||
301 | .It Cm sess_id | ||
302 | SSL Session Data Management. | ||
303 | .It Cm smime | ||
304 | S/MIME mail processing. | ||
305 | .It Cm speed | ||
306 | Algorithm Speed Measurement. | ||
307 | .It Cm spkac | ||
308 | SPKAC printing and generating utility. | ||
309 | .It Cm verify | ||
310 | X.509 Certificate Verification. | ||
311 | .It Cm version | ||
312 | .Nm OpenSSL | ||
313 | Version Information. | ||
314 | .It Cm x509 | ||
315 | X.509 Certificate Data Management. | ||
316 | .El | ||
317 | .Sh MESSAGE DIGEST COMMANDS | ||
318 | .Bl -tag -width "asn1parse" | ||
319 | .It Cm md2 | ||
320 | MD2 Digest. | ||
321 | .It Cm md5 | ||
322 | MD5 Digest. | ||
323 | .It Cm mdc2 | ||
324 | MDC2 Digest. | ||
325 | .It Cm rmd160 | ||
326 | RMD-160 Digest. | ||
327 | .It Cm sha | ||
328 | SHA Digest. | ||
329 | .It Cm sha1 | ||
330 | SHA-1 Digest. | ||
331 | .El | ||
332 | .Sh ENCODING AND CIPHER COMMANDS | ||
333 | .Bl -tag -width "asn1parse" | ||
334 | .It Cm base64 | ||
335 | Base64 Encoding. | ||
336 | .It Cm bf bf-cbc bf-cfb bf-ecb bf-ofb | ||
337 | Blowfish Cipher. | ||
338 | .It Cm cast cast-cbc | ||
339 | CAST Cipher. | ||
340 | .It Cm cast5-cbc cast5-cfb cast5-ecb cast5-ofb | ||
341 | CAST5 Cipher. | ||
342 | .It Cm des des-cbc des-cfb des-ecb des-ede des-ede-cbc | ||
343 | .It Cm des-ede-cfb des-ede-ofb des-ofb | ||
344 | DES Cipher. | ||
345 | .It Cm des3 desx des-ede3 des-ede3-cbc des-ede3-cfb des-ede3-ofb | ||
346 | Triple-DES Cipher. | ||
347 | .It Cm idea idea-cbc idea-cfb idea-ecb idea-ofb | ||
348 | IDEA Cipher. | ||
349 | .It Cm rc2 rc2-cbc rc2-cfb rc2-ecb rc2-ofb | ||
350 | RC2 Cipher. | ||
351 | .It Cm rc4 | ||
352 | RC4 Cipher. | ||
353 | .It Cm rc5 rc5-cbc rc5-cfb rc5-ecb rc5-ofb | ||
354 | RC5 Cipher. | ||
355 | .El | ||
356 | .Sh PASS PHRASE ARGUMENTS | ||
357 | Several commands accept password arguments, typically using | ||
358 | .Fl passin | ||
359 | and | ||
360 | .Fl passout | ||
361 | for input and output passwords, respectively. | ||
362 | These allow the password to be obtained from a variety of sources. | ||
363 | Both of these options take a single argument whose format is described below. | ||
364 | If no password argument is given and a password is required then the user is | ||
365 | prompted to enter one: this will typically be read from the current | ||
366 | terminal with echoing turned off. | ||
367 | .Bl -tag -width "fd:number" | ||
368 | .It Ar pass:password | ||
369 | The actual password is | ||
370 | .Ar password . | ||
371 | Since the password is visible to utilities | ||
372 | (like | ||
373 | .Xr ps 1 | ||
374 | under Unix) this form should only be used where security is not important. | ||
375 | .It Ar env:var | ||
376 | Obtain the password from the environment variable | ||
377 | .Ar var . | ||
378 | Since the environment of other processes is visible on certain platforms | ||
379 | (e.g. | ||
380 | .Xr ps 1 | ||
381 | under certain Unix OSes) this option should be used with caution. | ||
382 | .It Ar file:pathname | ||
383 | The first line of | ||
384 | .Ar pathname | ||
385 | is the password. | ||
386 | If the same | ||
387 | .Ar pathname | ||
388 | argument is supplied to | ||
389 | .Fl passin | ||
390 | and | ||
391 | .Fl passout | ||
392 | then the first line will be used for the input password and the next line | ||
393 | for the output password. | ||
394 | .Ar pathname | ||
395 | need not refer to a regular file: | ||
396 | it could, for example, refer to a device or named pipe. | ||
397 | .It Ar fd:number | ||
398 | Read the password from the file descriptor | ||
399 | .Ar number . | ||
400 | This can be used to send the data via a pipe for example. | ||
401 | .It Ar stdin | ||
402 | Read the password from standard input. | ||
403 | .\" | ||
404 | .\" ASN1PARSE | ||
405 | .\" | ||
406 | .Sh ASN1PARSE | ||
407 | .Pp | ||
408 | .Nm "openssl asn1parse" | ||
409 | .Op Fl inform Ar PEM|DER | ||
410 | .Op Fl in Ar filename | ||
411 | .Op Fl out Ar filename | ||
412 | .Op Fl noout | ||
413 | .Op Fl offset Ar number | ||
414 | .Op Fl length Ar number | ||
415 | .Op Fl i | ||
416 | .Op Fl oid Ar filename | ||
417 | .Op Fl strparse Ar offset | ||
418 | .Pp | ||
419 | The | ||
420 | .Nm asn1parse | ||
421 | command is a diagnostic utility that can parse ASN.1 structures. | ||
422 | It can also be used to extract data from ASN.1 formatted data. | ||
423 | .Pp | ||
424 | The options are as follows: | ||
425 | .Bl -tag -width Ds | ||
426 | .It Fl inform Ar DER|PEM | ||
427 | The input format. | ||
428 | .Ar DER | ||
429 | is binary format and | ||
430 | .Ar PEM | ||
431 | (the default) is base64 encoded. | ||
432 | .It Fl in Ar filename | ||
433 | The input file; default is standard input. | ||
434 | .It Fl out Ar filename | ||
435 | Output file to place the | ||
436 | .Em DER | ||
437 | encoded data into. | ||
438 | If this option is not present then no data will be output. | ||
439 | This is most useful when combined with the | ||
440 | .Fl strparse | ||
441 | option. | ||
442 | .It Fl noout | ||
443 | Don't output the parsed version of the input file. | ||
444 | .It Fl offset Ar number | ||
445 | Starting offset to begin parsing; default is start of file. | ||
446 | .It Fl length Ar number | ||
447 | Number of bytes to parse; default is until end of file. | ||
448 | .It Fl i | ||
449 | Indents the output according to the "depth" of the structures. | ||
450 | .It Fl oid Ar filename | ||
451 | A file containing additional OBJECT IDENTIFIERs (OIDs). | ||
452 | The format of this file is described in the | ||
453 | .Sx ASN1PARSE NOTES | ||
454 | section below. | ||
455 | .It Fl strparse Ar offset | ||
456 | Parse the contents octets of the ASN.1 object starting at | ||
457 | .Ar offset . | ||
458 | This option can be used multiple times to "drill down" into a nested structure. | ||
459 | .Sh ASN1PARSE OUTPUT | ||
460 | The output will typically contain lines like this: | ||
461 | .Pp | ||
462 | .Bd -literal | ||
463 | 0:d=0 hl=4 l= 681 cons: SEQUENCE | ||
464 | .Pp | ||
465 | \&..... | ||
466 | .Pp | ||
467 | 229:d=3 hl=3 l= 141 prim: BIT STRING | ||
468 | 373:d=2 hl=3 l= 162 cons: cont [ 3 ] | ||
469 | 376:d=3 hl=3 l= 159 cons: SEQUENCE | ||
470 | 379:d=4 hl=2 l= 29 cons: SEQUENCE | ||
471 | 381:d=5 hl=2 l= 3 prim: OBJECT :X509v3 Subject Key Identifier | ||
472 | 386:d=5 hl=2 l= 22 prim: OCTET STRING | ||
473 | 410:d=4 hl=2 l= 112 cons: SEQUENCE | ||
474 | 412:d=5 hl=2 l= 3 prim: OBJECT :X509v3 Authority Key Identifier | ||
475 | 417:d=5 hl=2 l= 105 prim: OCTET STRING | ||
476 | 524:d=4 hl=2 l= 12 cons: SEQUENCE | ||
477 | .Pp | ||
478 | \&..... | ||
479 | .Ed | ||
480 | .Pp | ||
481 | This example is part of a self-signed certificate. | ||
482 | Each line starts with the offset in decimal. | ||
483 | .Cm d=XX | ||
484 | specifies the current depth. | ||
485 | The depth is increased within the scope of any SET or SEQUENCE. | ||
486 | .Cm hl=XX | ||
487 | gives the header length (tag and length octets) of the current type. | ||
488 | .Cm l=XX | ||
489 | gives the length of the contents octets. | ||
490 | .Pp | ||
491 | The | ||
492 | .Fl i | ||
493 | option can be used to make the output more readable. | ||
494 | .Pp | ||
495 | Some knowledge of the ASN.1 structure is needed to interpret the output. | ||
496 | .Pp | ||
497 | In this example the BIT STRING at offset 229 is the certificate public key. | ||
498 | The contents octets of this will contain the public key information. | ||
499 | This can be examined using the option | ||
500 | .Fl strparse Cm 229 | ||
501 | to yield: | ||
502 | .Pp | ||
503 | .Bd -literal | ||
504 | \& 0:d=0 hl=3 l= 137 cons: SEQUENCE | ||
505 | \& 3:d=1 hl=3 l= 129 prim: INTEGER :E5D21E1F5C8D208EA7A2166C7FAF9F6BDF2059669C60876DDB70840F1A5AAFA59699FE471F379F1DD6A487E7D5409AB6A88D4A9746E24B91D8CF55DB3521015460C8EDE44EE8A4189F7A7BE77D6CD3A9AF2696F486855CF58BF0EDF2B4068058C7A947F52548DDF7E15E96B385F86422BEA9064A3EE9E1158A56E4A6F47E5897 | ||
506 | \& 135:d=1 hl=2 l= 3 prim: INTEGER :010001 | ||
507 | .Sh ASN1PARSE NOTES | ||
508 | If an OID is not part of | ||
509 | .Nm OpenSSL Ns Li 's | ||
510 | internal table it will be represented in | ||
511 | numerical form (for example 1.2.3.4). | ||
512 | The file passed to the | ||
513 | .Fl oid | ||
514 | option allows additional OIDs to be included. | ||
515 | Each line consists of three columns, | ||
516 | the first column is the OID in numerical format and should be followed by | ||
517 | whitespace. | ||
518 | The second column is the "short name" which is a single word followed | ||
519 | by whitespace. | ||
520 | The final column is the rest of the line and is the "long name". | ||
521 | .Nm asn1parse | ||
522 | displays the long name. | ||
523 | Example: | ||
524 | .Pp | ||
525 | "1.2.3.4 shortName A long name" | ||
526 | .Sh ASN1PARSE BUGS | ||
527 | There should be options to change the format of input lines. | ||
528 | The output of some ASN.1 types is not well handled (if at all). | ||
529 | .\" | ||
530 | .\" ca | ||
531 | .\" | ||
532 | .Sh CA | ||
533 | .Nm openssl ca | ||
534 | .Bk -words | ||
535 | .Op Fl verbose | ||
536 | .Op Fl config Ar filename | ||
537 | .Op Fl name Ar section | ||
538 | .Op Fl gencrl | ||
539 | .Op Fl revoke Ar file | ||
540 | .Op Fl subj Ar arg | ||
541 | .Op Fl crldays Ar days | ||
542 | .Op Fl crlhours Ar hours | ||
543 | .Op Fl crlexts Ar section | ||
544 | .Op Fl startdate Ar date | ||
545 | .Op Fl enddate Ar date | ||
546 | .Op Fl days Ar arg | ||
547 | .Op Fl md Ar arg | ||
548 | .Op Fl policy Ar arg | ||
549 | .Op Fl keyfile Ar arg | ||
550 | .Op Fl key Ar arg | ||
551 | .Op Fl passin Ar arg | ||
552 | .Op Fl cert Ar file | ||
553 | .Op Fl in Ar file | ||
554 | .Op Fl out Ar file | ||
555 | .Op Fl notext | ||
556 | .Op Fl outdir Ar dir | ||
557 | .Op Fl infiles | ||
558 | .Op Fl spkac Ar file | ||
559 | .Op Fl ss_cert Ar file | ||
560 | .Op Fl preserveDN | ||
561 | .Op Fl noemailDN | ||
562 | .Op Fl batch | ||
563 | .Op Fl msie_hack | ||
564 | .Op Fl extensions Ar section | ||
565 | .Op Fl extfile Ar section | ||
566 | .Ek | ||
567 | .Pp | ||
568 | The | ||
569 | .Nm ca | ||
570 | command is a minimal CA application. | ||
571 | It can be used to sign certificate requests in a variety of forms | ||
572 | and generate CRLs. | ||
573 | It also maintains a text database of issued certificates and their status. | ||
574 | .Pp | ||
575 | The options descriptions will be divided into each purpose. | ||
576 | .Sh CA OPTIONS | ||
577 | .Bl -tag -width Ds | ||
578 | .It Fl config Ar filename | ||
579 | Specifies the configuration file to use. | ||
580 | .It Fl name Ar section | ||
581 | Specifies the configuration file | ||
582 | .Ar section | ||
583 | to use (overrides | ||
584 | .Cm default_ca | ||
585 | in the | ||
586 | .Cm ca | ||
587 | section). | ||
588 | .It Fl in Ar filename | ||
589 | An input | ||
590 | .Ar filename | ||
591 | containing a single certificate request to be signed by the CA. | ||
592 | .It Fl ss_cert Ar filename | ||
593 | A single self-signed certificate to be signed by the CA. | ||
594 | .It Fl spkac Ar filename | ||
595 | A file containing a single Netscape signed public key and challenge, | ||
596 | and additional field values to be signed by the CA. | ||
597 | See the | ||
598 | .Sx CA NOTES | ||
599 | section for information on the required format. | ||
600 | .It Fl infiles | ||
601 | If present, this should be the last option; all subsequent arguments | ||
602 | are assumed to be the names of files containing certificate requests. | ||
603 | .It Fl out Ar filename | ||
604 | The output file to output certificates to. | ||
605 | The default is standard output. | ||
606 | The certificate details will also be printed out to this file. | ||
607 | .It Fl outdir Ar directory | ||
608 | The | ||
609 | .Ar directory | ||
610 | to output certificates to. | ||
611 | The certificate will be written to a filename consisting of the | ||
612 | serial number in hex with ".pem" appended. | ||
613 | .It Fl cert | ||
614 | The CA certificate file. | ||
615 | .It Fl keyfile Ar filename | ||
616 | The private key to sign requests with. | ||
617 | .It Fl key Ar password | ||
618 | The password used to encrypt the private key. | ||
619 | Since on some systems the command line arguments are visible | ||
620 | (e.g. Unix with the | ||
621 | .Xr ps 1 | ||
622 | utility) this option should be used with caution. | ||
623 | .It Fl passin Ar arg | ||
624 | The key password source. | ||
625 | For more information about the format of | ||
626 | .Ar arg | ||
627 | see the | ||
628 | .Sx PASS PHRASE ARGUMENTS | ||
629 | section above. | ||
630 | .It Fl verbose | ||
631 | This prints extra details about the operations being performed. | ||
632 | .It Fl notext | ||
633 | Don't output the text form of a certificate to the output file. | ||
634 | .It Fl startdate Ar date | ||
635 | This allows the start date to be explicitly set. | ||
636 | The format of the date is YYMMDDHHMMSSZ | ||
637 | (the same as an ASN1 UTCTime structure). | ||
638 | .It Fl enddate Ar date | ||
639 | This allows the expiry date to be explicitly set. | ||
640 | The format of the date is YYMMDDHHMMSSZ | ||
641 | (the same as an ASN1 UTCTime structure). | ||
642 | .It Fl days Ar arg | ||
643 | The number of days to certify the certificate for. | ||
644 | .It Fl md Ar alg | ||
645 | The message digest to use. | ||
646 | Possible values include | ||
647 | .Ar md5 , sha1 | ||
648 | and | ||
649 | .Ar mdc2 . | ||
650 | This option also applies to CRLs. | ||
651 | .It Fl policy Ar arg | ||
652 | This option defines the CA "policy" to use. | ||
653 | This is a section in the configuration file which decides which fields | ||
654 | should be mandatory or match the CA certificate. | ||
655 | Check out the | ||
656 | .Sx CA POLICY FORMAT | ||
657 | section for more information. | ||
658 | .It Fl msie_hack | ||
659 | This is a legacy option to make | ||
660 | .Nm ca | ||
661 | work with very old versions of the IE certificate enrollment control | ||
662 | "certenr3". | ||
663 | It used UniversalStrings for almost everything. | ||
664 | Since the old control has various security bugs, | ||
665 | its use is strongly discouraged. | ||
666 | The newer control "Xenroll" does not need this option. | ||
667 | .It Fl preserveDN | ||
668 | Normally the DN order of a certificate is the same as the order of the | ||
669 | fields in the relevant policy section. | ||
670 | When this option is set, the order is the same as the request. | ||
671 | This is largely for compatibility with the older IE enrollment control | ||
672 | which would only accept certificates if their DNs matched the order of the | ||
673 | request. | ||
674 | This is not needed for Xenroll. | ||
675 | .It Fl noemailDN | ||
676 | The DN of a certificate can contain the EMAIL field if present in the | ||
677 | request DN, however it is good policy just having the e-mail set into | ||
678 | the | ||
679 | .Em altName | ||
680 | extension of the certificate. | ||
681 | When this option is set the EMAIL field is removed from the certificate's | ||
682 | subject and set only in the, eventually present, extensions. | ||
683 | The | ||
684 | .Ar email_in_dn | ||
685 | keyword can be used in the configuration file to enable this behaviour. | ||
686 | .It Fl batch | ||
687 | This sets the batch mode. | ||
688 | In this mode no questions will be asked | ||
689 | and all certificates will be certified automatically. | ||
690 | .It Fl extensions Ar section | ||
691 | The section of the configuration file containing certificate extensions | ||
692 | to be added when a certificate is issued (defaults to | ||
693 | .Em x509_extensions | ||
694 | unless the | ||
695 | .Fl extfile | ||
696 | option is used). | ||
697 | If no extension section is present, then a V1 certificate is created. | ||
698 | If the extension section is present (even if it is empty), | ||
699 | then a V3 certificate is created. | ||
700 | .It Fl extfile Ar file | ||
701 | An additional configuration | ||
702 | .Ar file | ||
703 | to read certificate extensions from | ||
704 | (using the default section unless the | ||
705 | .Fl extensions | ||
706 | option is also used). | ||
707 | .El | ||
708 | .Sh CRL OPTIONS | ||
709 | .Bl -tag -width Ds | ||
710 | .It Fl gencrl | ||
711 | This option generates a CRL based on information in the index file. | ||
712 | .It Fl crldays Ar num | ||
713 | The number of days before the next CRL is due. | ||
714 | This is the days from now to place in the CRL | ||
715 | .Em nextUpdate | ||
716 | field. | ||
717 | .It Fl crlhours Ar num | ||
718 | The number of hours before the next CRL is due. | ||
719 | .It Fl revoke Ar filename | ||
720 | A | ||
721 | .Ar filename | ||
722 | containing a certificate to revoke. | ||
723 | .It Fl subj Ar arg | ||
724 | Supersedes the subject name given in the request. | ||
725 | The | ||
726 | .Ar arg | ||
727 | must be formatted as | ||
728 | .Ar /type0=value0/type1=value1/type2=... ; | ||
729 | characters may be escaped by \e (backslash), no spaces are skipped. | ||
730 | .It Fl crlexts Ar section | ||
731 | The | ||
732 | .Ar section | ||
733 | of the configuration file containing CRL extensions to include. | ||
734 | If no CRL extension section is present then a V1 CRL is created; | ||
735 | if the CRL extension section is present (even if it is empty) | ||
736 | then a V2 CRL is created. | ||
737 | The CRL extensions specified are CRL extensions and | ||
738 | .Em not | ||
739 | CRL entry extensions. | ||
740 | It should be noted that some software (for example Netscape) | ||
741 | can't handle V2 CRLs. | ||
742 | .El | ||
743 | .Sh CA CONFIGURATION FILE OPTIONS | ||
744 | The section of the configuration file containing options for | ||
745 | .Nm ca | ||
746 | is found as follows: | ||
747 | If the | ||
748 | .Fl name | ||
749 | command line option is used, then it names the section to be used. | ||
750 | Otherwise the section to be used must be named in the | ||
751 | .Em default_ca | ||
752 | option of the | ||
753 | .Em ca | ||
754 | section of the configuration file (or in the default section of the | ||
755 | configuration file). | ||
756 | Besides | ||
757 | .Em default_ca , | ||
758 | the following options are read directly from the | ||
759 | .Em ca | ||
760 | section: | ||
761 | .Pp | ||
762 | RANDFILE | ||
763 | preserve | ||
764 | msie_hack | ||
765 | .Pp | ||
766 | With the exception of RANDFILE, this is probably a bug and may | ||
767 | change in future releases. | ||
768 | .Pp | ||
769 | Many of the configuration file options are identical to command line | ||
770 | options. | ||
771 | Where the option is present in the configuration file and the command line, | ||
772 | the command line value is used. | ||
773 | Where an option is described as mandatory, then it must be present in | ||
774 | the configuration file or the command line equivalent (if any) used. | ||
775 | .Pp | ||
776 | .Bl -tag -width Ds | ||
777 | .It Ar oid_file | ||
778 | This specifies a file containing additional OBJECT IDENTIFIERS. | ||
779 | Each line of the file should consist of the numerical form of the | ||
780 | object identifier followed by whitespace, then the short name followed | ||
781 | by whitespace and finally the long name. | ||
782 | .It Ar oid_section | ||
783 | This specifies a section in the configuration file containing extra | ||
784 | object identifiers. | ||
785 | Each line should consist of the short name of the object identifier | ||
786 | followed by | ||
787 | .Cm = | ||
788 | and the numerical form. | ||
789 | The short and long names are the same when this option is used. | ||
790 | .It Ar new_certs_dir | ||
791 | The same as the | ||
792 | .Fl outdir | ||
793 | command line option. | ||
794 | It specifies the directory where new certificates will be placed. | ||
795 | Mandatory. | ||
796 | .It Ar certificate | ||
797 | The same as | ||
798 | .Fl cert. | ||
799 | It gives the file containing the CA certificate. | ||
800 | Mandatory. | ||
801 | .It Ar private_key | ||
802 | Same as the | ||
803 | .Fl keyfile | ||
804 | option. | ||
805 | The file containing the CA private key. | ||
806 | Mandatory. | ||
807 | .It Ar RANDFILE | ||
808 | A file used to read and write random number seed information, | ||
809 | or an EGD socket (see | ||
810 | .Xr RAND_egd 3 ) . | ||
811 | .It Ar default_days | ||
812 | The same as the | ||
813 | .Fl days | ||
814 | option. | ||
815 | The number of days to certify a certificate for. | ||
816 | .It Ar default_startdate | ||
817 | The same as the | ||
818 | .Fl startdate | ||
819 | option. | ||
820 | The start date to certify a certificate for. | ||
821 | If not set, the current time is used. | ||
822 | .It Ar default_enddate | ||
823 | The same as the | ||
824 | .Fl enddate | ||
825 | option. | ||
826 | Either this option or | ||
827 | .Ar default_days | ||
828 | (or the command line equivalents) must be present. | ||
829 | .It Ar default_crl_hours default_crl_days | ||
830 | The same as the | ||
831 | .Fl crlhours | ||
832 | and the | ||
833 | .Fl crldays | ||
834 | options. | ||
835 | These will only be used if neither command line option is present. | ||
836 | At least one of these must be present to generate a CRL. | ||
837 | .It Ar default_md | ||
838 | The same as the | ||
839 | .Fl md | ||
840 | option. | ||
841 | The message digest to use. | ||
842 | Mandatory. | ||
843 | .It Ar database | ||
844 | The text database file to use. | ||
845 | Mandatory. | ||
846 | This file must be present, though initially it will be empty. | ||
847 | .It Ar serialfile | ||
848 | A text file containing the next serial number to use in hex. | ||
849 | Mandatory. | ||
850 | This file must be present and contain a valid serial number. | ||
851 | .It Ar x509_extensions | ||
852 | The same as | ||
853 | .Fl extensions . | ||
854 | .It Ar crl_extensions | ||
855 | the same as | ||
856 | .Fl crlexts . | ||
857 | .It Ar preserve | ||
858 | The same as | ||
859 | .Fl preserveDN . | ||
860 | .It Ar email_in_dn | ||
861 | The same as | ||
862 | .Fl noemailDN . | ||
863 | If the EMAIL field is to be removed from the DN of the certificate, | ||
864 | simply set this to 'no'. | ||
865 | If not present the default is to allow for the EMAIL field in the | ||
866 | certificate's DN. | ||
867 | .It Ar msie_hack | ||
868 | The same as | ||
869 | .Fl msie_hack . | ||
870 | .It Ar policy | ||
871 | The same as | ||
872 | .Fl policy . | ||
873 | Mandatory. | ||
874 | See the | ||
875 | .Sx CA POLICY FORMAT | ||
876 | section for more information. | ||
877 | .It Ar nameopt , certopt | ||
878 | These options allow the format used to display the certificate details | ||
879 | when asking the user to confirm signing. | ||
880 | All the options supported by the | ||
881 | .Nm x509 | ||
882 | utilities' | ||
883 | .Fl nameopt | ||
884 | and | ||
885 | .Fl certopt | ||
886 | switches can be used here, except that | ||
887 | .Ar no_signame | ||
888 | and | ||
889 | .Ar no_sigdump | ||
890 | are permanently set and cannot be disabled | ||
891 | (this is because the certificate signature cannot be displayed because | ||
892 | the certificate has not been signed at this point). | ||
893 | .Pp | ||
894 | For convenience the values | ||
895 | .Em default_ca | ||
896 | are accepted by both to produce a reasonable output. | ||
897 | .Pp | ||
898 | If neither option is present the format used in earlier versions of | ||
899 | .Nm OpenSSL | ||
900 | is used. | ||
901 | Use of the old format is | ||
902 | .Em strongly | ||
903 | discouraged because it only displays fields mentioned in the | ||
904 | .Ar policy | ||
905 | section, | ||
906 | mishandles multicharacter string types and does not display extensions. | ||
907 | .It Ar copy_extensions | ||
908 | Determines how extensions in certificate requests should be handled. | ||
909 | If set to | ||
910 | .Ar none | ||
911 | or this option is not present, then extensions are | ||
912 | ignored and not copied to the certificate. | ||
913 | If set to | ||
914 | .Ar copy | ||
915 | then any extensions present in the request that are not already present | ||
916 | are copied to the certificate. | ||
917 | If set to | ||
918 | .Ar copyall | ||
919 | then all extensions in the request are copied to the certificate: | ||
920 | if the extension is already present in the certificate it is deleted first. | ||
921 | See the | ||
922 | .Sx CA WARNINGS | ||
923 | section before using this option. | ||
924 | .Pp | ||
925 | The main use of this option is to allow a certificate request to supply | ||
926 | values for certain extensions such as | ||
927 | .Em subjectAltName . | ||
928 | .El | ||
929 | .Sh CA POLICY FORMAT | ||
930 | The policy section consists of a set of variables corresponding to | ||
931 | certificate DN fields. | ||
932 | If the value is "match" then the field value | ||
933 | must match the same field in the CA certificate. | ||
934 | If the value is "supplied" then it must be present. | ||
935 | If the value is "optional" then it may be present. | ||
936 | Any fields not mentioned in the policy section | ||
937 | are silently deleted, unless the | ||
938 | .Fl preserveDN | ||
939 | option is set, | ||
940 | but this can be regarded more of a quirk than intended behaviour. | ||
941 | .Sh SPKAC FORMAT | ||
942 | The input to the | ||
943 | .Fl spkac | ||
944 | command line option is a Netscape signed public key and challenge. | ||
945 | This will usually come from the | ||
946 | .Em KEYGEN | ||
947 | tag in an HTML form to create a new private key. | ||
948 | It is, however, possible to create SPKACs using the | ||
949 | .Nm spkac | ||
950 | utility. | ||
951 | .Pp | ||
952 | The file should contain the variable SPKAC set to the value of | ||
953 | the SPKAC and also the required DN components as name value pairs. | ||
954 | If it's necessary to include the same component twice then it can be | ||
955 | preceded by a number and a '.'. | ||
956 | .Sh CA EXAMPLES | ||
957 | .Sy Note: | ||
958 | these examples assume that the | ||
959 | .Nm ca | ||
960 | directory structure is already set up and the relevant files already exist. | ||
961 | This usually involves creating a CA certificate and private key with | ||
962 | .Cm req , | ||
963 | a serial number file and an empty index file and placing them in | ||
964 | the relevant directories. | ||
965 | .Pp | ||
966 | To use the sample configuration file below, the directories | ||
967 | .Pa demoCA , | ||
968 | .Pa demoCA/private | ||
969 | and | ||
970 | .Pa demoCA/newcerts | ||
971 | would be created. | ||
972 | The CA certificate would be copied to | ||
973 | .Pa demoCA/cacert.pem | ||
974 | and its private key to | ||
975 | .Pa demoCA/private/cakey.pem . | ||
976 | A file | ||
977 | .Pa demoCA/serial | ||
978 | would be created containing, for example, "01" and the empty index file | ||
979 | .Pa demoCA/index.txt . | ||
980 | .Pp | ||
981 | Sign a certificate request: | ||
982 | .Pp | ||
983 | \& $ openssl ca -in req.pem -out newcert.pem | ||
984 | .Pp | ||
985 | Sign a certificate request, using CA extensions: | ||
986 | .Pp | ||
987 | \& $ openssl ca -in req.pem -extensions v3_ca -out newcert.pem | ||
988 | .Pp | ||
989 | Generate a CRL: | ||
990 | .Pp | ||
991 | \& $ openssl ca -gencrl -out crl.pem | ||
992 | .Pp | ||
993 | Sign several requests: | ||
994 | .Pp | ||
995 | \& $ openssl ca -infiles req1.pem req2.pem req3.pem | ||
996 | .Pp | ||
997 | Certify a Netscape SPKAC: | ||
998 | .Pp | ||
999 | \& $ openssl ca -spkac spkac.txt | ||
1000 | .Pp | ||
1001 | A sample SPKAC file (the SPKAC line has been truncated for clarity): | ||
1002 | .Pp | ||
1003 | .Bd -literal | ||
1004 | \& SPKAC=MIG0MGAwXDANBgkqhkiG9w0BAQEFAANLADBIAkEAn7PDhCeV/xIxUg8V70YRxK2A5 | ||
1005 | \& CN=Steve Test | ||
1006 | \& emailAddress=steve@openssl.org | ||
1007 | \& 0.OU=OpenSSL Group | ||
1008 | \& 1.OU=Another Group | ||
1009 | .Ed | ||
1010 | .Pp | ||
1011 | A sample configuration file with the relevant sections for | ||
1012 | .Nm ca : | ||
1013 | .Pp | ||
1014 | .Bd -literal | ||
1015 | \& [ ca ] | ||
1016 | \& default_ca = CA_default # The default ca section | ||
1017 | .Pp | ||
1018 | \& [ CA_default ] | ||
1019 | .Pp | ||
1020 | \& dir = ./demoCA # top dir | ||
1021 | \& database = $dir/index.txt # index file | ||
1022 | \& new_certs_dir = $dir/newcerts # new certs dir | ||
1023 | .Pp | ||
1024 | \& certificate = $dir/cacert.pem # The CA cert | ||
1025 | \& serial = $dir/serial # serial no file | ||
1026 | \& private_key = $dir/private/cakey.pem# CA private key | ||
1027 | \& RANDFILE = $dir/private/.rand # random number file | ||
1028 | .Pp | ||
1029 | \& default_days = 365 # how long to certify for | ||
1030 | \& default_crl_days= 30 # how long before next CRL | ||
1031 | \& default_md = md5 # md to use | ||
1032 | .Pp | ||
1033 | \& policy = policy_any # default policy | ||
1034 | \& email_in_dn = no # Don't add the email into cert DN | ||
1035 | .Pp | ||
1036 | \& nameopt = default_ca # Subject name display option | ||
1037 | \& certopt = default_ca # Certificate display option | ||
1038 | \& copy_extensions = none # Don't copy extensions from request | ||
1039 | .Pp | ||
1040 | \& [ policy_any ] | ||
1041 | \& countryName = supplied | ||
1042 | \& stateOrProvinceName = optional | ||
1043 | \& organizationName = optional | ||
1044 | \& organizationalUnitName = optional | ||
1045 | \& commonName = supplied | ||
1046 | \& emailAddress = optional | ||
1047 | .Ed | ||
1048 | .Sh CA WARNINGS | ||
1049 | The | ||
1050 | .Nm ca | ||
1051 | command is quirky and at times downright unfriendly. | ||
1052 | .Pp | ||
1053 | The | ||
1054 | .Nm ca | ||
1055 | utility was originally meant as an example of how to do things in a CA. | ||
1056 | It was not supposed to be used as a full blown CA itself; | ||
1057 | nevertheless some people are using it for this purpose. | ||
1058 | .Pp | ||
1059 | The | ||
1060 | .Nm ca | ||
1061 | command is effectively a single user command: no locking is | ||
1062 | done on the various files and attempts to run more than one | ||
1063 | .Nm ca | ||
1064 | command on the same database can have unpredictable results. | ||
1065 | .Sh CA FILES | ||
1066 | .Sy Note: | ||
1067 | the location of all files can change either by compile time options, | ||
1068 | configuration file entries, environment variables or command line options. | ||
1069 | The values below reflect the default values. | ||
1070 | .Pp | ||
1071 | .Bd -literal | ||
1072 | /usr/local/ssl/lib/openssl.cnf - master configuration file | ||
1073 | \&./demoCA - main CA directory | ||
1074 | \&./demoCA/cacert.pem - CA certificate | ||
1075 | \&./demoCA/private/cakey.pem - CA private key | ||
1076 | \&./demoCA/serial - CA serial number file | ||
1077 | \&./demoCA/serial.old - CA serial number backup file | ||
1078 | \&./demoCA/index.txt - CA text database file | ||
1079 | \&./demoCA/index.txt.old - CA text database backup file | ||
1080 | \&./demoCA/certs - certificate output file | ||
1081 | \&./demoCA/.rnd - CA random seed information | ||
1082 | .Ed | ||
1083 | .Sh CA ENVIRONMENT VARIABLES | ||
1084 | .Em OPENSSL_CONF | ||
1085 | reflects the location of the master configuration file; | ||
1086 | it can be overridden by the | ||
1087 | .Fl config | ||
1088 | command line option. | ||
1089 | .Sh CA RESTRICTIONS | ||
1090 | The text database index file is a critical part of the process, | ||
1091 | and if corrupted it can be difficult to fix. | ||
1092 | It is theoretically possible to rebuild the index file from all the | ||
1093 | issued certificates and a current CRL; however there is no option to do this. | ||
1094 | .Pp | ||
1095 | CRL entry extensions cannot currently be created; only CRL extensions | ||
1096 | can be added. | ||
1097 | .Pp | ||
1098 | V2 CRL features like delta CRL support and CRL numbers are not currently | ||
1099 | supported. | ||
1100 | .Pp | ||
1101 | Although several requests can be input and handled at once, it is only | ||
1102 | possible to include one SPKAC or self-signed certificate. | ||
1103 | .Sh CA BUGS | ||
1104 | The use of an in-memory text database can cause problems when large | ||
1105 | numbers of certificates are present because, as the name implies, | ||
1106 | the database has to be kept in memory. | ||
1107 | .Pp | ||
1108 | It is not possible to certify two certificates with the same DN; this | ||
1109 | is a side effect of how the text database is indexed and it cannot easily | ||
1110 | be fixed without introducing other problems. | ||
1111 | Some S/MIME clients can use two certificates with the same DN for separate | ||
1112 | signing and encryption keys. | ||
1113 | .Pp | ||
1114 | The | ||
1115 | .Nm ca | ||
1116 | command really needs rewriting or the required functionality | ||
1117 | exposed at either a command or interface level so a more friendly utility | ||
1118 | (perl script or GUI) can handle things properly. | ||
1119 | The scripts | ||
1120 | .Nm CA.sh | ||
1121 | and | ||
1122 | .Nm CA.pl | ||
1123 | help a little but not very much. | ||
1124 | .Pp | ||
1125 | Any fields in a request that are not present in a policy are silently | ||
1126 | deleted. | ||
1127 | This does not happen if the | ||
1128 | .Fl preserveDN | ||
1129 | option is used. | ||
1130 | To enforce the absence of the EMAIL field within the DN, as suggested | ||
1131 | by RFCs, regardless of the contents of the request's subject the | ||
1132 | .Fl noemailDN | ||
1133 | option can be used. | ||
1134 | The behaviour should be more friendly and configurable. | ||
1135 | .Pp | ||
1136 | Cancelling some commands by refusing to certify a certificate can | ||
1137 | create an empty file. | ||
1138 | .Sh CA WARNINGS | ||
1139 | The | ||
1140 | .Ar copy_extensions | ||
1141 | option should be used with caution. | ||
1142 | If care is not taken then it can be a security risk. | ||
1143 | For example, if a certificate request contains a | ||
1144 | .Em basicConstraints | ||
1145 | extension with CA:TRUE and the | ||
1146 | .Ar copy_extensions | ||
1147 | value is set to | ||
1148 | .Ar copyall | ||
1149 | and the user does not spot | ||
1150 | this when the certificate is displayed, then this will hand the requestor | ||
1151 | a valid CA certificate. | ||
1152 | .Pp | ||
1153 | This situation can be avoided by setting | ||
1154 | .Ar copy_extensions | ||
1155 | to | ||
1156 | .Ar copy | ||
1157 | and including | ||
1158 | .Em basicConstraints | ||
1159 | with CA:FALSE in the configuration file. | ||
1160 | Then if the request contains a | ||
1161 | .Em basicConstraints | ||
1162 | extension, it will be ignored. | ||
1163 | .Pp | ||
1164 | It is advisable to also include values for other extensions such | ||
1165 | as | ||
1166 | .Ar keyUsage | ||
1167 | to prevent a request supplying its own values. | ||
1168 | .Pp | ||
1169 | Additional restrictions can be placed on the CA certificate itself. | ||
1170 | For example if the CA certificate has: | ||
1171 | .Pp | ||
1172 | \& basicConstraints = CA:TRUE, pathlen:0 | ||
1173 | .Pp | ||
1174 | then even if a certificate is issued with CA:TRUE it will not be valid. | ||
1175 | .\" | ||
1176 | .\" CIPHERS | ||
1177 | .\" | ||
1178 | .Sh CIPHERS | ||
1179 | .Nm openssl ciphers | ||
1180 | .Op Fl v | ||
1181 | .Op Fl ssl2 | ||
1182 | .Op Fl ssl3 | ||
1183 | .Op Fl tls1 | ||
1184 | .Op Cm cipherlist | ||
1185 | .Pp | ||
1186 | The | ||
1187 | .Nm cipherlist | ||
1188 | command converts | ||
1189 | .Nm OpenSSL | ||
1190 | cipher lists into ordered SSL cipher preference lists. | ||
1191 | It can be used as a test tool to determine the appropriate cipherlist. | ||
1192 | .Pp | ||
1193 | The options are as follows: | ||
1194 | .Bl -tag -width -Ds | ||
1195 | .It Fl v | ||
1196 | Verbose option. | ||
1197 | List ciphers with a complete description of protocol version | ||
1198 | (SSLv2 or SSLv3; the latter includes TLS), key exchange, | ||
1199 | authentication, encryption and mac algorithms used along with any key size | ||
1200 | restrictions and whether the algorithm is classed as an | ||
1201 | .Em export | ||
1202 | cipher. | ||
1203 | Note that without the | ||
1204 | .Fl v | ||
1205 | option, ciphers may seem to appear twice in a cipher list; | ||
1206 | this is when similar ciphers are available for | ||
1207 | SSL v2 and for SSL v3/TLS v1. | ||
1208 | .It Fl ssl3 | ||
1209 | Only include SSL v3 ciphers. | ||
1210 | .It Fl ssl2 | ||
1211 | Only include SSL v2 ciphers. | ||
1212 | .It Fl tls1 | ||
1213 | Only include TLS v1 ciphers. | ||
1214 | .It Fl h , ? | ||
1215 | Print a brief usage message. | ||
1216 | .It Fl cipherlist | ||
1217 | A cipher list to convert to a cipher preference list. | ||
1218 | If it is not included, then the default cipher list will be used. | ||
1219 | The format is described below. | ||
1220 | .El | ||
1221 | .Sh CIPHERS LIST FORMAT | ||
1222 | The cipher list consists of one or more | ||
1223 | .Em cipher strings | ||
1224 | separated by colons. | ||
1225 | Commas or spaces are also acceptable separators, but colons are normally used. | ||
1226 | .Pp | ||
1227 | The actual | ||
1228 | .Em cipher string | ||
1229 | can take several different forms: | ||
1230 | .Pp | ||
1231 | It can consist of a single cipher suite such as | ||
1232 | .Em RC4-SHA . | ||
1233 | .Pp | ||
1234 | It can represent a list of cipher suites containing a certain algorithm, | ||
1235 | or cipher suites of a certain type. | ||
1236 | For example | ||
1237 | .Em SHA1 | ||
1238 | represents all cipher suites using the digest algorithm SHA1, and | ||
1239 | .Em SSLv3 | ||
1240 | represents all SSL v3 algorithms. | ||
1241 | .Pp | ||
1242 | Lists of cipher suites can be combined in a single | ||
1243 | .Em cipher string | ||
1244 | using the | ||
1245 | .Cm + | ||
1246 | character. | ||
1247 | This is used as a logical | ||
1248 | .Em and | ||
1249 | operation. | ||
1250 | For example, | ||
1251 | .Em SHA1+DES | ||
1252 | represents all cipher suites containing the SHA1 and the DES algorithms. | ||
1253 | .Pp | ||
1254 | Each cipher string can be optionally preceded by the characters | ||
1255 | .Cm ! , - | ||
1256 | or | ||
1257 | .Cm + . | ||
1258 | .Pp | ||
1259 | If | ||
1260 | .Cm ! | ||
1261 | is used, then the ciphers are permanently deleted from the list. | ||
1262 | The ciphers deleted can never reappear in the list even if they are | ||
1263 | explicitly stated. | ||
1264 | .Pp | ||
1265 | If | ||
1266 | .Cm - | ||
1267 | is used, then the ciphers are deleted from the list, but some or | ||
1268 | all of the ciphers can be added again by later options. | ||
1269 | .br | ||
1270 | .Pp | ||
1271 | If | ||
1272 | .Cm + | ||
1273 | is used, then the ciphers are moved to the end of the list. | ||
1274 | This option doesn't add any new ciphers, it just moves matching existing ones. | ||
1275 | .Pp | ||
1276 | If none of these characters is present, then the string is just interpreted | ||
1277 | as a list of ciphers to be appended to the current preference list. | ||
1278 | If the list includes any ciphers already present they will be ignored; | ||
1279 | that is, they will not be moved to the end of the list. | ||
1280 | .Pp | ||
1281 | Additionally the cipher string | ||
1282 | .Em @STRENGTH | ||
1283 | can be used at any point to sort the current cipher list in order of | ||
1284 | encryption algorithm key length. | ||
1285 | .Sh CIPHERS STRINGS | ||
1286 | The following is a list of all permitted cipher strings and their meanings. | ||
1287 | .Bl -tag -width Ds | ||
1288 | .It Ar DEFAULT | ||
1289 | The default cipher list. | ||
1290 | This is determined at compile time and is normally | ||
1291 | .Ar ALL:!ADH:RC4+RSA:+SSLv2:@STRENGTH . | ||
1292 | This must be the first | ||
1293 | .Ar cipher string | ||
1294 | specified. | ||
1295 | .It Ar COMPLEMENTOFDEFAULT | ||
1296 | The ciphers included in | ||
1297 | .Ar ALL , | ||
1298 | but not enabled by default. | ||
1299 | Currently this is | ||
1300 | .Ar ADH . | ||
1301 | Note that this rule does not cover | ||
1302 | .Ar eNULL , | ||
1303 | which is not included by | ||
1304 | .Ar ALL | ||
1305 | (use | ||
1306 | .Ar COMPLEMENTOFALL | ||
1307 | if necessary). | ||
1308 | .It Ar ALL | ||
1309 | All ciphers suites except the | ||
1310 | .Ar eNULL | ||
1311 | ciphers which must be explicitly enabled. | ||
1312 | .It Ar COMPLEMENTOFALL | ||
1313 | The cipher suites not enabled by | ||
1314 | .Ar ALL , | ||
1315 | currently being | ||
1316 | .Ar eNULL . | ||
1317 | .It Ar HIGH | ||
1318 | "High" encryption cipher suites. | ||
1319 | This currently means those with key lengths larger than 128 bits. | ||
1320 | .It Ar MEDIUM | ||
1321 | "Medium" encryption cipher suites, currently those using 128 bit encryption. | ||
1322 | .It Ar LOW | ||
1323 | "Low" encryption cipher suites, currently those using 64 or 56 bit encryption | ||
1324 | algorithms, but excluding export cipher suites. | ||
1325 | .It Ar EXP , EXPORT | ||
1326 | Export encryption algorithms. | ||
1327 | Including 40 and 56 bits algorithms. | ||
1328 | .It Ar EXPORT40 | ||
1329 | 40 bit export encryption algorithms | ||
1330 | .It Ar EXPORT56 | ||
1331 | 56 bit export encryption algorithms. | ||
1332 | .It Ar eNULL, NULL | ||
1333 | The "NULL" ciphers; that is those offering no encryption. | ||
1334 | Because these offer no encryption at all and are a security risk | ||
1335 | they are disabled unless explicitly included. | ||
1336 | .It Ar aNULL | ||
1337 | The cipher suites offering no authentication. | ||
1338 | This is currently the anonymous DH algorithms. | ||
1339 | These cipher suites are vulnerable to a "man in the middle" | ||
1340 | attack and so their use is normally discouraged. | ||
1341 | .It Ar kRSA , RSA | ||
1342 | Cipher suites using RSA key exchange. | ||
1343 | .It Ar kEDH | ||
1344 | Cipher suites using ephemeral DH key agreement. | ||
1345 | .It Ar kDHr , kDHd | ||
1346 | Cipher suites using DH key agreement and DH certificates signed by | ||
1347 | CAs with RSA and DSS keys respectively. | ||
1348 | Not implemented. | ||
1349 | .It Ar aRSA | ||
1350 | Cipher suites using RSA authentication, i.e. the certificates carry RSA keys. | ||
1351 | .It Ar aDSS , DSS | ||
1352 | Cipher suites using DSS authentication, i.e. the certificates carry DSS keys. | ||
1353 | .It Ar aDH | ||
1354 | Cipher suites effectively using DH authentication, i.e. the certificates carry | ||
1355 | DH keys. | ||
1356 | Not implemented. | ||
1357 | .It Ar kFZA , aFZA , eFZA , FZA | ||
1358 | Ciphers suites using FORTEZZA key exchange, authentication, encryption | ||
1359 | or all FORTEZZA algorithms. | ||
1360 | Not implemented. | ||
1361 | .It Ar TLSv1 , SSLv3 , SSLv2 | ||
1362 | TLS v1.0, SSL v3.0 or SSL v2.0 cipher suites, respectively. | ||
1363 | .It Ar DH | ||
1364 | Cipher suites using DH, including anonymous DH. | ||
1365 | .It Ar ADH | ||
1366 | Anonymous DH cipher suites. | ||
1367 | .It Ar 3DES | ||
1368 | Cipher suites using triple DES. | ||
1369 | .It Ar DES | ||
1370 | Cipher suites using DES (not triple DES). | ||
1371 | .It Ar RC4 | ||
1372 | Cipher suites using RC4. | ||
1373 | .It Ar RC2 | ||
1374 | Cipher suites using RC2. | ||
1375 | .It Ar IDEA | ||
1376 | Cipher suites using IDEA. | ||
1377 | .It Ar MD5 | ||
1378 | Cipher suites using MD5. | ||
1379 | .It Ar SHA1 , SHA | ||
1380 | Cipher suites using SHA1. | ||
1381 | .El | ||
1382 | .Sh CIPHERS SUITE NAMES | ||
1383 | The following lists give the SSL or TLS cipher suites names from the | ||
1384 | relevant specification and their | ||
1385 | .Nm OpenSSL | ||
1386 | equivalents. | ||
1387 | .Pp | ||
1388 | .Cm SSL v3.0 cipher suites | ||
1389 | .Pp | ||
1390 | .Bd -literal | ||
1391 | \& SSL_RSA_WITH_NULL_MD5 NULL-MD5 | ||
1392 | \& SSL_RSA_WITH_NULL_SHA NULL-SHA | ||
1393 | \& SSL_RSA_EXPORT_WITH_RC4_40_MD5 EXP-RC4-MD5 | ||
1394 | \& SSL_RSA_WITH_RC4_128_MD5 RC4-MD5 | ||
1395 | \& SSL_RSA_WITH_RC4_128_SHA RC4-SHA | ||
1396 | \& SSL_RSA_EXPORT_WITH_RC2_CBC_40_MD5 EXP-RC2-CBC-MD5 | ||
1397 | \& SSL_RSA_WITH_IDEA_CBC_SHA IDEA-CBC-SHA | ||
1398 | \& SSL_RSA_EXPORT_WITH_DES40_CBC_SHA EXP-DES-CBC-SHA | ||
1399 | \& SSL_RSA_WITH_DES_CBC_SHA DES-CBC-SHA | ||
1400 | \& SSL_RSA_WITH_3DES_EDE_CBC_SHA DES-CBC3-SHA | ||
1401 | .Ed | ||
1402 | .Pp | ||
1403 | .Bd -literal | ||
1404 | \& SSL_DH_DSS_EXPORT_WITH_DES40_CBC_SHA Not implemented. | ||
1405 | \& SSL_DH_DSS_WITH_DES_CBC_SHA Not implemented. | ||
1406 | \& SSL_DH_DSS_WITH_3DES_EDE_CBC_SHA Not implemented. | ||
1407 | \& SSL_DH_RSA_EXPORT_WITH_DES40_CBC_SHA Not implemented. | ||
1408 | \& SSL_DH_RSA_WITH_DES_CBC_SHA Not implemented. | ||
1409 | \& SSL_DH_RSA_WITH_3DES_EDE_CBC_SHA Not implemented. | ||
1410 | \& SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA EXP-EDH-DSS-DES-CBC-SHA | ||
1411 | \& SSL_DHE_DSS_WITH_DES_CBC_SHA EDH-DSS-CBC-SHA | ||
1412 | \& SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA EDH-DSS-DES-CBC3-SHA | ||
1413 | \& SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA EXP-EDH-RSA-DES-CBC-SHA | ||
1414 | \& SSL_DHE_RSA_WITH_DES_CBC_SHA EDH-RSA-DES-CBC-SHA | ||
1415 | \& SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA EDH-RSA-DES-CBC3-SHA | ||
1416 | .Ed | ||
1417 | .Pp | ||
1418 | .Bd -literal | ||
1419 | \& SSL_DH_anon_EXPORT_WITH_RC4_40_MD5 EXP-ADH-RC4-MD5 | ||
1420 | \& SSL_DH_anon_WITH_RC4_128_MD5 ADH-RC4-MD5 | ||
1421 | \& SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA EXP-ADH-DES-CBC-SHA | ||
1422 | \& SSL_DH_anon_WITH_DES_CBC_SHA ADH-DES-CBC-SHA | ||
1423 | \& SSL_DH_anon_WITH_3DES_EDE_CBC_SHA ADH-DES-CBC3-SHA | ||
1424 | .Ed | ||
1425 | .Pp | ||
1426 | .Bd -literal | ||
1427 | \& SSL_FORTEZZA_KEA_WITH_NULL_SHA Not implemented. | ||
1428 | \& SSL_FORTEZZA_KEA_WITH_FORTEZZA_CBC_SHA Not implemented. | ||
1429 | \& SSL_FORTEZZA_KEA_WITH_RC4_128_SHA Not implemented. | ||
1430 | .Ed | ||
1431 | .Pp | ||
1432 | .Cm TLS v1.0 cipher suites | ||
1433 | .Pp | ||
1434 | .Bd -literal | ||
1435 | \& TLS_RSA_WITH_NULL_MD5 NULL-MD5 | ||
1436 | \& TLS_RSA_WITH_NULL_SHA NULL-SHA | ||
1437 | \& TLS_RSA_EXPORT_WITH_RC4_40_MD5 EXP-RC4-MD5 | ||
1438 | \& TLS_RSA_WITH_RC4_128_MD5 RC4-MD5 | ||
1439 | \& TLS_RSA_WITH_RC4_128_SHA RC4-SHA | ||
1440 | \& TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5 EXP-RC2-CBC-MD5 | ||
1441 | \& TLS_RSA_WITH_IDEA_CBC_SHA IDEA-CBC-SHA | ||
1442 | \& TLS_RSA_EXPORT_WITH_DES40_CBC_SHA EXP-DES-CBC-SHA | ||
1443 | \& TLS_RSA_WITH_DES_CBC_SHA DES-CBC-SHA | ||
1444 | \& TLS_RSA_WITH_3DES_EDE_CBC_SHA DES-CBC3-SHA | ||
1445 | .Ed | ||
1446 | .Pp | ||
1447 | .Bd -literal | ||
1448 | \& TLS_DH_DSS_EXPORT_WITH_DES40_CBC_SHA Not implemented. | ||
1449 | \& TLS_DH_DSS_WITH_DES_CBC_SHA Not implemented. | ||
1450 | \& TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA Not implemented. | ||
1451 | \& TLS_DH_RSA_EXPORT_WITH_DES40_CBC_SHA Not implemented. | ||
1452 | \& TLS_DH_RSA_WITH_DES_CBC_SHA Not implemented. | ||
1453 | \& TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA Not implemented. | ||
1454 | \& TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA EXP-EDH-DSS-DES-CBC-SHA | ||
1455 | \& TLS_DHE_DSS_WITH_DES_CBC_SHA EDH-DSS-CBC-SHA | ||
1456 | \& TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA EDH-DSS-DES-CBC3-SHA | ||
1457 | \& TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA EXP-EDH-RSA-DES-CBC-SHA | ||
1458 | \& TLS_DHE_RSA_WITH_DES_CBC_SHA EDH-RSA-DES-CBC-SHA | ||
1459 | \& TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA EDH-RSA-DES-CBC3-SHA | ||
1460 | .Ed | ||
1461 | .Pp | ||
1462 | .Bd -literal | ||
1463 | \& TLS_DH_anon_EXPORT_WITH_RC4_40_MD5 EXP-ADH-RC4-MD5 | ||
1464 | \& TLS_DH_anon_WITH_RC4_128_MD5 ADH-RC4-MD5 | ||
1465 | \& TLS_DH_anon_EXPORT_WITH_DES40_CBC_SHA EXP-ADH-DES-CBC-SHA | ||
1466 | \& TLS_DH_anon_WITH_DES_CBC_SHA ADH-DES-CBC-SHA | ||
1467 | \& TLS_DH_anon_WITH_3DES_EDE_CBC_SHA ADH-DES-CBC3-SHA | ||
1468 | .Ed | ||
1469 | .Pp | ||
1470 | .Cm Additional Export 1024 and other cipher suites | ||
1471 | .Pp | ||
1472 | .Sy Note: | ||
1473 | These ciphers can also be used in SSL v3. | ||
1474 | .Pp | ||
1475 | .Bd -literal | ||
1476 | \& TLS_RSA_EXPORT1024_WITH_DES_CBC_SHA EXP1024-DES-CBC-SHA | ||
1477 | \& TLS_RSA_EXPORT1024_WITH_RC4_56_SHA EXP1024-RC4-SHA | ||
1478 | \& TLS_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA EXP1024-DHE-DSS-DES-CBC-SHA | ||
1479 | \& TLS_DHE_DSS_EXPORT1024_WITH_RC4_56_SHA EXP1024-DHE-DSS-RC4-SHA | ||
1480 | \& TLS_DHE_DSS_WITH_RC4_128_SHA DHE-DSS-RC4-SHA | ||
1481 | .Ed | ||
1482 | .Pp | ||
1483 | .Cm SSL v2.0 cipher suites | ||
1484 | .Bd -literal | ||
1485 | .Pp | ||
1486 | \& SSL_CK_RC4_128_WITH_MD5 RC4-MD5 | ||
1487 | \& SSL_CK_RC4_128_EXPORT40_WITH_MD5 EXP-RC4-MD5 | ||
1488 | \& SSL_CK_RC2_128_CBC_WITH_MD5 RC2-MD5 | ||
1489 | \& SSL_CK_RC2_128_CBC_EXPORT40_WITH_MD5 EXP-RC2-MD5 | ||
1490 | \& SSL_CK_IDEA_128_CBC_WITH_MD5 IDEA-CBC-MD5 | ||
1491 | \& SSL_CK_DES_64_CBC_WITH_MD5 DES-CBC-MD5 | ||
1492 | \& SSL_CK_DES_192_EDE3_CBC_WITH_MD5 DES-CBC3-MD5 | ||
1493 | .Ed | ||
1494 | .Pp | ||
1495 | .Sh CIPHERS NOTES | ||
1496 | The non-ephemeral DH modes are currently unimplemented in | ||
1497 | .Nm OpenSSL | ||
1498 | because there is no support for DH certificates. | ||
1499 | .Pp | ||
1500 | Some compiled versions of | ||
1501 | .Nm OpenSSL | ||
1502 | may not include all the ciphers | ||
1503 | listed here because some ciphers were excluded at compile time. | ||
1504 | .Sh CIPHERS EXAMPLES | ||
1505 | Verbose listing of all | ||
1506 | .Nm OpenSSL | ||
1507 | ciphers including NULL ciphers: | ||
1508 | .Pp | ||
1509 | \& $ openssl ciphers -v 'ALL:eNULL' | ||
1510 | .Pp | ||
1511 | Include all ciphers except NULL and anonymous DH then sort by | ||
1512 | strength: | ||
1513 | .Pp | ||
1514 | \& $ openssl ciphers -v 'ALL:!ADH:@STRENGTH' | ||
1515 | .Pp | ||
1516 | Include only 3DES ciphers and then place RSA ciphers last: | ||
1517 | .Pp | ||
1518 | \& $ openssl ciphers -v '3DES:+RSA' | ||
1519 | .Pp | ||
1520 | Include all RC4 ciphers but leave out those without authentication: | ||
1521 | .Pp | ||
1522 | \& $ openssl ciphers -v 'RC4:!COMPLEMENTOFDEFAULT' | ||
1523 | .Pp | ||
1524 | Include all ciphers with RSA authentication but leave out ciphers without | ||
1525 | encryption: | ||
1526 | .Pp | ||
1527 | \& $ openssl ciphers -v 'RSA:!COMPLEMENTOFALL' | ||
1528 | .Sh CIPHERS HISTORY | ||
1529 | The | ||
1530 | .Ar COMPLENTOFALL | ||
1531 | and | ||
1532 | .Ar COMPLEMENTOFDEFAULT | ||
1533 | selection options were added in version 0.9.7. | ||
1534 | .\" | ||
1535 | .\" crl | ||
1536 | .\" | ||
1537 | .Sh CRL | ||
1538 | .Nm openssl crl | ||
1539 | .Op Fl inform Ar PEM|DER | ||
1540 | .Op Fl outform Ar PEM|DER | ||
1541 | .Op Fl text | ||
1542 | .Op Fl in Ar filename | ||
1543 | .Op Fl out Ar filename | ||
1544 | .Op Fl noout | ||
1545 | .Op Fl hash | ||
1546 | .Op Fl issuer | ||
1547 | .Op Fl lastupdate | ||
1548 | .Op Fl nextupdate | ||
1549 | .Op Cm CAfile Ar file | ||
1550 | .Op Cm CApath Ar dir | ||
1551 | .Pp | ||
1552 | The | ||
1553 | .Nm crl | ||
1554 | command processes CRL files in | ||
1555 | .Ar DER | ||
1556 | or | ||
1557 | .Ar PEM | ||
1558 | format. | ||
1559 | .Pp | ||
1560 | The options are as follows: | ||
1561 | .Bl -tag -width Ds | ||
1562 | .It Fl inform Ar DER|PEM | ||
1563 | This specifies the input format. | ||
1564 | .Ar DER | ||
1565 | format is DER encoded CRL structure. | ||
1566 | .Ar PEM | ||
1567 | (the default) is a base64 encoded version of the DER form with header | ||
1568 | and footer lines. | ||
1569 | .It Fl outform Ar DER|PEM | ||
1570 | This specifies the output format; the options have the same meaning as the | ||
1571 | .Fl inform | ||
1572 | option. | ||
1573 | .It Fl in Ar filename | ||
1574 | This specifies the input filename to read from or standard input if this | ||
1575 | option is not specified. | ||
1576 | .It Fl out Ar filename | ||
1577 | Specifies the output filename to write to, or standard output by | ||
1578 | default. | ||
1579 | .It Fl text | ||
1580 | Print out the CRL in text form. | ||
1581 | .It Fl noout | ||
1582 | Don't output the encoded version of the CRL. | ||
1583 | .It Fl hash | ||
1584 | Output a hash of the issuer name. | ||
1585 | This can be used to lookup CRLs in a directory by issuer name. | ||
1586 | .It Fl issuer | ||
1587 | Output the issuer name. | ||
1588 | .It Fl lastupdate | ||
1589 | Output the | ||
1590 | .Ar lastUpdate | ||
1591 | field. | ||
1592 | .It Fl nextupdate | ||
1593 | Output the | ||
1594 | .Ar nextUpdate | ||
1595 | field. | ||
1596 | .It Fl CAfile Ar file | ||
1597 | Verify the signature on a CRL by looking up the issuing certificate in | ||
1598 | .Ar file . | ||
1599 | .It Fl CApath Ar dir | ||
1600 | Verify the signature on a CRL by looking up the issuing certificate in | ||
1601 | .Ar dir . | ||
1602 | This directory must be a standard certificate directory, | ||
1603 | i.e. a hash of each subject name (using | ||
1604 | .Cm x509 Fl hash ) | ||
1605 | should be linked to each certificate. | ||
1606 | .El | ||
1607 | .Sh CRL NOTES | ||
1608 | The PEM CRL format uses the header and footer lines: | ||
1609 | .Pp | ||
1610 | .Bd -literal | ||
1611 | \& -----BEGIN X509 CRL----- | ||
1612 | \& -----END X509 CRL----- | ||
1613 | .Ed | ||
1614 | .Sh CRL EXAMPLES | ||
1615 | Convert a CRL file from | ||
1616 | .Ar PEM | ||
1617 | to | ||
1618 | .Ar DER : | ||
1619 | .Pp | ||
1620 | \& $ openssl crl -in crl.pem -outform DER -out crl.der | ||
1621 | .Pp | ||
1622 | Output the text form of a | ||
1623 | .Ar DER | ||
1624 | encoded certificate: | ||
1625 | .Pp | ||
1626 | \& $ openssl crl -in crl.der -text -noout | ||
1627 | .Sh CRL BUGS | ||
1628 | Ideally it should be possible to create a CRL using appropriate options | ||
1629 | and files too. | ||
1630 | .\" | ||
1631 | .\" CRL2PKCS7 | ||
1632 | .\" | ||
1633 | .Sh CRL2PKCS7 | ||
1634 | .Nm openssl crl2pkcs7 | ||
1635 | .Op Fl inform Ar PEM|DER | ||
1636 | .Op Fl outform Ar PEM|DER | ||
1637 | .Op Fl in Ar filename | ||
1638 | .Op Fl out Ar filename | ||
1639 | .Op Fl certfile Ar filename | ||
1640 | .Op Fl nocrl | ||
1641 | .Pp | ||
1642 | The | ||
1643 | .Nm crl2pkcs7 | ||
1644 | command takes an optional CRL and one or more | ||
1645 | certificates and converts them into a PKCS#7 degenerate | ||
1646 | "certificates only" structure. | ||
1647 | .Pp | ||
1648 | The options are as follows: | ||
1649 | .Bl -tag -width Ds | ||
1650 | .It Fl inform Ar DER|PEM | ||
1651 | This specifies the CRL input format. | ||
1652 | .Ar DER | ||
1653 | format is DER encoded CRL structure. | ||
1654 | .Ar PEM | ||
1655 | (the default) is a base64 encoded version of the DER form with header | ||
1656 | and footer lines. | ||
1657 | .It Fl outform Ar DER|PEM | ||
1658 | This specifies the PKCS#7 structure output format. | ||
1659 | .Ar DER | ||
1660 | format is DER encoded PKCS#7 structure. | ||
1661 | .Ar PEM | ||
1662 | (the default) is a base64 encoded version of the DER form with header | ||
1663 | and footer lines. | ||
1664 | .It Fl in Ar filename | ||
1665 | This specifies the input | ||
1666 | .Ar filename | ||
1667 | to read a CRL from or standard input if this option is not specified. | ||
1668 | .It Fl out Ar filename | ||
1669 | Specifies the output | ||
1670 | .Ar filename | ||
1671 | to write the PKCS#7 structure to or standard output by default. | ||
1672 | .It Fl certfile Ar filename | ||
1673 | Specifies a | ||
1674 | .Ar filename | ||
1675 | containing one or more certificates in | ||
1676 | .Ar PEM | ||
1677 | format. | ||
1678 | All certificates in the file will be added to the PKCS#7 structure. | ||
1679 | This option can be used more than once to read certificates form multiple | ||
1680 | files. | ||
1681 | .It Fl nocrl | ||
1682 | Normally a CRL is included in the output file. | ||
1683 | With this option, no CRL is | ||
1684 | included in the output file and a CRL is not read from the input file. | ||
1685 | .El | ||
1686 | .Sh CRL2PKCS7 EXAMPLES | ||
1687 | Create a PKCS#7 structure from a certificate and CRL: | ||
1688 | .Pp | ||
1689 | \& $ openssl crl2pkcs7 -in crl.pem -certfile cert.pem -out p7.pem | ||
1690 | .Pp | ||
1691 | Creates a PKCS#7 structure in | ||
1692 | .Ar DER | ||
1693 | format with no CRL from several | ||
1694 | different certificates: | ||
1695 | .Pp | ||
1696 | .Bd -literal | ||
1697 | \& $ openssl crl2pkcs7 -nocrl -certfile newcert.pem | ||
1698 | \& -certfile demoCA/cacert.pem -outform DER -out p7.der | ||
1699 | .Ed | ||
1700 | .Sh CRL2PKCS7 NOTES | ||
1701 | The output file is a PKCS#7 signed data structure containing no signers and | ||
1702 | just certificates and an optional CRL. | ||
1703 | .Pp | ||
1704 | This utility can be used to send certificates and CAs to Netscape as part of | ||
1705 | the certificate enrollment process. | ||
1706 | This involves sending the DER encoded output | ||
1707 | as MIME type | ||
1708 | .Em application/x-x509-user-cert . | ||
1709 | .Pp | ||
1710 | The | ||
1711 | .Ar PEM | ||
1712 | encoded form with the header and footer lines removed can be used to | ||
1713 | install user certificates and CAs in MSIE using the Xenroll control. | ||
1714 | .\" | ||
1715 | .\" DGST | ||
1716 | .\" | ||
1717 | .Sh DGST | ||
1718 | .Nm openssl dgst | ||
1719 | .Op Cm -md5|-md4|-md2|-sha1|-sha|-mdc2|-ripemd160|-dss1 | ||
1720 | .Op Fl c | ||
1721 | .Op Fl d | ||
1722 | .Op Fl hex | ||
1723 | .Op Fl binary | ||
1724 | .Op Fl out Ar filename | ||
1725 | .Op Fl sign Ar filename | ||
1726 | .Op Fl verify Ar filename | ||
1727 | .Op Fl prverify Ar filename | ||
1728 | .Op Fl rand Ar file ... | ||
1729 | .Op Fl signature Ar filename | ||
1730 | .Op Ar file ... | ||
1731 | .Pp | ||
1732 | .Cm md5|md4|md2|sha1|sha|mdc2|ripemd160 | ||
1733 | .Op Fl c | ||
1734 | .Op Fl d | ||
1735 | .Op Ar file ... | ||
1736 | .Pp | ||
1737 | The digest functions output the message digest of a supplied | ||
1738 | .Ar file | ||
1739 | or | ||
1740 | .Ar files | ||
1741 | in hexadecimal form. | ||
1742 | They can also be used for digital signing and verification. | ||
1743 | .Pp | ||
1744 | The options are as follows: | ||
1745 | .Bl -tag -width Ds | ||
1746 | .It Fl c | ||
1747 | Print out the digest in two digit groups separated by colons, only relevant if | ||
1748 | .Em hex | ||
1749 | format output is used. | ||
1750 | .It Fl d | ||
1751 | Print out BIO debugging information. | ||
1752 | .It Fl hex | ||
1753 | Digest is to be output as a hex dump. | ||
1754 | This is the default case for a "normal" | ||
1755 | digest as opposed to a digital signature. | ||
1756 | .It Fl binary | ||
1757 | Output the digest or signature in binary form. | ||
1758 | .It Fl out Ar filename | ||
1759 | Filename to output to, or standard output by default. | ||
1760 | .It Fl sign Ar filename | ||
1761 | Digitally sign the digest using the private key in | ||
1762 | .Ar filename . | ||
1763 | .It Fl verify Ar filename | ||
1764 | Verify the signature using the the public key in | ||
1765 | .Ar filename. | ||
1766 | The output is either "Verification OK" or "Verification Failure". | ||
1767 | .It Fl prverify Ar filename | ||
1768 | Verify the signature using the private key in | ||
1769 | .Ar filename . | ||
1770 | .It Fl rand Ar file ... | ||
1771 | A | ||
1772 | .Ar file | ||
1773 | or | ||
1774 | .Ar file Ns Li s | ||
1775 | containing random data used to seed the random number | ||
1776 | generator, or an EGD socket (see | ||
1777 | .Xr RAND_egd 3 ) . | ||
1778 | Multiple files can be specified separated by an OS-dependent character. | ||
1779 | The separator is | ||
1780 | .Cm \&; | ||
1781 | for MS-Windows, | ||
1782 | .Cm \&, | ||
1783 | for OpenVMS, and | ||
1784 | .Cm \&: | ||
1785 | for all others. | ||
1786 | .It Fl signature Ar filename | ||
1787 | The actual signature to verify. | ||
1788 | .It Ar file ... | ||
1789 | File or files to digest. | ||
1790 | If no files are specified then standard input is used. | ||
1791 | .El | ||
1792 | .Sh DGST NOTES | ||
1793 | The digest of choice for all new applications is SHA1. | ||
1794 | Other digests are, however, still widely used. | ||
1795 | .Pp | ||
1796 | If you wish to sign or verify data using the DSA algorithm then the dss1 | ||
1797 | digest must be used. | ||
1798 | .Pp | ||
1799 | A source of random numbers is required for certain signing algorithms, in | ||
1800 | particular DSA. | ||
1801 | .Pp | ||
1802 | The signing and verify options should only be used if a single file is | ||
1803 | being signed or verified. | ||
1804 | .\" | ||
1805 | .\" DH | ||
1806 | .\" | ||
1807 | .Sh DH | ||
1808 | Diffie-Hellman Parameter Management. The | ||
1809 | .Nm dh | ||
1810 | command has been replaced by | ||
1811 | .Nm dhparam. | ||
1812 | See | ||
1813 | .Sx DHPARAM | ||
1814 | below. | ||
1815 | .\" | ||
1816 | .\" DHPARAM | ||
1817 | .\" | ||
1818 | .Sh DHPARAM | ||
1819 | .Nm openssl dhparam | ||
1820 | .Bk -words | ||
1821 | .Op Fl inform Ar DER|PEM | ||
1822 | .Op Fl outform Ar DER|PEM | ||
1823 | .Op Fl in Ar filename | ||
1824 | .Op Fl out Ar filename | ||
1825 | .Op Fl dsaparam | ||
1826 | .Op Fl noout | ||
1827 | .Op Fl text | ||
1828 | .Op Fl C | ||
1829 | .Op Fl 2 | ||
1830 | .Op Fl 5 | ||
1831 | .Op Fl rand Ar file ... | ||
1832 | .Op Ar numbits | ||
1833 | .Ek | ||
1834 | .Pp | ||
1835 | The | ||
1836 | .Nm dhparam | ||
1837 | command is used to manipulate DH parameter files. | ||
1838 | .Pp | ||
1839 | The options are as follows: | ||
1840 | .Bl -tag -width Ds | ||
1841 | .It Fl inform Ar DER|PEM | ||
1842 | This specifies the input format. | ||
1843 | The argument | ||
1844 | .Ar DER | ||
1845 | uses an ASN1 DER encoded form compatible with the PKCS#3 DHparameter | ||
1846 | structure. | ||
1847 | The | ||
1848 | .Ar PEM | ||
1849 | form is the default format: | ||
1850 | it consists of the DER format base64 encoded with | ||
1851 | additional header and footer lines. | ||
1852 | .It Fl outform Ar DER|PEM | ||
1853 | This specifies the output format, the options have the same meaning as the | ||
1854 | .Fl inform | ||
1855 | option. | ||
1856 | .It Fl in Ar filename | ||
1857 | This specifies the input | ||
1858 | .Ar filename | ||
1859 | to read parameters from or standard input if this option is not specified. | ||
1860 | .It Fl out Ar filename | ||
1861 | This specifies the output | ||
1862 | .Ar filename | ||
1863 | to write parameters to. | ||
1864 | Standard output is used if this option is not present. | ||
1865 | The output filename should | ||
1866 | .Em not | ||
1867 | be the same as the input filename. | ||
1868 | .It Fl dsaparam | ||
1869 | If this option is used, DSA rather than DH parameters are read or created; | ||
1870 | they are converted to DH format. | ||
1871 | Otherwise, "strong" primes (such that (p-1)/2 is also prime) | ||
1872 | will be used for DH parameter generation. | ||
1873 | .Pp | ||
1874 | DH parameter generation with the | ||
1875 | .Fl dsaparam | ||
1876 | option is much faster, | ||
1877 | and the recommended exponent length is shorter, | ||
1878 | which makes DH key exchange more efficient. | ||
1879 | Beware that with such DSA-style DH parameters, | ||
1880 | a fresh DH key should be created for each use to | ||
1881 | avoid small-subgroup attacks that may be possible otherwise. | ||
1882 | .It Fl 2 , 5 | ||
1883 | The generator to use, either 2 or 5. | ||
1884 | 2 is the default. | ||
1885 | If present then the input file is ignored and parameters are generated instead. | ||
1886 | .It Fl rand Ar file ... | ||
1887 | A | ||
1888 | .Ar file | ||
1889 | or | ||
1890 | .Ar file Ns Li s | ||
1891 | containing random data used to seed the random number generator, | ||
1892 | or an EGD socket (see | ||
1893 | .Xr RAND_egd 3 ) . | ||
1894 | Multiple files can be specified, separated by an OS-dependent character. | ||
1895 | The separator is | ||
1896 | .Cm \&; | ||
1897 | for MS-Windows, | ||
1898 | .Cm \&, | ||
1899 | for OpenVMS, and | ||
1900 | .Cm \&: | ||
1901 | for all others. | ||
1902 | .It Ar numbits | ||
1903 | This argument specifies that a parameter set should be generated of size | ||
1904 | .Ar numbits . | ||
1905 | It must be the last option. | ||
1906 | If not present, then a value of 512 is used. | ||
1907 | If this value is present then the input file is ignored and | ||
1908 | parameters are generated instead. | ||
1909 | .It Fl noout | ||
1910 | This option inhibits the output of the encoded version of the parameters. | ||
1911 | .It Fl text | ||
1912 | This option prints out the DH parameters in human readable form. | ||
1913 | .It Fl C | ||
1914 | This option converts the parameters into C code. | ||
1915 | The parameters can then be loaded by calling the | ||
1916 | .Cm get_dh Ns Ar numbits Ns Li () | ||
1917 | function. | ||
1918 | .Sh DHPARAM WARNINGS | ||
1919 | The program | ||
1920 | .Nm dhparam | ||
1921 | combines the functionality of the programs | ||
1922 | .Nm dh | ||
1923 | and | ||
1924 | .Nm gendh | ||
1925 | in previous versions of | ||
1926 | .Nm OpenSSL | ||
1927 | and | ||
1928 | .Nm SSLeay . | ||
1929 | The | ||
1930 | .Nm dh | ||
1931 | and | ||
1932 | .Nm gendh | ||
1933 | programs are retained for now, but may have different purposes in future | ||
1934 | versions of | ||
1935 | .Nm OpenSSL . | ||
1936 | .Sh DHPARAM NOTES | ||
1937 | .Ar PEM | ||
1938 | format DH parameters use the header and footer lines: | ||
1939 | .Pp | ||
1940 | .Bd -literal | ||
1941 | \& -----BEGIN DH PARAMETERS----- | ||
1942 | \& -----END DH PARAMETERS----- | ||
1943 | .Ed | ||
1944 | .Pp | ||
1945 | .Nm OpenSSL | ||
1946 | currently only supports the older PKCS#3 DH, | ||
1947 | not the newer X9.42 DH. | ||
1948 | .Pp | ||
1949 | This program manipulates DH parameters not keys. | ||
1950 | .Sh DHPARAM BUGS | ||
1951 | There should be a way to generate and manipulate DH keys. | ||
1952 | .Sh DHPARAM HISTORY | ||
1953 | The | ||
1954 | .Nm dhparam | ||
1955 | command was added in | ||
1956 | .Nm OpenSSL | ||
1957 | 0.9.5. | ||
1958 | The | ||
1959 | .Fl dsaparam | ||
1960 | option was added in | ||
1961 | .Nm OpenSSL | ||
1962 | 0.9.6. | ||
1963 | .\" | ||
1964 | .\" DSA | ||
1965 | .\" | ||
1966 | .Sh DSA | ||
1967 | .Nm openssl dsa | ||
1968 | .Bk -words | ||
1969 | .Op Fl inform Ar PEM|DER | ||
1970 | .Op Fl outform Ar PEM|DER | ||
1971 | .Op Fl in Ar filename | ||
1972 | .Op Fl passin Ar arg | ||
1973 | .Op Fl out Ar filename | ||
1974 | .Op Fl passout Ar arg | ||
1975 | .Op Fl des | ||
1976 | .Op Fl des3 | ||
1977 | .Op Fl idea | ||
1978 | .Op Fl text | ||
1979 | .Op Fl noout | ||
1980 | .Op Fl modulus | ||
1981 | .Op Fl pubin | ||
1982 | .Op Fl pubout | ||
1983 | .Ek | ||
1984 | .Pp | ||
1985 | The | ||
1986 | .Nm dsa | ||
1987 | command processes DSA keys. | ||
1988 | They can be converted between various forms and their components printed out. | ||
1989 | .Pp | ||
1990 | .Sy Note: | ||
1991 | This command uses the traditional | ||
1992 | .Nm SSLeay | ||
1993 | compatible format for private key encryption: | ||
1994 | newer applications should use the more secure PKCS#8 format using the | ||
1995 | .Nm pkcs8 | ||
1996 | command. | ||
1997 | .Pp | ||
1998 | The options are as follows: | ||
1999 | .Bl -tag -width Ds | ||
2000 | .It Fl inform Ar DER|PEM | ||
2001 | This specifies the input format. | ||
2002 | The | ||
2003 | .Ar DER | ||
2004 | argument with a private key uses an ASN1 DER encoded form of an ASN.1 | ||
2005 | SEQUENCE consisting of the values of version (currently zero), p, q, g, | ||
2006 | the public and private key components respectively as ASN.1 INTEGERs. | ||
2007 | When used with a public key it uses a | ||
2008 | .Em SubjectPublicKeyInfo | ||
2009 | structure: | ||
2010 | It is an error if the key is not DSA. | ||
2011 | .Pp | ||
2012 | The | ||
2013 | .Ar PEM | ||
2014 | form is the default format: | ||
2015 | It consists of the DER format base64 | ||
2016 | encoded with additional header and footer lines. | ||
2017 | In the case of a private key, PKCS#8 format is also accepted. | ||
2018 | .It Fl outform Ar DER|PEM | ||
2019 | This specifies the output format, the options have the same meaning as the | ||
2020 | .Fl inform | ||
2021 | option. | ||
2022 | .It Fl in Ar filename | ||
2023 | This specifies the input | ||
2024 | .Ar filename | ||
2025 | to read a key from or standard input if this option is not specified. | ||
2026 | If the key is encrypted a pass phrase will be prompted for. | ||
2027 | .It Fl passin Ar arg | ||
2028 | The input file password source. | ||
2029 | For more information about the format of | ||
2030 | .Ar arg | ||
2031 | see the | ||
2032 | .Sx PASS PHRASE ARGUMENTS | ||
2033 | section above. | ||
2034 | .It Fl out Ar filename | ||
2035 | This specifies the output | ||
2036 | .Ar filename | ||
2037 | to write a key to, or standard output if not specified. | ||
2038 | If any encryption options are set then a pass phrase will be | ||
2039 | prompted for. | ||
2040 | The output filename should | ||
2041 | .Em not | ||
2042 | be the same as the input filename. | ||
2043 | .It Fl passout Ar arg | ||
2044 | The output file password source. | ||
2045 | For more information about the format of | ||
2046 | .Ar arg | ||
2047 | see the | ||
2048 | .Sx PASS PHRASE ARGUMENTS | ||
2049 | section above. | ||
2050 | .It Cm -des|-des3|-idea | ||
2051 | These options encrypt the private key with the DES, triple DES, or the | ||
2052 | IDEA ciphers, respectively, before outputting it. | ||
2053 | A pass phrase is prompted for. | ||
2054 | If none of these options is specified, the key is written in plain text. | ||
2055 | This means that using the | ||
2056 | .Nm dsa | ||
2057 | utility to read in an encrypted key with no encryption option can be used to | ||
2058 | remove the pass phrase from a key, | ||
2059 | or by setting the encryption options it can be use to add or change | ||
2060 | the pass phrase. | ||
2061 | These options can only be used with | ||
2062 | .Ar PEM | ||
2063 | format output files. | ||
2064 | .It Fl text | ||
2065 | Prints out the public, private key components and parameters. | ||
2066 | .It Fl noout | ||
2067 | This option prevents output of the encoded version of the key. | ||
2068 | .It Fl modulus | ||
2069 | This option prints out the value of the public key component of the key. | ||
2070 | .It Fl pubin | ||
2071 | By default a private key is read from the input file. | ||
2072 | With this option a public key is read instead. | ||
2073 | .It Fl pubout | ||
2074 | By default a private key is output. | ||
2075 | With this option a public key will be output instead. | ||
2076 | This option is automatically set if the input is a public key. | ||
2077 | .Sh DSA NOTES | ||
2078 | The | ||
2079 | .Ar PEM | ||
2080 | private key format uses the header and footer lines: | ||
2081 | .Pp | ||
2082 | .Bd -literal | ||
2083 | \& -----BEGIN DSA PRIVATE KEY----- | ||
2084 | \& -----END DSA PRIVATE KEY----- | ||
2085 | .Ed | ||
2086 | .Pp | ||
2087 | The | ||
2088 | .Ar PEM | ||
2089 | public key format uses the header and footer lines: | ||
2090 | .Pp | ||
2091 | .Bd -literal | ||
2092 | \& -----BEGIN PUBLIC KEY----- | ||
2093 | \& -----END PUBLIC KEY----- | ||
2094 | .Ed | ||
2095 | .Sh DSA EXAMPLES | ||
2096 | To remove the pass phrase on a DSA private key: | ||
2097 | .Pp | ||
2098 | \& $ openssl dsa -in key.pem -out keyout.pem | ||
2099 | .Pp | ||
2100 | To encrypt a private key using triple DES: | ||
2101 | .Pp | ||
2102 | \& $ openssl dsa -in key.pem -des3 -out keyout.pem | ||
2103 | .Pp | ||
2104 | To convert a private key from PEM to DER format: | ||
2105 | .Pp | ||
2106 | \& $ openssl dsa -in key.pem -outform DER -out keyout.der | ||
2107 | .Pp | ||
2108 | To print out the components of a private key to standard output: | ||
2109 | .Pp | ||
2110 | \& $ openssl dsa -in key.pem -text -noout | ||
2111 | .Pp | ||
2112 | To just output the public part of a private key: | ||
2113 | .Pp | ||
2114 | \& $ openssl dsa -in key.pem -pubout -out pubkey.pem | ||
2115 | .\" | ||
2116 | .\" DSAPARAM | ||
2117 | .\" | ||
2118 | .Sh DSAPARAM | ||
2119 | .Nm openssl dsaparam | ||
2120 | .Op Fl inform Ar DER|PEM | ||
2121 | .Op Fl outform Ar DER|PEM | ||
2122 | .Op Fl in Ar filename | ||
2123 | .Op Fl out Ar filename | ||
2124 | .Op Fl noout | ||
2125 | .Op Fl text | ||
2126 | .Op Fl C | ||
2127 | .Op Fl rand Ar file ... | ||
2128 | .Op Fl genkey | ||
2129 | .Op Ar numbits | ||
2130 | .Pp | ||
2131 | The | ||
2132 | .Nm dsaparam | ||
2133 | command is used to manipulate or generate \s-1DSA\s0 parameter files. | ||
2134 | .Pp | ||
2135 | The options are as follows: | ||
2136 | .Bl -tag -width Ds | ||
2137 | .It Fl inform Ar DER|PEM | ||
2138 | This specifies the input format. | ||
2139 | The | ||
2140 | .Ar DER | ||
2141 | argument uses an ASN1 DER encoded form compatible with RFC2459 (PKIX) | ||
2142 | DSS-Parms that is a SEQUENCE consisting of p, q and g, respectively. | ||
2143 | The | ||
2144 | .Ar PEM | ||
2145 | form is the default format: | ||
2146 | it consists of the DER format base64 encoded with additional header | ||
2147 | and footer lines. | ||
2148 | .It Fl outform Ar DER|PEM | ||
2149 | This specifies the output format; the options have the same meaning as the | ||
2150 | .Fl inform | ||
2151 | option. | ||
2152 | .It Fl in Ar filename | ||
2153 | This specifies the input | ||
2154 | .Ar filename | ||
2155 | to read parameters from, or standard input if this option is not specified. | ||
2156 | If the | ||
2157 | .Ar numbits | ||
2158 | parameter is included then this option will be ignored. | ||
2159 | .It Fl out Ar filename | ||
2160 | This specifies the output | ||
2161 | .Ar filename | ||
2162 | to write parameters to. | ||
2163 | Standard output is used if this option is not present. | ||
2164 | The output filename should | ||
2165 | .Em not | ||
2166 | be the same as the input filename. | ||
2167 | .It Fl noout | ||
2168 | This option inhibits the output of the encoded version of the parameters. | ||
2169 | .It Fl text | ||
2170 | This option prints out the DSA parameters in human readable form. | ||
2171 | .It Fl C | ||
2172 | This option converts the parameters into C code. | ||
2173 | The parameters can then be loaded by calling the | ||
2174 | .Cm get_dsa Ns Ar XXX Ns Li () | ||
2175 | function. | ||
2176 | .It Fl genkey | ||
2177 | This option will generate a DSA either using the specified or generated | ||
2178 | parameters. | ||
2179 | .It Fl rand Ar file ... | ||
2180 | A | ||
2181 | .Ar file | ||
2182 | or | ||
2183 | .Ar file Ns Li s | ||
2184 | containing random data used to seed the random number | ||
2185 | generator, or an EGD socket (see | ||
2186 | .Xr RAND_egd 3 ) . | ||
2187 | Multiple files can be specified, separated by an OS-dependent character. | ||
2188 | The separator is | ||
2189 | .Cm \&; | ||
2190 | for MS-Windows, | ||
2191 | .Cm \&, | ||
2192 | for OpenVMS, and | ||
2193 | .Cm \&: | ||
2194 | for all others. | ||
2195 | .It Ar numbits | ||
2196 | This option specifies that a parameter set should be generated of size | ||
2197 | .Ar numbits . | ||
2198 | It must be the last option. | ||
2199 | If this option is included, then the input file (if any) is ignored. | ||
2200 | .El | ||
2201 | .Sh DSAPARAM NOTES | ||
2202 | .Ar PEM | ||
2203 | format DSA parameters use the header and footer lines: | ||
2204 | .Pp | ||
2205 | .Bd -literal | ||
2206 | \& -----BEGIN DSA PARAMETERS----- | ||
2207 | \& -----END DSA PARAMETERS----- | ||
2208 | .Ed | ||
2209 | .Pp | ||
2210 | DSA parameter generation is a slow process and as a result the same set of | ||
2211 | DSA parameters is often used to generate several distinct keys. | ||
2212 | .\" | ||
2213 | .\" ENC | ||
2214 | .\" | ||
2215 | .Sh ENC | ||
2216 | .Nm openssl enc | ||
2217 | .Fl ciphername | ||
2218 | .Op Fl in Ar filename | ||
2219 | .Op Fl out Ar filename | ||
2220 | .Op Fl pass Ar arg | ||
2221 | .Op Fl e | ||
2222 | .Op Fl d | ||
2223 | .Op Fl a | ||
2224 | .Op Fl A | ||
2225 | .Op Fl k Ar password | ||
2226 | .Op Fl kfile Ar filename | ||
2227 | .Op Fl K Ar key | ||
2228 | .Op Fl iv Ar IV | ||
2229 | .Op Fl p | ||
2230 | .Op Fl P | ||
2231 | .Op Fl bufsize Ar number | ||
2232 | .Op Fl nopad | ||
2233 | .Op Fl debug | ||
2234 | .Pp | ||
2235 | The symmetric cipher commands allow data to be encrypted or decrypted | ||
2236 | using various block and stream ciphers using keys based on passwords | ||
2237 | or explicitly provided. Base64 encoding or decoding can also be performed | ||
2238 | either by itself or in addition to the encryption or decryption. | ||
2239 | .Pp | ||
2240 | The options are as follows: | ||
2241 | .Bl -tag -width Ds | ||
2242 | .It Fl in Ar filename | ||
2243 | The input | ||
2244 | .Ar filename , | ||
2245 | standard input by default. | ||
2246 | .It Fl out Ar filename | ||
2247 | The output | ||
2248 | .Ar filename , | ||
2249 | standard output by default. | ||
2250 | .It Fl pass Ar arg | ||
2251 | The password source. | ||
2252 | For more information about the format of | ||
2253 | .Ar arg | ||
2254 | see the | ||
2255 | .Sx PASS PHRASE ARGUMENTS | ||
2256 | section above. | ||
2257 | .It Fl salt | ||
2258 | Use a | ||
2259 | .Ar salt | ||
2260 | in the key derivation routines. | ||
2261 | This option should | ||
2262 | .Em ALWAYS | ||
2263 | be used unless compatibility with previous versions of | ||
2264 | .Nm OpenSSL | ||
2265 | or | ||
2266 | .Nm SSLeay | ||
2267 | is required. | ||
2268 | This option is only present on | ||
2269 | .Nm OpenSSL | ||
2270 | versions 0.9.5 or above. | ||
2271 | .It Fl nosalt | ||
2272 | Don't use a | ||
2273 | .Ar salt | ||
2274 | in the key derivation routines. | ||
2275 | This is the default for compatibility with previous versions of | ||
2276 | .Nm OpenSSL | ||
2277 | and | ||
2278 | .Nm SSLeay . | ||
2279 | .It Fl e | ||
2280 | Encrypt the input data: this is the default. | ||
2281 | .It Fl d | ||
2282 | Decrypt the input data. | ||
2283 | .It Fl a | ||
2284 | Base64 process the data. | ||
2285 | This means that if encryption is taking place, the data is base64 encoded | ||
2286 | after encryption. | ||
2287 | If decryption is set, then the input data is base64 decoded before | ||
2288 | being decrypted. | ||
2289 | .It Fl A | ||
2290 | If the | ||
2291 | .Fl a | ||
2292 | option is set, then base64 process the data on one line. | ||
2293 | .It Fl k Ar password | ||
2294 | The | ||
2295 | .Ar password | ||
2296 | to derive the key from. | ||
2297 | This is for compatibility with previous versions of | ||
2298 | .Nm OpenSSL . | ||
2299 | Superseded by the | ||
2300 | .Fl pass | ||
2301 | option. | ||
2302 | .It Fl kfile Ar filename | ||
2303 | Read the password to derive the key from the first line of | ||
2304 | .Ar filename . | ||
2305 | This is for compatibility with previous versions of | ||
2306 | .Nm OpenSSL . | ||
2307 | Superseded by the | ||
2308 | .Fl pass | ||
2309 | option. | ||
2310 | .It Fl S Ar salt | ||
2311 | The actual | ||
2312 | .Ar salt | ||
2313 | to use: | ||
2314 | this must be represented as a string comprised only of hex digits. | ||
2315 | .It Fl K Ar key | ||
2316 | The actual | ||
2317 | .Ar key | ||
2318 | to use: | ||
2319 | this must be represented as a string comprised only of hex digits. | ||
2320 | If only the key is specified, the | ||
2321 | .Ar IV | ||
2322 | must additionally specified using the | ||
2323 | .Fl iv | ||
2324 | option. | ||
2325 | When both a | ||
2326 | .Ar key | ||
2327 | and a | ||
2328 | .Ar password | ||
2329 | are specified, the | ||
2330 | .Ar key | ||
2331 | given with the | ||
2332 | .Fl K | ||
2333 | option will be used and the | ||
2334 | .Ar IV | ||
2335 | generated from the password will be taken. | ||
2336 | It probably does not make much sense to specify both | ||
2337 | .Ar key | ||
2338 | and | ||
2339 | .Ar password . | ||
2340 | .It Fl iv Ar IV | ||
2341 | The actual | ||
2342 | .Ar IV | ||
2343 | to use: | ||
2344 | this must be represented as a string comprised only of hex digits. | ||
2345 | When only the | ||
2346 | .Ar key | ||
2347 | is specified using the | ||
2348 | .Fl K | ||
2349 | option, the | ||
2350 | .Ar IV | ||
2351 | must explicitly be defined. | ||
2352 | When a password is being specified using one of the other options, | ||
2353 | the | ||
2354 | .Ar IV | ||
2355 | is generated from this password. | ||
2356 | .It Fl p | ||
2357 | Print out the key and | ||
2358 | .Ar IV | ||
2359 | used. | ||
2360 | .It Fl P | ||
2361 | Print out the | ||
2362 | .Ar key | ||
2363 | and | ||
2364 | .Ar IV | ||
2365 | used then immediately exit: | ||
2366 | don't do any encryption or decryption. | ||
2367 | .It Fl bufsize Ar number | ||
2368 | Set the buffer size for I/O. | ||
2369 | .It Fl nopad | ||
2370 | Disable standard block padding. | ||
2371 | .It Fl debug | ||
2372 | Debug the BIOs used for I/O. | ||
2373 | .El | ||
2374 | .Sh ENC NOTES | ||
2375 | The program can be called either as | ||
2376 | .Nm openssl ciphername | ||
2377 | or | ||
2378 | .Nm openssl enc -ciphername . | ||
2379 | .Pp | ||
2380 | A password will be prompted for to derive the | ||
2381 | .Ar key | ||
2382 | and | ||
2383 | .Ar IV | ||
2384 | if necessary. | ||
2385 | .Pp | ||
2386 | The | ||
2387 | .Fl salt | ||
2388 | option should | ||
2389 | .Em ALWAYS | ||
2390 | be used if the key is being derived from a password unless compatibility | ||
2391 | with previous versions of | ||
2392 | .Nm OpenSSL | ||
2393 | and | ||
2394 | .Nm SSLeay | ||
2395 | is necessary. | ||
2396 | .Pp | ||
2397 | Without the | ||
2398 | .Fl salt | ||
2399 | option it is possible to perform efficient dictionary | ||
2400 | attacks on the password and to attack stream cipher encrypted data. | ||
2401 | The reason for this is that without the | ||
2402 | .Ar salt | ||
2403 | the same password always generates the same encryption key. | ||
2404 | When the | ||
2405 | .Ar salt | ||
2406 | is being used the first eight bytes of the encrypted data are reserved | ||
2407 | for the | ||
2408 | .Ar salt : | ||
2409 | it is generated at random when encrypting a file and read from the | ||
2410 | encrypted file when it is decrypted. | ||
2411 | .Pp | ||
2412 | Some of the ciphers do not have large keys and others have security | ||
2413 | implications if not used correctly. | ||
2414 | A beginner is advised to just use a strong block cipher in CBC mode | ||
2415 | such as bf or des3. | ||
2416 | .Pp | ||
2417 | All the block ciphers normally use PKCS#5 padding also known as standard block | ||
2418 | padding: | ||
2419 | this allows a rudimentary integrity or password check to be performed. | ||
2420 | However, since the chance of random data passing the test is | ||
2421 | better than 1 in 256, it isn't a very good test. | ||
2422 | .Pp | ||
2423 | If padding is disabled then the input data must be a multiple of the cipher | ||
2424 | block length. | ||
2425 | .Pp | ||
2426 | All RC2 ciphers have the same key and effective key length. | ||
2427 | .Pp | ||
2428 | Blowfish and RC5 algorithms use a 128 bit key. | ||
2429 | .Sh ENC SUPPORTED CIPHERS | ||
2430 | .Bd -literal | ||
2431 | \& base64 Base 64 | ||
2432 | .Ed | ||
2433 | .Pp | ||
2434 | .Bd -literal | ||
2435 | \& bf-cbc Blowfish in CBC mode | ||
2436 | \& bf Alias for bf-cbc | ||
2437 | \& bf-cfb Blowfish in CFB mode | ||
2438 | \& bf-ecb Blowfish in ECB mode | ||
2439 | \& bf-ofb Blowfish in OFB mode | ||
2440 | .Ed | ||
2441 | .Pp | ||
2442 | .Bd -literal | ||
2443 | \& cast-cbc CAST in CBC mode | ||
2444 | \& cast Alias for cast-cbc | ||
2445 | \& cast5-cbc CAST5 in CBC mode | ||
2446 | \& cast5-cfb CAST5 in CFB mode | ||
2447 | \& cast5-ecb CAST5 in ECB mode | ||
2448 | \& cast5-ofb CAST5 in OFB mode | ||
2449 | .Ed | ||
2450 | .Pp | ||
2451 | .Bd -literal | ||
2452 | \& des-cbc DES in CBC mode | ||
2453 | \& des Alias for des-cbc | ||
2454 | \& des-cfb DES in CBC mode | ||
2455 | \& des-ofb DES in OFB mode | ||
2456 | \& des-ecb DES in ECB mode | ||
2457 | .Ed | ||
2458 | .Pp | ||
2459 | .Bd -literal | ||
2460 | \& des-ede-cbc Two key triple DES EDE in CBC mode | ||
2461 | \& des-ede Alias for des-ede | ||
2462 | \& des-ede-cfb Two key triple DES EDE in CFB mode | ||
2463 | \& des-ede-ofb Two key triple DES EDE in OFB mode | ||
2464 | .Ed | ||
2465 | .Pp | ||
2466 | .Bd -literal | ||
2467 | \& des-ede3-cbc Three key triple DES EDE in CBC mode | ||
2468 | \& des-ede3 Alias for des-ede3-cbc | ||
2469 | \& des3 Alias for des-ede3-cbc | ||
2470 | \& des-ede3-cfb Three key triple DES EDE CFB mode | ||
2471 | \& des-ede3-ofb Three key triple DES EDE in OFB mode | ||
2472 | .Ed | ||
2473 | .Pp | ||
2474 | .Bd -literal | ||
2475 | \& desx DESX algorithm. | ||
2476 | .Ed | ||
2477 | .Pp | ||
2478 | .Bd -literal | ||
2479 | \& idea-cbc IDEA algorithm in CBC mode | ||
2480 | \& idea same as idea-cbc | ||
2481 | \& idea-cfb IDEA in CFB mode | ||
2482 | \& idea-ecb IDEA in ECB mode | ||
2483 | \& idea-ofb IDEA in OFB mode | ||
2484 | .Ed | ||
2485 | .Pp | ||
2486 | .Bd -literal | ||
2487 | \& rc2-cbc 128 bit RC2 in CBC mode | ||
2488 | \& rc2 Alias for rc2-cbc | ||
2489 | \& rc2-cfb 128 bit RC2 in CBC mode | ||
2490 | \& rc2-ecb 128 bit RC2 in CBC mode | ||
2491 | \& rc2-ofb 128 bit RC2 in CBC mode | ||
2492 | \& rc2-64-cbc 64 bit RC2 in CBC mode | ||
2493 | \& rc2-40-cbc 40 bit RC2 in CBC mode | ||
2494 | .Ed | ||
2495 | .Pp | ||
2496 | .Bd -literal | ||
2497 | \& rc4 128 bit RC4 | ||
2498 | \& rc4-64 64 bit RC4 | ||
2499 | \& rc4-40 40 bit RC4 | ||
2500 | .Ed | ||
2501 | .Pp | ||
2502 | .Bd -literal | ||
2503 | \& rc5-cbc RC5 cipher in CBC mode | ||
2504 | \& rc5 Alias for rc5-cbc | ||
2505 | \& rc5-cfb RC5 cipher in CBC mode | ||
2506 | \& rc5-ecb RC5 cipher in CBC mode | ||
2507 | \& rc5-ofb RC5 cipher in CBC mode | ||
2508 | .Ed | ||
2509 | .Sh ENC EXAMPLES | ||
2510 | Just base64 encode a binary file: | ||
2511 | .Pp | ||
2512 | \& $ openssl base64 -in file.bin -out file.b64 | ||
2513 | .Pp | ||
2514 | Decode the same file: | ||
2515 | .Pp | ||
2516 | \& $ openssl base64 -d -in file.b64 -out file.bin | ||
2517 | .Pp | ||
2518 | Encrypt a file using triple DES in CBC mode using a prompted password: | ||
2519 | .Pp | ||
2520 | \& $ openssl des3 -salt -in file.txt -out file.des3 | ||
2521 | .Pp | ||
2522 | Decrypt a file using a supplied password: | ||
2523 | .Pp | ||
2524 | \& $ openssl des3 -d -salt -in file.des3 -out file.txt -k mypassword | ||
2525 | .Pp | ||
2526 | Encrypt a file then base64 encode it (so it can be sent via mail for example) | ||
2527 | using Blowfish in CBC mode: | ||
2528 | .Pp | ||
2529 | \& $ openssl bf -a -salt -in file.txt -out file.bf | ||
2530 | .Pp | ||
2531 | Base64 decode a file then decrypt it: | ||
2532 | .Pp | ||
2533 | \& $ openssl bf -d -salt -a -in file.bf -out file.txt | ||
2534 | .Pp | ||
2535 | Decrypt some data using a supplied 40 bit RC4 key: | ||
2536 | .Pp | ||
2537 | \& $ openssl rc4-40 -in file.rc4 -out file.txt -K 0102030405 | ||
2538 | .Sh ENC BUGS | ||
2539 | The | ||
2540 | .Fl A | ||
2541 | option when used with large files doesn't work properly. | ||
2542 | .Pp | ||
2543 | There should be an option to allow an iteration count to be included. | ||
2544 | .Pp | ||
2545 | The | ||
2546 | .Nm enc | ||
2547 | program only supports a fixed number of algorithms with certain parameters. | ||
2548 | Therefore it is not possible to use RC2 with a 76-bit key | ||
2549 | or RC4 with an 84-bit key with this program. | ||
2550 | .\" | ||
2551 | .\" ERRSTR | ||
2552 | .\" | ||
2553 | .Sh ERRSTR | ||
2554 | The | ||
2555 | .Nm errstr | ||
2556 | utility is undocumented. | ||
2557 | .\" | ||
2558 | .\" GENDH | ||
2559 | .\" | ||
2560 | .Sh GENDH | ||
2561 | Generation of Diffie-Hellman Parameters. Replaced by | ||
2562 | .Nm dhparam. | ||
2563 | See | ||
2564 | .Sx DHPARAM | ||
2565 | above. | ||
2566 | .\" | ||
2567 | .\" GENDSA | ||
2568 | .\" | ||
2569 | .Sh GENDSA | ||
2570 | .Nm openssl gendsa | ||
2571 | .Op Fl out Ar filename | ||
2572 | .Op Fl des | ||
2573 | .Op Fl des3 | ||
2574 | .Op Fl idea | ||
2575 | .Op Fl rand Ar file ... | ||
2576 | .Op Ar paramfile | ||
2577 | .Pp | ||
2578 | The | ||
2579 | .Nm gendsa | ||
2580 | command generates a DSA private key from a DSA parameter file | ||
2581 | (which will be typically generated by the | ||
2582 | .Nm openssl dsaparam | ||
2583 | command). | ||
2584 | .Pp | ||
2585 | The options are as follows: | ||
2586 | .Bl -tag -width Ds | ||
2587 | .It Cm -des|-des3|-idea | ||
2588 | These options encrypt the private key with the DES, triple DES, | ||
2589 | or the IDEA ciphers, respectively, before outputting it. | ||
2590 | A pass phrase is prompted for. | ||
2591 | If none of these options is specified, no encryption is used. | ||
2592 | .It Fl rand Ar file ... | ||
2593 | A | ||
2594 | .Ar file | ||
2595 | or | ||
2596 | .Ar file Ns Li s | ||
2597 | containing random data used to seed the random number | ||
2598 | generator, or an EGD socket (see | ||
2599 | .Xr RAND_egd 3 ) . | ||
2600 | Multiple files can be specified separated by an OS-dependent character. | ||
2601 | The separator is | ||
2602 | .Cm \&; | ||
2603 | for MS-Windows, | ||
2604 | .Cm \&, | ||
2605 | for OpenVMS, and | ||
2606 | .Cm \&: | ||
2607 | for all others. | ||
2608 | .It Ar paramfile | ||
2609 | This option specifies the DSA parameter file to use. | ||
2610 | The parameters in this file determine the size of the private key. | ||
2611 | DSA parameters can be generated and examined using the | ||
2612 | .Nm openssl dsaparam | ||
2613 | command. | ||
2614 | .Sh GENDSA NOTES | ||
2615 | DSA key generation is little more than random number generation so it is | ||
2616 | much quicker that RSA key generation for example. | ||
2617 | .\" | ||
2618 | .\" GENRSA | ||
2619 | .\" | ||
2620 | .Sh GENRSA | ||
2621 | .Nm openssl genrsa | ||
2622 | .Op Fl out Ar filename | ||
2623 | .Op Fl passout Ar arg | ||
2624 | .Op Fl des | ||
2625 | .Op Fl des3 | ||
2626 | .Op Fl idea | ||
2627 | .Op Fl f4 | ||
2628 | .Op Fl 3 | ||
2629 | .Op Fl rand Ar file ... | ||
2630 | .Op Ar numbits | ||
2631 | .Pp | ||
2632 | The | ||
2633 | .Nm genrsa | ||
2634 | command generates an RSA private key. | ||
2635 | .Pp | ||
2636 | The options are as follows: | ||
2637 | .Bl -tag -width Ds | ||
2638 | .It Fl out Ar filename | ||
2639 | The output | ||
2640 | .Ar filename . | ||
2641 | If this argument is not specified then standard output is used. | ||
2642 | .It Fl passout Ar arg | ||
2643 | The output file password source. | ||
2644 | For more information about the format of | ||
2645 | .Ar arg | ||
2646 | see the | ||
2647 | .Sx PASS PHRASE ARGUMENTS | ||
2648 | section above. | ||
2649 | .It Cm -des|-des3|-idea | ||
2650 | These options encrypt the private key with the DES, triple DES, or the | ||
2651 | IDEA ciphers, respectively, before outputting it. | ||
2652 | If none of these options is specified, no encryption is used. | ||
2653 | If encryption is used a pass phrase is prompted for, | ||
2654 | if it is not supplied via the | ||
2655 | .Fl passout | ||
2656 | option. | ||
2657 | .It Cm -F4|-3 | ||
2658 | The public exponent to use, either 65537 or 3. | ||
2659 | The default is 65537. | ||
2660 | .It Fl rand Ar file ... | ||
2661 | A | ||
2662 | .Ar file | ||
2663 | or | ||
2664 | .Ar file Ns Li s | ||
2665 | containing random data used to seed the random number | ||
2666 | generator, or an EGD socket (see | ||
2667 | .Xr RAND_egd 3 ) . | ||
2668 | Multiple files can be specified separated by an OS-dependent character. | ||
2669 | The separator is | ||
2670 | .Cm \&; | ||
2671 | for MS-Windows, | ||
2672 | .Cm \&, | ||
2673 | for OpenVMS, and | ||
2674 | .Cm \&: | ||
2675 | for all others. | ||
2676 | .It Ar numbits | ||
2677 | The size of the private key to generate in bits. | ||
2678 | This must be the last option specified. | ||
2679 | The default is 512. | ||
2680 | .Sh GENRSA NOTES | ||
2681 | RSA private key generation essentially involves the generation of two prime | ||
2682 | numbers. | ||
2683 | When generating a private key, various symbols will be output to | ||
2684 | indicate the progress of the generation. | ||
2685 | A | ||
2686 | .Em \&. | ||
2687 | represents each number which has passed an initial sieve test, | ||
2688 | .Em \&+ | ||
2689 | means a number has passed a single round of the Miller-Rabin primality test. | ||
2690 | A newline means that the number has passed all the prime tests | ||
2691 | (the actual number depends on the key size). | ||
2692 | .Pp | ||
2693 | Because key generation is a random process the time taken to generate a key | ||
2694 | may vary somewhat. | ||
2695 | .Sh GENRSA BUGS | ||
2696 | A quirk of the prime generation algorithm is that it cannot generate small | ||
2697 | primes. | ||
2698 | Therefore the number of bits should not be less that 64. | ||
2699 | For typical private keys this will not matter because for security reasons | ||
2700 | they will be much larger (typically 1024 bits). | ||
2701 | .\" | ||
2702 | .\" NSEQ | ||
2703 | .\" | ||
2704 | .Sh NSEQ | ||
2705 | .Nm openssl nseq | ||
2706 | .Op Fl in Ar filename | ||
2707 | .Op Fl out Ar filename | ||
2708 | .Op Fl toseq | ||
2709 | .Pp | ||
2710 | The | ||
2711 | .Nm nseq | ||
2712 | command takes a file containing a Netscape certificate | ||
2713 | sequence and prints out the certificates contained in it or takes a | ||
2714 | file of certificates and converts it into a Netscape certificate | ||
2715 | sequence. | ||
2716 | .Pp | ||
2717 | The options are as follows: | ||
2718 | .Bl -tag -width Ds | ||
2719 | .It Fl in Ar filename | ||
2720 | This specifies the input | ||
2721 | .Ar filename | ||
2722 | to read or standard input if this option is not specified. | ||
2723 | .It Fl out Ar filename | ||
2724 | Specifies the output | ||
2725 | .Ar filename | ||
2726 | or standard output by default. | ||
2727 | .It Fl toseq | ||
2728 | Normally a Netscape certificate sequence will be input and the output | ||
2729 | is the certificates contained in it. | ||
2730 | With the | ||
2731 | .Fl toseq | ||
2732 | option the situation is reversed: | ||
2733 | a Netscape certificate sequence is created from a file of certificates. | ||
2734 | .El | ||
2735 | .Sh NSEQ EXAMPLES | ||
2736 | Output the certificates in a Netscape certificate sequence: | ||
2737 | .Bd -literal | ||
2738 | \& $ openssl nseq -in nseq.pem -out certs.pem | ||
2739 | .Ed | ||
2740 | .Pp | ||
2741 | Create a Netscape certificate sequence: | ||
2742 | .Pp | ||
2743 | .Bd -literal | ||
2744 | \& $ openssl nseq -in certs.pem -toseq -out nseq.pem | ||
2745 | .Ed | ||
2746 | .Sh NSEQ NOTES | ||
2747 | The | ||
2748 | .Em PEM | ||
2749 | encoded form uses the same headers and footers as a certificate: | ||
2750 | .Pp | ||
2751 | .Bd -literal | ||
2752 | \& -----BEGIN CERTIFICATE----- | ||
2753 | \& -----END CERTIFICATE----- | ||
2754 | .Ed | ||
2755 | .Pp | ||
2756 | A Netscape certificate sequence is a Netscape specific form that can be sent | ||
2757 | to browsers as an alternative to the standard PKCS#7 format when several | ||
2758 | certificates are sent to the browser: | ||
2759 | for example during certificate enrollment. | ||
2760 | It is used by Netscape certificate server for example. | ||
2761 | .Sh NSEQ BUGS | ||
2762 | This program needs a few more options: | ||
2763 | like allowing | ||
2764 | .Em DER | ||
2765 | or | ||
2766 | .Em PEM | ||
2767 | input and output files and allowing multiple certificate files to be used. | ||
2768 | .\" | ||
2769 | .\" OCSP | ||
2770 | .\" | ||
2771 | .Sh OCSP | ||
2772 | .Nm openssl ocsp | ||
2773 | .Bk -words | ||
2774 | .Op Fl out Ar file | ||
2775 | .Op Fl issuer Ar file | ||
2776 | .Op Fl cert Ar file | ||
2777 | .Op Fl serial Ar n | ||
2778 | .Op Fl req_text | ||
2779 | .Op Fl resp_text | ||
2780 | .Op Fl text | ||
2781 | .Op Fl reqout Ar file | ||
2782 | .Op Fl respout Ar file | ||
2783 | .Op Fl reqin Ar file | ||
2784 | .Op Fl respin Ar file | ||
2785 | .Op Fl nonce | ||
2786 | .Op Fl no_nonce | ||
2787 | .Op Fl url Ar responder_url | ||
2788 | .Op Fl host Ar host:n | ||
2789 | .Op Fl path | ||
2790 | .Op Fl CApath Ar file | ||
2791 | .Op Fl CAfile Ar file | ||
2792 | .Op Fl VAfile Ar file | ||
2793 | .Op Fl verify_certs Ar file | ||
2794 | .Op Fl noverify | ||
2795 | .Op Fl trust_other | ||
2796 | .Op Fl no_intern | ||
2797 | .Op Fl no_sig_verify | ||
2798 | .Op Fl no_cert_verify | ||
2799 | .Op Fl no_chain | ||
2800 | .Op Fl no_cert_checks | ||
2801 | .Op Fl validity_period Ar nsec | ||
2802 | .Op Fl status_age Ar nsec | ||
2803 | .Ek | ||
2804 | .br | ||
2805 | .Pp | ||
2806 | .Sy WARNING: | ||
2807 | this documentation is preliminary and subject to change. | ||
2808 | .Pp | ||
2809 | The Online Certificate Status Protocol (OCSP) enables applications to | ||
2810 | determine the (revocation) state of an identified certificate (RFC 2560). | ||
2811 | .Pp | ||
2812 | The | ||
2813 | .Nm ocsp | ||
2814 | command performs many common OCSP tasks. | ||
2815 | It can be used to print out requests and responses, | ||
2816 | create requests and send queries to an OCSP responder and behave like | ||
2817 | a mini OCSP server itself. | ||
2818 | .Pp | ||
2819 | The options are as follows: | ||
2820 | .Bl -tag -width Ds | ||
2821 | .It Fl out Ar filename | ||
2822 | Specify output | ||
2823 | .Ar filename , | ||
2824 | default is standard output. | ||
2825 | .It Fl issuer Ar filename | ||
2826 | This specifies the current issuer certificate. | ||
2827 | This option can be used multiple times. | ||
2828 | The certificate specified in | ||
2829 | .Ar filename | ||
2830 | must be in | ||
2831 | .Ar PEM | ||
2832 | format. | ||
2833 | .It Fl cert Ar filename | ||
2834 | Add the certificate | ||
2835 | .Ar filename | ||
2836 | to the request. | ||
2837 | The issuer certificate is taken from the previous | ||
2838 | .Fl issuer | ||
2839 | option, or an error occurs if no issuer certificate is specified. | ||
2840 | .It Fl serial Ar num | ||
2841 | Same as the | ||
2842 | .Fl cert | ||
2843 | option except the certificate with serial number | ||
2844 | .Ar num | ||
2845 | is added to the request. | ||
2846 | The serial number is interpreted as a decimal integer unless preceded by | ||
2847 | .Em 0x . | ||
2848 | Negative integers can also be specified by preceding the value by a `-' sign. | ||
2849 | .It Fl signer Ar filename , Fl signkey Ar filename | ||
2850 | Sign the OCSP request using the certificate specified in the | ||
2851 | .Fl signer | ||
2852 | option and the private key specified by the | ||
2853 | .Fl signkey | ||
2854 | option. | ||
2855 | If the | ||
2856 | .Fl signkey | ||
2857 | option is not present then the private key is read from the same file | ||
2858 | as the certificate. | ||
2859 | If neither option is specified then the OCSP request is not signed. | ||
2860 | .It Fl nonce , no_nonce | ||
2861 | Add an OCSP | ||
2862 | .Em nonce | ||
2863 | extension to a request or disable an OCSP | ||
2864 | .Em nonce | ||
2865 | addition. | ||
2866 | Normally, if an OCSP request is input using the | ||
2867 | .Fl respin | ||
2868 | option no | ||
2869 | .Em nonce | ||
2870 | is added: | ||
2871 | using the | ||
2872 | .Fl nonce | ||
2873 | option will force addition of a | ||
2874 | .Em nonce . | ||
2875 | If an OCSP request is being created (using the | ||
2876 | .Fl cert | ||
2877 | and | ||
2878 | .Fl serial | ||
2879 | options) | ||
2880 | a | ||
2881 | .Em nonce | ||
2882 | is automatically added; specifying | ||
2883 | .Fl no_nonce | ||
2884 | overrides this. | ||
2885 | .It Fl req_text , resp_text , text | ||
2886 | Print out the text form of the OCSP request, response or both, respectively. | ||
2887 | .It Fl reqout Ar file , Fl respout Ar file | ||
2888 | Write out the DER encoded certificate request or response to | ||
2889 | .Ar file . | ||
2890 | .It Fl reqin Ar file , Fl respin Ar file | ||
2891 | Read an OCSP request or response file from | ||
2892 | .Ar file . | ||
2893 | These option are ignored | ||
2894 | if an OCSP request or response creation is implied by other options | ||
2895 | (for example with the | ||
2896 | .Fl serial , cert | ||
2897 | and | ||
2898 | .Fl host | ||
2899 | options). | ||
2900 | .It Fl url Ar responder_url | ||
2901 | Specify the responder URL. | ||
2902 | Both HTTP and HTTPS (SSL/TLS) URLs can be specified. | ||
2903 | .It Fl host Ar hostname:port , Fl path Ar pathname | ||
2904 | If the | ||
2905 | .Fl host | ||
2906 | option is present, then the OCSP request is sent to the host | ||
2907 | .Ar hostname | ||
2908 | on port | ||
2909 | .Ar port . | ||
2910 | .Fl path | ||
2911 | specifies the HTTP path name to use, or "/" by default. | ||
2912 | .It Fl CAfile Ar file , Fl CApath Ar pathname | ||
2913 | .Ar file | ||
2914 | or | ||
2915 | .Ar pathname | ||
2916 | containing trusted CA certificates. | ||
2917 | These are used to verify the signature on the OCSP response. | ||
2918 | .It Fl verify_certs Ar file | ||
2919 | .Ar file | ||
2920 | containing additional certificates to search when attempting to locate | ||
2921 | the OCSP response signing certificate. | ||
2922 | Some responders omit the actual signer's certificate from the response: | ||
2923 | this option can be used to supply the necessary certificate in such cases. | ||
2924 | .It Fl trust_other | ||
2925 | The certificates specified by the | ||
2926 | .Fl verify_certs | ||
2927 | option should be explicitly trusted and no additional checks will be | ||
2928 | performed on them. | ||
2929 | This is useful when the complete responder certificate chain is not available | ||
2930 | or trusting a root CA is not appropriate. | ||
2931 | .It Fl VAfile Ar file | ||
2932 | .Ar file | ||
2933 | containing explicitly trusted responder certificates. | ||
2934 | Equivalent to the | ||
2935 | .Fl verify_certs | ||
2936 | and | ||
2937 | .Fl trust_other | ||
2938 | options. | ||
2939 | .It Fl noverify | ||
2940 | Don't attempt to verify the OCSP response signature or the | ||
2941 | .Em nonce | ||
2942 | values. | ||
2943 | This option will normally only be used for debugging | ||
2944 | since it disables all verification of the responders certificate. | ||
2945 | .It Fl no_intern | ||
2946 | Ignore certificates contained in the OCSP response | ||
2947 | when searching for the signer's certificate. | ||
2948 | With this option the signer's certificate must be specified with either the | ||
2949 | .Fl verify_certs | ||
2950 | or | ||
2951 | .Fl VAfile | ||
2952 | options. | ||
2953 | .It Fl no_sig_verify | ||
2954 | Don't check the signature on the OCSP response. | ||
2955 | Since this option tolerates invalid signatures on OCSP responses, | ||
2956 | it will normally only be used for testing purposes. | ||
2957 | .It Fl no_cert_verify | ||
2958 | Don't verify the OCSP response signers certificate at all. | ||
2959 | Since this option allows the OCSP response to be signed by any certificate, | ||
2960 | it should only be used for testing purposes. | ||
2961 | .It Fl no_chain | ||
2962 | Do not use certificates in the response as additional untrusted CA | ||
2963 | certificates. | ||
2964 | .It Fl no_cert_checks | ||
2965 | Don't perform any additional checks on the OCSP response signers certificate. | ||
2966 | That is, do not make any checks to see if the signers certificate is authorised | ||
2967 | to provide the necessary status information: | ||
2968 | as a result this option should only be used for testing purposes. | ||
2969 | .It Fl validity_period Ar nsec , Fl status_age Ar age | ||
2970 | These options specify the range of times, in seconds, which will be tolerated | ||
2971 | in an OCSP response. | ||
2972 | Each certificate status response includes a | ||
2973 | .Em notBefore | ||
2974 | time and an optional | ||
2975 | .Em notAfter | ||
2976 | time. | ||
2977 | The current time should fall between these two values, | ||
2978 | but the interval between the two times may be only a few seconds. | ||
2979 | In practice the OCSP responder and clients' clocks may not be precisely | ||
2980 | synchronised and so such a check may fail. | ||
2981 | To avoid this the | ||
2982 | .Fl validity_period | ||
2983 | option can be used to specify an acceptable error range in seconds, | ||
2984 | the default value is 5 minutes. | ||
2985 | .Pp | ||
2986 | If the | ||
2987 | .Em notAfter | ||
2988 | time is omitted from a response then this means that new status | ||
2989 | information is immediately available. | ||
2990 | In this case the age of the | ||
2991 | .Em notBefore | ||
2992 | field is checked to see it is not older than | ||
2993 | .Ar age | ||
2994 | seconds old. | ||
2995 | By default this additional check is not performed. | ||
2996 | .El | ||
2997 | .Sh OCSP SERVER OPTIONS | ||
2998 | .Pp | ||
2999 | .Bl -tag -with DS | ||
3000 | .It Fl index Ar indexfile | ||
3001 | .Ar indexfile | ||
3002 | is a text index file in | ||
3003 | .Nm ca | ||
3004 | format containing certificate revocation information. | ||
3005 | .Pp | ||
3006 | If the | ||
3007 | .Fl index | ||
3008 | option is specified, the | ||
3009 | .Nm ocsp | ||
3010 | utility is in | ||
3011 | .Em responder | ||
3012 | mode, otherwise it is in | ||
3013 | .Em client | ||
3014 | mode. | ||
3015 | The request(s) the responder processes can be either specified on | ||
3016 | the command line (using the | ||
3017 | .Fl issuer | ||
3018 | and | ||
3019 | .Fl serial | ||
3020 | options), supplied in a file (using the | ||
3021 | .Fl respin | ||
3022 | option) or via external OCSP clients (if | ||
3023 | .Ar port | ||
3024 | or | ||
3025 | .Ar url | ||
3026 | is specified). | ||
3027 | .Pp | ||
3028 | If the | ||
3029 | .Fl index | ||
3030 | option is present, then the | ||
3031 | .Fl CA | ||
3032 | and | ||
3033 | .Fl rsigner | ||
3034 | options must also be present. | ||
3035 | .It Fl CA Ar file | ||
3036 | CA certificate corresponding to the revocation information in | ||
3037 | .Ar indexfile . | ||
3038 | .It Fl rsigner Ar file | ||
3039 | The certificate to sign OCSP responses with. | ||
3040 | .It Fl rother Ar file | ||
3041 | Additional certificates to include in the OCSP response. | ||
3042 | .It Fl resp_no_certs | ||
3043 | Don't include any certificates in the OCSP response. | ||
3044 | .It Fl resp_key_id | ||
3045 | Identify the signer certificate using the key ID, | ||
3046 | default is to use the subject name. | ||
3047 | .It Fl rkey Ar file | ||
3048 | The private key to sign OCSP responses with; | ||
3049 | if not present the file specified in the | ||
3050 | .Fl rsigner | ||
3051 | option is used. | ||
3052 | .It Fl port Ar portnum | ||
3053 | Port to listen for OCSP requests on. | ||
3054 | The port may also be specified using the | ||
3055 | .Fl url | ||
3056 | option. | ||
3057 | .It Fl nrequest Ar number | ||
3058 | The OCSP server will exit after receiving | ||
3059 | .Ar number | ||
3060 | requests, default unlimited. | ||
3061 | .It Fl nmin Ar minutes , Fl ndays Ar days | ||
3062 | Number of | ||
3063 | .Ar minutes | ||
3064 | or | ||
3065 | .Ar days | ||
3066 | when fresh revocation information is available: used in the | ||
3067 | .Ar nextUpdate | ||
3068 | field. | ||
3069 | If neither option is present then the | ||
3070 | .Em nextUpdate | ||
3071 | field is omitted meaning fresh revocation information is immediately available. | ||
3072 | .El | ||
3073 | .Sh OCSP RESPONSE VERIFICATION | ||
3074 | OCSP Response follows the rules specified in RFC2560. | ||
3075 | .Pp | ||
3076 | Initially the OCSP responder certificate is located and the signature on | ||
3077 | the OCSP request checked using the responder certificate's public key. | ||
3078 | .Pp | ||
3079 | Then a normal certificate verify is performed on the OCSP responder certificate | ||
3080 | building up a certificate chain in the process. | ||
3081 | The locations of the trusted certificates used to build the chain can be | ||
3082 | specified by the | ||
3083 | .Fl CAfile | ||
3084 | and | ||
3085 | .Fl CApath | ||
3086 | options or they will be looked for in the standard | ||
3087 | .Nm OpenSSL | ||
3088 | certificates | ||
3089 | directory. | ||
3090 | .Pp | ||
3091 | If the initial verify fails then the OCSP verify process halts with an | ||
3092 | error. | ||
3093 | .Pp | ||
3094 | Otherwise the issuing CA certificate in the request is compared to the OCSP | ||
3095 | responder certificate: if there is a match then the OCSP verify succeeds. | ||
3096 | .Pp | ||
3097 | Otherwise the OCSP responder certificate's CA is checked against the issuing | ||
3098 | CA certificate in the request. | ||
3099 | If there is a match and the OCSPSigning extended key usage is present | ||
3100 | in the OCSP responder certificate, then the OCSP verify succeeds. | ||
3101 | .Pp | ||
3102 | Otherwise the root CA of the OCSP responders CA is checked to see if it | ||
3103 | is trusted for OCSP signing. | ||
3104 | If it is, the OCSP verify succeeds. | ||
3105 | .Pp | ||
3106 | If none of these checks is successful then the OCSP verify fails. | ||
3107 | .Pp | ||
3108 | What this effectively means is that if the OCSP responder certificate is | ||
3109 | authorised directly by the CA it is issuing revocation information about | ||
3110 | (and it is correctly configured) then verification will succeed. | ||
3111 | .Pp | ||
3112 | If the OCSP responder is a | ||
3113 | .Em global responder | ||
3114 | which can give details about multiple CAs and has its own separate | ||
3115 | certificate chain, then its root CA can be trusted for OCSP signing. | ||
3116 | For example: | ||
3117 | .Pp | ||
3118 | .Bd -literal | ||
3119 | \& $ openssl x509 -in ocspCA.pem -addtrust OCSPSigning -out trustedCA.pem | ||
3120 | .Ed | ||
3121 | .Pp | ||
3122 | Alternatively the responder certificate itself can be explicitly trusted | ||
3123 | with the | ||
3124 | .Fl VAfile | ||
3125 | option. | ||
3126 | .Sh OCSP NOTES | ||
3127 | As noted, most of the verify options are for testing or debugging purposes. | ||
3128 | Normally only the | ||
3129 | .Fl CApath , CAfile | ||
3130 | and (if the responder is a 'global VA') | ||
3131 | .Fl VAfile | ||
3132 | options need to be used. | ||
3133 | .Pp | ||
3134 | The OCSP server is only useful for test and demonstration purposes: | ||
3135 | it is not really usable as a full OCSP responder. | ||
3136 | It contains only a very simple HTTP request handling and can only handle | ||
3137 | the POST form of OCSP queries. | ||
3138 | It also handles requests serially, meaning it cannot respond to | ||
3139 | new requests until it has processed the current one. | ||
3140 | The text index file format of revocation is also inefficient for large | ||
3141 | quantities of revocation data. | ||
3142 | .Pp | ||
3143 | It is possible to run the | ||
3144 | .Nm ocsp | ||
3145 | application in | ||
3146 | .Em responder | ||
3147 | mode via a CGI script using the | ||
3148 | .Fl respin | ||
3149 | and | ||
3150 | .Fl respout | ||
3151 | options. | ||
3152 | .Sh OCSP EXAMPLES | ||
3153 | Create an OCSP request and write it to a file: | ||
3154 | .Pp | ||
3155 | .Bd -literal | ||
3156 | \& $ openssl ocsp -issuer issuer.pem -cert c1.pem -cert c2.pem -reqout \e | ||
3157 | req.der | ||
3158 | .Ed | ||
3159 | .Pp | ||
3160 | Send a query to an OCSP responder with URL | ||
3161 | .Pa http://ocsp.myhost.com/ , | ||
3162 | save the response to a file and print it out in text form: | ||
3163 | .Pp | ||
3164 | .Bd -literal | ||
3165 | \& $ openssl ocsp -issuer issuer.pem -cert c1.pem -cert c2.pem \e | ||
3166 | \& -url http://ocsp.myhost.com/ -resp_text -respout resp.der | ||
3167 | .Ed | ||
3168 | .Pp | ||
3169 | Read in an OCSP response and print out text form: | ||
3170 | .Pp | ||
3171 | .Bd -literal | ||
3172 | \& $ openssl ocsp -respin resp.der -text | ||
3173 | .Ed | ||
3174 | .Pp | ||
3175 | OCSP server on port 8888 using a standard | ||
3176 | .Nm ca | ||
3177 | configuration, and a separate responder certificate. | ||
3178 | All requests and responses are printed to a file: | ||
3179 | .Pp | ||
3180 | .Bd -literal | ||
3181 | \& $ openssl ocsp -index demoCA/index.txt -port 8888 -rsigner rcert.pem \e | ||
3182 | -CA demoCA/cacert.pem -text -out log.txt | ||
3183 | .Ed | ||
3184 | .Pp | ||
3185 | As above, but exit after processing one request: | ||
3186 | .Pp | ||
3187 | .Bd -literal | ||
3188 | \& $ openssl ocsp -index demoCA/index.txt -port 8888 -rsigner rcert.pem \e | ||
3189 | -CA demoCA/cacert.pem -nrequest 1 | ||
3190 | .Ed | ||
3191 | .Pp | ||
3192 | Query status information using internally generated request: | ||
3193 | .Pp | ||
3194 | .Bd -literal | ||
3195 | \& $ openssl ocsp -index demoCA/index.txt -rsigner rcert.pem -CA \e | ||
3196 | demoCA/cacert.pem -issuer demoCA/cacert.pem -serial 1 | ||
3197 | .Ed | ||
3198 | .Pp | ||
3199 | Query status information using request read from a file, write response to a | ||
3200 | second file: | ||
3201 | .Pp | ||
3202 | .Bd -literal | ||
3203 | \& $ openssl ocsp -index demoCA/index.txt -rsigner rcert.pem -CA \e | ||
3204 | demoCA/cacert.pem -reqin req.der -respout resp.der | ||
3205 | .Ed | ||
3206 | .\" | ||
3207 | .\" PASSWD | ||
3208 | .\" | ||
3209 | .Sh PASSWD | ||
3210 | .Nm openssl passwd | ||
3211 | .Op Fl crypt | ||
3212 | .Op Fl 1 | ||
3213 | .Op Fl apr1 | ||
3214 | .Op Fl salt Ar string | ||
3215 | .Op Fl in Ar file | ||
3216 | .Op Fl stdin | ||
3217 | .Op Fl noverify | ||
3218 | .Op Fl quiet | ||
3219 | .Op Fl table | ||
3220 | .Op Ar password | ||
3221 | .Pp | ||
3222 | The | ||
3223 | .Nm passwd | ||
3224 | command computes the hash of a password typed at run-time | ||
3225 | or the hash of each password in a list. | ||
3226 | The password list is taken from the named | ||
3227 | .Ar file | ||
3228 | for option | ||
3229 | .Fl in , | ||
3230 | from stdin for option | ||
3231 | .Fl stdin, | ||
3232 | or from the command line, or from the terminal otherwise. | ||
3233 | The Unix standard algorithm | ||
3234 | .Em crypt | ||
3235 | and the MD5-based BSD password algorithm | ||
3236 | .Em 1 | ||
3237 | and its Apache variant | ||
3238 | .Em apr1 | ||
3239 | are available. | ||
3240 | .Pp | ||
3241 | The options are as follows: | ||
3242 | .Bl -tag -width Ds | ||
3243 | .It Fl crypt | ||
3244 | Use the | ||
3245 | .Em crypt | ||
3246 | algorithm (default). | ||
3247 | .It Fl 1 | ||
3248 | Use the MD5 based BSD password algorithm | ||
3249 | .Em 1 . | ||
3250 | .It Fl apr1 | ||
3251 | Use the | ||
3252 | .Em apr1 | ||
3253 | algorithm (Apache variant of the BSD algorithm). | ||
3254 | .It Fl salt Ar string | ||
3255 | Use the specified | ||
3256 | .Ar salt . | ||
3257 | When reading a password from the terminal, this implies | ||
3258 | .Fl noverify . | ||
3259 | .It Fl in Ar file | ||
3260 | Read passwords from | ||
3261 | .Ar file . | ||
3262 | .It Fl stdin | ||
3263 | Read passwords from | ||
3264 | .Em stdin . | ||
3265 | .It Fl noverify | ||
3266 | Don't verify when reading a password from the terminal. | ||
3267 | .It Fl quiet | ||
3268 | Don't output warnings when passwords given at the command line are truncated. | ||
3269 | .It Fl table | ||
3270 | In the output list, prepend the cleartext password and a TAB character | ||
3271 | to each password hash. | ||
3272 | .El | ||
3273 | .Sh PASSWD EXAMPLES | ||
3274 | .Pp | ||
3275 | .Bl -tag -width Ds | ||
3276 | .It $ openssl passwd -crypt -salt xx password | ||
3277 | prints | ||
3278 | .Em xxj31ZMTZzkVA . | ||
3279 | .It $ openssl passwd -1 -salt xxxxxxxx password | ||
3280 | prints | ||
3281 | .Em $1$xxxxxxxx$8XJIcl6ZXqBMCK0qFevqT1 . | ||
3282 | .It $ openssl passwd -apr1 -salt xxxxxxxx password | ||
3283 | prints | ||
3284 | .Em $apr1$xxxxxxxx$dxHfLAsjHkDRmG83UXe8K0 . | ||
3285 | .\" | ||
3286 | .\" PKCS7 | ||
3287 | .\" | ||
3288 | .Sh PKCS7 | ||
3289 | .Nm openssl pkcs7 | ||
3290 | .Bk -words | ||
3291 | .Op Fl inform Ar PEM|DER | ||
3292 | .Op Fl outform Ar PEM|DER | ||
3293 | .Op Fl in Ar filename | ||
3294 | .Op Fl out Ar filename | ||
3295 | .Op Fl print_certs | ||
3296 | .Op Fl text | ||
3297 | .Op Fl noout | ||
3298 | .Ek | ||
3299 | .br | ||
3300 | .Pp | ||
3301 | The | ||
3302 | .Nm pkcs7 | ||
3303 | command processes PKCS#7 files in | ||
3304 | .Em DER | ||
3305 | or | ||
3306 | .Em PEM | ||
3307 | format. | ||
3308 | .Pp | ||
3309 | The options are as follows: | ||
3310 | .Bl -tag -width Ds | ||
3311 | .It Fl inform Ar DER|PEM | ||
3312 | This specifies the input format. | ||
3313 | .Ar DER | ||
3314 | format is DER encoded PKCS#7 v1.5 structure. | ||
3315 | .Ar PEM | ||
3316 | (the default) is a base64 encoded version of the DER form with header | ||
3317 | and footer lines. | ||
3318 | .It Fl outform Ar DER|PEM | ||
3319 | This specifies the output format, the options have the same meaning as the | ||
3320 | .Fl inform | ||
3321 | option. | ||
3322 | .It Fl in Ar filename | ||
3323 | This specifies the input | ||
3324 | .Ar filename | ||
3325 | to read from or standard input if this option is not specified. | ||
3326 | .It Fl out Ar filename | ||
3327 | Specifies the output | ||
3328 | .Ar filename | ||
3329 | to write to or standard output by default. | ||
3330 | .It Fl print_certs | ||
3331 | Prints out any certificates or CRLs contained in the file. | ||
3332 | They are preceded by their subject and issuer names in one line format. | ||
3333 | .It Fl text | ||
3334 | Prints out certificate details in full rather than just subject and | ||
3335 | issuer names. | ||
3336 | .It Fl noout | ||
3337 | Don't output the encoded version of the PKCS#7 structure | ||
3338 | (or certificates if | ||
3339 | .Fl print_certs | ||
3340 | is set). | ||
3341 | .Sh PKCS7 EXAMPLES | ||
3342 | Convert a PKCS#7 file from | ||
3343 | .Em PEM | ||
3344 | to | ||
3345 | .Em DER : | ||
3346 | .Pp | ||
3347 | \& $ openssl pkcs7 -in file.pem -outform DER -out file.der | ||
3348 | .Pp | ||
3349 | Output all certificates in a file: | ||
3350 | .Pp | ||
3351 | \& $ openssl pkcs7 -in file.pem -print_certs -out certs.pem | ||
3352 | .Sh PKCS7 NOTES | ||
3353 | The | ||
3354 | .Em PEM | ||
3355 | PKCS#7 format uses the header and footer lines: | ||
3356 | .Pp | ||
3357 | .Bd -literal | ||
3358 | \& -----BEGIN PKCS7----- | ||
3359 | \& -----END PKCS7----- | ||
3360 | .Ed | ||
3361 | .Pp | ||
3362 | For compatibility with some CAs it will also accept: | ||
3363 | .Pp | ||
3364 | .Bd -literal | ||
3365 | \& -----BEGIN CERTIFICATE----- | ||
3366 | \& -----END CERTIFICATE----- | ||
3367 | .Ed | ||
3368 | .Sh PKCS7 RESTRICTIONS | ||
3369 | There is no option to print out all the fields of a PKCS#7 file. | ||
3370 | .Pp | ||
3371 | The PKCS#7 routines only understand PKCS#7 v 1.5 as specified in RFC2315. | ||
3372 | They cannot currently parse, for example, the new CMS as described in RFC2630. | ||
3373 | .\" | ||
3374 | .\" PKCS8 | ||
3375 | .\" | ||
3376 | .Sh PKCS8 | ||
3377 | .Nm openssl pkcs8 | ||
3378 | .Bk -words | ||
3379 | .Op Fl topk8 | ||
3380 | .Op Fl inform Ar PEM|DER | ||
3381 | .Op Fl outform Ar PEM|DER | ||
3382 | .Op Fl in Ar filename | ||
3383 | .Op Fl passin Ar arg | ||
3384 | .Op Fl out Ar filename | ||
3385 | .Op Fl passout Ar arg | ||
3386 | .Op Fl noiter | ||
3387 | .Op Fl nocrypt | ||
3388 | .Op Fl nooct | ||
3389 | .Op Fl embed | ||
3390 | .Op Fl nsdb | ||
3391 | .Op Fl v2 Ar alg | ||
3392 | .Op Fl v1 Ar alg | ||
3393 | .Ek | ||
3394 | .Pp | ||
3395 | The | ||
3396 | .Nm pkcs8 | ||
3397 | command processes private keys in PKCS#8 format. | ||
3398 | It can handle both unencrypted PKCS#8 PrivateKeyInfo format | ||
3399 | and EncryptedPrivateKeyInfo format with a variety of PKCS#5 | ||
3400 | (v1.5 and v2.0) and PKCS#12 algorithms. | ||
3401 | .Pp | ||
3402 | The options are as follows: | ||
3403 | .Bl -tag -width Ds | ||
3404 | .It Fl topk8 | ||
3405 | Normally a PKCS#8 private key is expected on input and a traditional format | ||
3406 | private key will be written. | ||
3407 | With the | ||
3408 | .Fl topk8 | ||
3409 | option the situation is reversed: | ||
3410 | it reads a traditional format private key and writes a PKCS#8 format key. | ||
3411 | .It Fl inform Ar DER|PEM | ||
3412 | This specifies the input format. | ||
3413 | If a PKCS#8 format key is expected on input, | ||
3414 | then either a | ||
3415 | .Em DER | ||
3416 | or | ||
3417 | .Em PEM | ||
3418 | encoded version of a PKCS#8 key will be expected. | ||
3419 | Otherwise the | ||
3420 | .Em DER | ||
3421 | or | ||
3422 | .Em PEM | ||
3423 | format of the traditional format private key is used. | ||
3424 | .It Fl outform Ar DER|PEM | ||
3425 | This specifies the output format, the options have the same meaning as the | ||
3426 | .Fl inform | ||
3427 | option. | ||
3428 | .It Fl in Ar filename | ||
3429 | This specifies the input | ||
3430 | .Ar filename | ||
3431 | to read a key from or standard input if this option is not specified. | ||
3432 | If the key is encrypted a pass phrase will be prompted for. | ||
3433 | .It Fl passin Ar arg | ||
3434 | The input file password source. | ||
3435 | For more information about the format of | ||
3436 | .Ar arg | ||
3437 | see the | ||
3438 | .Sx PASS PHRASE ARGUMENTS | ||
3439 | section above. | ||
3440 | .It Fl out Ar filename | ||
3441 | This specifies the output | ||
3442 | .Ar filename | ||
3443 | to write a key to or standard output by default. | ||
3444 | If any encryption options are set then a pass phrase will be prompted for. | ||
3445 | The output filename should | ||
3446 | .Em not | ||
3447 | be the same as the input filename. | ||
3448 | .It Fl passout Ar arg | ||
3449 | The output file password source. | ||
3450 | For more information about the format of | ||
3451 | .Ar arg | ||
3452 | see the | ||
3453 | .Sx PASS PHRASE ARGUMENTS | ||
3454 | section above. | ||
3455 | .It Fl nocrypt | ||
3456 | PKCS#8 keys generated or input are normally PKCS#8 | ||
3457 | .Em EncryptedPrivateKeyInfo | ||
3458 | structures using an appropriate password based encryption algorithm. | ||
3459 | With this option an unencrypted | ||
3460 | .Em PrivateKeyInfo | ||
3461 | structure is expected or output. | ||
3462 | This option does not encrypt private keys at all and should only be used | ||
3463 | when absolutely necessary. | ||
3464 | Certain software such as some versions of Java code signing software used | ||
3465 | unencrypted private keys. | ||
3466 | .It Fl nooct | ||
3467 | This option generates RSA private keys in a broken format that some software | ||
3468 | uses. | ||
3469 | Specifically the private key should be enclosed in a OCTET STRING, | ||
3470 | but some software just includes the structure itself without the | ||
3471 | surrounding OCTET STRING. | ||
3472 | .It Fl embed | ||
3473 | This option generates DSA keys in a broken format. | ||
3474 | The DSA parameters are embedded inside the | ||
3475 | .Em PrivateKey | ||
3476 | structure. | ||
3477 | In this form the OCTET STRING contains an ASN1 SEQUENCE consisting of | ||
3478 | two structures: | ||
3479 | a SEQUENCE containing the parameters and an ASN1 INTEGER containing | ||
3480 | the private key. | ||
3481 | .It Fl nsdb | ||
3482 | This option generates DSA keys in a broken format compatible with Netscape | ||
3483 | private key databases. | ||
3484 | The | ||
3485 | .Em PrivateKey | ||
3486 | contains a SEQUENCE consisting of the public and private keys, respectively. | ||
3487 | .It Fl v2 Ar alg | ||
3488 | This option enables the use of PKCS#5 v2.0 algorithms. | ||
3489 | Normally PKCS#8 private keys are encrypted with the password based | ||
3490 | encryption algorithm called | ||
3491 | .Em pbeWithMD5AndDES-CBC ; | ||
3492 | this uses 56 bit DES encryption but it was the strongest encryption | ||
3493 | algorithm supported in PKCS#5 v1.5. | ||
3494 | Using the | ||
3495 | .Fl v2 | ||
3496 | option PKCS#5 v2.0 algorithms are used which can use any | ||
3497 | encryption algorithm such as 168 bit triple DES or 128 bit RC2, however | ||
3498 | not many implementations support PKCS#5 v2.0 yet. | ||
3499 | If using private keys with | ||
3500 | .Nm OpenSSL | ||
3501 | then this doesn't matter. | ||
3502 | .Pp | ||
3503 | The | ||
3504 | .Ar alg | ||
3505 | argument is the encryption algorithm to use, valid values include | ||
3506 | .Ar des , des3 | ||
3507 | and | ||
3508 | .Ar rc2 . | ||
3509 | It is recommended that | ||
3510 | .Ar des3 | ||
3511 | is used. | ||
3512 | .It Fl v1 Ar alg | ||
3513 | This option specifies a PKCS#5 v1.5 or PKCS#12 algorithm to use. | ||
3514 | A complete list of possible algorithms is included below. | ||
3515 | .Sh PKCS8 NOTES | ||
3516 | The encrypted form of a | ||
3517 | .Em PEM | ||
3518 | encoded PKCS#8 file uses the following | ||
3519 | headers and footers: | ||
3520 | .Pp | ||
3521 | .Bd -literal | ||
3522 | \& -----BEGIN ENCRYPTED PRIVATE KEY----- | ||
3523 | \& -----END ENCRYPTED PRIVATE KEY----- | ||
3524 | .Ed | ||
3525 | .Pp | ||
3526 | The unencrypted form uses: | ||
3527 | .Pp | ||
3528 | .Bd -literal | ||
3529 | \& -----BEGIN PRIVATE KEY----- | ||
3530 | \& -----END PRIVATE KEY----- | ||
3531 | .Ed | ||
3532 | .Pp | ||
3533 | Private keys encrypted using PKCS#5 v2.0 algorithms and high iteration | ||
3534 | counts are more secure that those encrypted using the traditional | ||
3535 | .Nm SSLeay | ||
3536 | compatible formats. | ||
3537 | So if additional security is considered, important the keys should be converted. | ||
3538 | .Pp | ||
3539 | The default encryption is only 56 bits because this is the encryption | ||
3540 | that most current implementations of PKCS#8 will support. | ||
3541 | .Pp | ||
3542 | Some software may use PKCS#12 password based encryption algorithms | ||
3543 | with PKCS#8 format private keys: these are handled automatically | ||
3544 | but there is no option to produce them. | ||
3545 | .Pp | ||
3546 | It is possible to write out | ||
3547 | .Em DER | ||
3548 | encoded encrypted private keys in PKCS#8 format because the encryption | ||
3549 | details are included at an ASN1 | ||
3550 | level whereas the traditional format includes them at a | ||
3551 | .Em PEM | ||
3552 | level. | ||
3553 | .Sh PKCS#5 V1.5 AND PKCS#12 ALGORITHMS | ||
3554 | Various algorithms can be used with the | ||
3555 | .Fl v1 | ||
3556 | command line option, including PKCS#5 v1.5 and PKCS#12. | ||
3557 | These are described in more detail below. | ||
3558 | .Pp | ||
3559 | .Bd -literal -offset indent | ||
3560 | .It Ar \ \ PBE-MD2-DES PBE-MD5-DES | ||
3561 | .br | ||
3562 | These algorithms were included in the original PKCS#5 v1.5 specification. | ||
3563 | They only offer 56 bits of protection since they both use DES. | ||
3564 | .It Ar \ \ PBE-SHA1-RC2-64 PBE-MD2-RC2-64 PBE-MD5-RC2-64 PBE-SHA1-DES | ||
3565 | .br | ||
3566 | These algorithms are not mentioned in the original PKCS#5 v1.5 specification | ||
3567 | but they use the same key derivation algorithm and are supported by some | ||
3568 | software. | ||
3569 | They are mentioned in PKCS#5 v2.0. | ||
3570 | They use either 64 bit RC2 or 56 bit DES. | ||
3571 | .It Ar \ \ PBE-SHA1-RC4-128 PBE-SHA1-RC4-40 PBE-SHA1-3DES PBE-SHA1-2DES PBE-SHA1-RC2-128 PBE-SHA1-RC2-40 | ||
3572 | .br | ||
3573 | These algorithms use the PKCS#12 password based encryption algorithm and | ||
3574 | allow strong encryption algorithms like triple DES or 128 bit RC2 to be used. | ||
3575 | .Ed | ||
3576 | .Sh PKCS8 EXAMPLES | ||
3577 | Convert a private from traditional to PKCS#5 v2.0 format using triple DES: | ||
3578 | .Pp | ||
3579 | \& $ openssl pkcs8 -in key.pem -topk8 -v2 des3 -out enckey.pem | ||
3580 | .Pp | ||
3581 | Convert a private key to PKCS#8 using a PKCS#5 1.5 compatible algorithm (DES): | ||
3582 | .Pp | ||
3583 | \& $ openssl pkcs8 -in key.pem -topk8 -out enckey.pem | ||
3584 | .Pp | ||
3585 | Convert a private key to PKCS#8 using a PKCS#12 compatible algorithm (3DES): | ||
3586 | .Pp | ||
3587 | \& $ openssl pkcs8 -in key.pem -topk8 -out enckey.pem -v1 PBE-SHA1-3DES | ||
3588 | .Pp | ||
3589 | Read a DER unencrypted PKCS#8 format private key: | ||
3590 | .Pp | ||
3591 | \& $ openssl pkcs8 -inform DER -nocrypt -in key.der -out key.pem | ||
3592 | .Pp | ||
3593 | Convert a private key from any PKCS#8 format to traditional format: | ||
3594 | .Pp | ||
3595 | \& $ openssl pkcs8 -in pk8.pem -out key.pem | ||
3596 | .Sh PKCS8 STANDARDS | ||
3597 | Test vectors from this PKCS#5 v2.0 implementation were posted to the | ||
3598 | pkcs-tng mailing list using triple DES, DES and RC2 with high iteration | ||
3599 | counts, several people confirmed that they could decrypt the private | ||
3600 | keys produced and therefore it can be assumed that the PKCS#5 v2.0 | ||
3601 | implementation is reasonably accurate at least as far as these | ||
3602 | algorithms are concerned. | ||
3603 | .Pp | ||
3604 | The format of PKCS#8 DSA (and other) private keys is not well documented: | ||
3605 | it is hidden away in PKCS#11 v2.01, section 11.9.; | ||
3606 | .Nm OpenSSL Ns Li 's | ||
3607 | default DSA PKCS#8 private key format complies with this standard. | ||
3608 | .Sh PKCS8 BUGS | ||
3609 | There should be an option that prints out the encryption algorithm | ||
3610 | in use and other details such as the iteration count. | ||
3611 | .Pp | ||
3612 | PKCS#8 using triple DES and PKCS#5 v2.0 should be the default private | ||
3613 | key format; for | ||
3614 | .Nm OpenSSL | ||
3615 | compatibility, several of the utilities use the old format at present. | ||
3616 | .\" | ||
3617 | .\" PKCS12 | ||
3618 | .\" | ||
3619 | .Sh PKCS12 | ||
3620 | .Nm "openssl pkcs12" | ||
3621 | .Op Fl export | ||
3622 | .Op Fl chain | ||
3623 | .Op Fl inkey Ar filename | ||
3624 | .Op Fl certfile Ar filename | ||
3625 | .Op Fl name Ar name | ||
3626 | .Op Fl caname Ar name | ||
3627 | .Op Fl in Ar filename | ||
3628 | .Op Fl out Ar filename | ||
3629 | .Op Fl noout | ||
3630 | .Op Fl nomacver | ||
3631 | .Op Fl nocerts | ||
3632 | .Op Fl clcerts | ||
3633 | .Op Fl cacerts | ||
3634 | .Op Fl nokeys | ||
3635 | .Op Fl info | ||
3636 | .Op Fl des | ||
3637 | .Op Fl des3 | ||
3638 | .Op Fl idea | ||
3639 | .Op Fl nodes | ||
3640 | .Op Fl noiter | ||
3641 | .Op Fl maciter | ||
3642 | .Op Fl twopass | ||
3643 | .Op Fl descert | ||
3644 | .Op Fl certpbe | ||
3645 | .Op Fl keypbe | ||
3646 | .Op Fl keyex | ||
3647 | .Op Fl keysig | ||
3648 | .Op Fl password Ar arg | ||
3649 | .Op Fl passin Ar arg | ||
3650 | .Op Fl passout Ar arg | ||
3651 | .Op Fl rand Ar file ... | ||
3652 | .Pp | ||
3653 | The | ||
3654 | .Nm pkcs12 | ||
3655 | command allows PKCS#12 files (sometimes referred to as PFX files) | ||
3656 | to be created and parsed. | ||
3657 | PKCS#12 files are used by several programs including Netscape, MSIE | ||
3658 | and MS Outlook. | ||
3659 | .Pp | ||
3660 | There are a lot of options; the meaning of some depends on whether a | ||
3661 | PKCS#12 file is being created or parsed. | ||
3662 | By default a PKCS#12 file is parsed; | ||
3663 | a PKCS#12 file can be created by using the | ||
3664 | .Fl export | ||
3665 | option (see below). | ||
3666 | .Sh PKCS12 PARSING OPTIONS | ||
3667 | .Bd -ragged -offset indent | ||
3668 | .It Fl in Ar filename | ||
3669 | This specifies the | ||
3670 | .Ar filename | ||
3671 | of the PKCS#12 file to be parsed. | ||
3672 | Standard input is used by default. | ||
3673 | .It Fl out Ar filename | ||
3674 | The | ||
3675 | .Ar filename | ||
3676 | to write certificates and private keys to, standard output by default. | ||
3677 | They are all written in | ||
3678 | .Em PEM | ||
3679 | format. | ||
3680 | .It Fl pass Ar arg , Fl passin Ar arg | ||
3681 | The PKCS#12 file (i.e. input file) password source. | ||
3682 | For more information about the format of | ||
3683 | .Ar arg | ||
3684 | see the | ||
3685 | .Sx PASS PHRASE ARGUMENTS | ||
3686 | section above. | ||
3687 | .It Fl passout Ar arg | ||
3688 | Pass phrase source to encrypt any outputed private keys with. | ||
3689 | For more information about the format of | ||
3690 | .Ar arg | ||
3691 | see the | ||
3692 | .Sx PASS PHRASE ARGUMENTS | ||
3693 | section above. | ||
3694 | .It Fl noout | ||
3695 | This option inhibits output of the keys and certificates to the output file | ||
3696 | version of the PKCS#12 file. | ||
3697 | .It Fl clcerts | ||
3698 | Only output client certificates (not CA certificates). | ||
3699 | .It Fl cacerts | ||
3700 | Only output CA certificates (not client certificates). | ||
3701 | .It Fl nocerts | ||
3702 | No certificates at all will be output. | ||
3703 | .It Fl nokeys | ||
3704 | No private keys will be output. | ||
3705 | .It Fl info | ||
3706 | Output additional information about the PKCS#12 file structure, | ||
3707 | algorithms used and iteration counts. | ||
3708 | .It Fl des | ||
3709 | Use DES to encrypt private keys before outputting. | ||
3710 | .It Fl des3 | ||
3711 | Use triple DES to encrypt private keys before outputting, this is the default. | ||
3712 | .It Fl idea | ||
3713 | Use IDEA to encrypt private keys before outputting. | ||
3714 | .It Fl nodes | ||
3715 | Don't encrypt the private keys at all. | ||
3716 | .It Fl nomacver | ||
3717 | Don't attempt to verify the integrity MAC before reading the file. | ||
3718 | .It Fl twopass | ||
3719 | Prompt for separate integrity and encryption passwords: most software | ||
3720 | always assumes these are the same so this option will render such | ||
3721 | PKCS#12 files unreadable. | ||
3722 | .Ed | ||
3723 | .Sh PKCS12 FILE CREATION OPTIONS | ||
3724 | .Bd -ragged -offset indent | ||
3725 | .It Fl export | ||
3726 | This option specifies that a PKCS#12 file will be created rather than | ||
3727 | parsed. | ||
3728 | .It Fl out Ar filename | ||
3729 | This specifies | ||
3730 | .Ar filename | ||
3731 | to write the PKCS#12 file to. | ||
3732 | Standard output is used by default. | ||
3733 | .It Fl in Ar filename | ||
3734 | The | ||
3735 | .Ar filename | ||
3736 | to read certificates and private keys from, standard input by default. | ||
3737 | They must all be in | ||
3738 | .Em PEM | ||
3739 | format. | ||
3740 | The order doesn't matter but one private key and its corresponding | ||
3741 | certificate should be present. | ||
3742 | If additional certificates are present, they will also be included | ||
3743 | in the PKCS#12 file. | ||
3744 | .It Fl inkey Ar filename | ||
3745 | File to read private key from. | ||
3746 | If not present then a private key must be present in the input file. | ||
3747 | .It Fl name Ar friendlyname | ||
3748 | This specifies the "friendly name" for the certificate and private key. | ||
3749 | This name is typically displayed in list boxes by software importing the file. | ||
3750 | .It Fl certfile Ar filename | ||
3751 | A filename to read additional certificates from. | ||
3752 | .It Fl caname Ar friendlyname | ||
3753 | This specifies the "friendly name" for other certificates. | ||
3754 | This option may be used multiple times to specify names for all certificates | ||
3755 | in the order they appear. | ||
3756 | Netscape ignores friendly names on other certificates, | ||
3757 | whereas MSIE displays them. | ||
3758 | .It Fl pass Ar arg , Fl passout Ar arg | ||
3759 | The PKCS#12 file (i.e. output file) password source. | ||
3760 | For more information about the format of | ||
3761 | .Ar arg | ||
3762 | see the | ||
3763 | .Sx PASS PHRASE ARGUMENTS | ||
3764 | section above. | ||
3765 | .It Fl passin Ar password | ||
3766 | Pass phrase source to decrypt any input private keys with. | ||
3767 | For more information about the format of | ||
3768 | .Ar arg | ||
3769 | see the | ||
3770 | .Sx PASS PHRASE ARGUMENTS | ||
3771 | section above. | ||
3772 | .It Fl chain | ||
3773 | If this option is present then an attempt is made to include the entire | ||
3774 | certificate chain of the user certificate. | ||
3775 | The standard CA store is used for this search. | ||
3776 | If the search fails it is considered a fatal error. | ||
3777 | .It Fl descert | ||
3778 | Encrypt the certificate using triple DES; this may render the PKCS#12 | ||
3779 | file unreadable by some "export grade" software. | ||
3780 | By default the private key is encrypted using triple DES and the | ||
3781 | certificate using 40 bit RC2. | ||
3782 | .It Fl keypbe Ar alg , Fl certpbe Ar alg | ||
3783 | These options allow the algorithm used to encrypt the private key and | ||
3784 | certificates to be selected. | ||
3785 | Although any PKCS#5 v1.5 or PKCS#12 algorithms can be selected, | ||
3786 | it is advisable only to use PKCS#12 algorithms. | ||
3787 | See the list in the | ||
3788 | .Sx PKCS12 NOTES | ||
3789 | section for more information. | ||
3790 | .It Fl keyex | keysig | ||
3791 | Specifies that the private key is to be used for key exchange or just signing. | ||
3792 | This option is only interpreted by MSIE and similar MS software. | ||
3793 | Normally "export grade" software will only allow 512 bit RSA keys to be | ||
3794 | used for encryption purposes, but arbitrary length keys for signing. | ||
3795 | The | ||
3796 | .Fl keysig | ||
3797 | option marks the key for signing only. | ||
3798 | Signing only keys can be used for S/MIME signing, | ||
3799 | authenticode (ActiveX control signing) and SSL client authentication; | ||
3800 | however, due to a bug only MSIE 5.0 and later support | ||
3801 | the use of signing only keys for SSL client authentication. | ||
3802 | .It Fl nomaciter , noiter | ||
3803 | These options affect the iteration counts on the MAC and key algorithms. | ||
3804 | Unless you wish to produce files compatible with MSIE 4.0 you should leave | ||
3805 | these options alone. | ||
3806 | .Pp | ||
3807 | To discourage attacks by using large dictionaries of common passwords the | ||
3808 | algorithm that derives keys from passwords can have an iteration count applied | ||
3809 | to it: this causes a certain part of the algorithm to be repeated and slows it | ||
3810 | down. | ||
3811 | The MAC is used to check the file integrity but since it will normally | ||
3812 | have the same password as the keys and certificates it could also be attacked. | ||
3813 | By default both MAC and encryption iteration counts are set to 2048; | ||
3814 | using these options the MAC and encryption iteration counts can be set to 1. | ||
3815 | Since this reduces the file security you should not use these options | ||
3816 | unless you really have to. | ||
3817 | Most software supports both MAC and key iteration counts. | ||
3818 | MSIE 4.0 doesn't support MAC iteration counts, so it needs the | ||
3819 | .Fl nomaciter | ||
3820 | option. | ||
3821 | .It Fl maciter | ||
3822 | This option is included for compatibility with previous versions, it used | ||
3823 | to be needed to use MAC iterations counts but they are now used by default. | ||
3824 | .It Fl rand Ar file ... | ||
3825 | A | ||
3826 | .Ar file | ||
3827 | or | ||
3828 | .Ar file Ns Li s | ||
3829 | containing random data used to seed the random number generator, | ||
3830 | or an EGD socket (see | ||
3831 | .Xr RAND_egd 3 ) . | ||
3832 | Multiple files can be specified separated by an OS-dependent character. | ||
3833 | The separator is | ||
3834 | .Cm \&; | ||
3835 | for MS-Windows, | ||
3836 | .Cm \&, | ||
3837 | for OpenVMS, and | ||
3838 | .Cm \&: | ||
3839 | for all others. | ||
3840 | .Ed | ||
3841 | .Sh PKCS12 NOTES | ||
3842 | Although there are a large number of options, | ||
3843 | most of them are very rarely used. | ||
3844 | For PKCS#12 file parsing only | ||
3845 | .Fl in | ||
3846 | and | ||
3847 | .Fl out | ||
3848 | need to be used for PKCS#12 file creation. | ||
3849 | .Fl export | ||
3850 | and | ||
3851 | .Fl name | ||
3852 | are also used. | ||
3853 | .Pp | ||
3854 | If none of the | ||
3855 | .Fl clcerts , cacerts | ||
3856 | or | ||
3857 | .Fl nocerts | ||
3858 | options are present then all certificates will be output in the order | ||
3859 | they appear in the input PKCS#12 files. | ||
3860 | There is no guarantee that the first certificate present is | ||
3861 | the one corresponding to the private key. | ||
3862 | Certain software which requires a private key and certificate and assumes | ||
3863 | the first certificate in the file is the one corresponding to the private key: | ||
3864 | this may not always be the case. | ||
3865 | Using the | ||
3866 | .Fl clcerts | ||
3867 | option will solve this problem by only outputting the certificate | ||
3868 | corresponding to the private key. | ||
3869 | If the CA certificates are required then they can be output to a separate | ||
3870 | file using the | ||
3871 | .Fl nokeys | ||
3872 | and | ||
3873 | .Fl cacerts | ||
3874 | options to just output CA certificates. | ||
3875 | .Pp | ||
3876 | The | ||
3877 | .Fl keypbe | ||
3878 | and | ||
3879 | .Fl certpbe | ||
3880 | algorithms allow the precise encryption algorithms for private keys | ||
3881 | and certificates to be specified. | ||
3882 | Normally the defaults are fine but occasionally software can't handle | ||
3883 | triple DES encrypted private keys; | ||
3884 | then the option | ||
3885 | .Fl keypbe Ar PBE-SHA1-RC2-40 | ||
3886 | can be used to reduce the private key encryption to 40 bit RC2. | ||
3887 | A complete description of all algorithms is contained in the | ||
3888 | .Sx PKCS8 | ||
3889 | section above. | ||
3890 | .Sh PKCS12 EXAMPLES | ||
3891 | Parse a PKCS#12 file and output it to a file: | ||
3892 | .Pp | ||
3893 | \& $ openssl pkcs12 -in file.p12 -out file.pem | ||
3894 | .Pp | ||
3895 | Output only client certificates to a file: | ||
3896 | .Pp | ||
3897 | \& $ openssl pkcs12 -in file.p12 -clcerts -out file.pem | ||
3898 | .Pp | ||
3899 | Don't encrypt the private key: | ||
3900 | .Pp | ||
3901 | \& $ openssl pkcs12 -in file.p12 -out file.pem -nodes | ||
3902 | .br | ||
3903 | .Pp | ||
3904 | Print some info about a PKCS#12 file: | ||
3905 | .Pp | ||
3906 | \& $ openssl pkcs12 -in file.p12 -info -noout | ||
3907 | .Pp | ||
3908 | Create a PKCS#12 file: | ||
3909 | .Pp | ||
3910 | .Bd -literal | ||
3911 | \& $ openssl pkcs12 -export -in file.pem -out file.p12 \e | ||
3912 | -name "My Certificate" | ||
3913 | .Ed | ||
3914 | .Pp | ||
3915 | Include some extra certificates: | ||
3916 | .Pp | ||
3917 | .Bd -literal | ||
3918 | \& $ openssl pkcs12 -export -in file.pem -out file.p12 \e | ||
3919 | -name "My Certificate" -certfile othercerts.pem | ||
3920 | .Ed | ||
3921 | .Sh PKCS12 BUGS | ||
3922 | Some would argue that the PKCS#12 standard is one big bug :\-) | ||
3923 | .Pp | ||
3924 | Versions of | ||
3925 | .Nm OpenSSL | ||
3926 | before 0.9.6a had a bug in the PKCS#12 key generation routines. | ||
3927 | Under rare circumstances this could produce a PKCS#12 file encrypted | ||
3928 | with an invalid key. | ||
3929 | As a result some PKCS#12 files which triggered this bug | ||
3930 | from other implementations (MSIE or Netscape) could not be decrypted | ||
3931 | by | ||
3932 | .Nm OpenSSL | ||
3933 | and similarly | ||
3934 | .Nm OpenSSL | ||
3935 | could produce PKCS#12 files which could not be decrypted by other | ||
3936 | implementations. | ||
3937 | The chances of producing such a file are relatively small: less than 1 in 256. | ||
3938 | .Pp | ||
3939 | A side effect of fixing this bug is that any old invalidly encrypted PKCS#12 | ||
3940 | files can no longer be parsed by the fixed version. | ||
3941 | Under such circumstances the | ||
3942 | .Nm pkcs12 | ||
3943 | utility will report that the MAC is OK but fail with a decryption | ||
3944 | error when extracting private keys. | ||
3945 | .Pp | ||
3946 | This problem can be resolved by extracting the private keys and certificates | ||
3947 | from the PKCS#12 file using an older version of | ||
3948 | .Nm OpenSSL | ||
3949 | and recreating | ||
3950 | the PKCS#12 file from the keys and certificates using a newer version of | ||
3951 | .Nm OpenSSL . | ||
3952 | For example: | ||
3953 | .Pp | ||
3954 | .Bd -literal | ||
3955 | \& $ old-openssl -in bad.p12 -out keycerts.pem | ||
3956 | \& $ openssl -in keycerts.pem -export -name "My PKCS#12 file" -out fixed.p12 | ||
3957 | .Ed | ||
3958 | .\" | ||
3959 | .\" RAND | ||
3960 | .\" | ||
3961 | .Sh RAND | ||
3962 | .Cm openssl rand | ||
3963 | .Op Fl out Ar file | ||
3964 | .Op Fl rand Ar file | ||
3965 | .Op Fl base64 | ||
3966 | .Ar num | ||
3967 | .Pp | ||
3968 | The | ||
3969 | .Nm rand | ||
3970 | command outputs | ||
3971 | .Ar num | ||
3972 | pseudo-random bytes after seeding | ||
3973 | the random number generator once. | ||
3974 | As in other | ||
3975 | .Nm openssl | ||
3976 | command line tools, PRNG seeding uses the file | ||
3977 | .Pa $HOME/.rnd | ||
3978 | or | ||
3979 | .Pa .rnd | ||
3980 | in addition to the files given in the | ||
3981 | .Fl rand | ||
3982 | option. | ||
3983 | A new | ||
3984 | .Pa $HOME/.rnd | ||
3985 | or | ||
3986 | .Pa .rnd | ||
3987 | file will be written back if enough | ||
3988 | seeding was obtained from these sources. | ||
3989 | .Pp | ||
3990 | The options are as follows: | ||
3991 | .Bd -ragged -offset indent | ||
3992 | .It Fl out Ar file | ||
3993 | Write to | ||
3994 | .Ar file | ||
3995 | instead of standard output. | ||
3996 | .It Fl rand Ar file ... | ||
3997 | Use specified | ||
3998 | .Ar file | ||
3999 | or | ||
4000 | .Ar file Ns Li s | ||
4001 | or EGD socket (see | ||
4002 | .Xr RAND_egd 3 ) | ||
4003 | for seeding the random number generator. | ||
4004 | Multiple files can be specified separated by an OS-dependent character. | ||
4005 | The separator is | ||
4006 | .Cm \&; | ||
4007 | for MS-Windows, | ||
4008 | .Cm \&, | ||
4009 | for OpenVMS, and | ||
4010 | .Cm \&: | ||
4011 | for all others. | ||
4012 | .It Fl base64 | ||
4013 | Perform | ||
4014 | .Em base64 | ||
4015 | encoding on the output. | ||
4016 | .El | ||
4017 | .\" | ||
4018 | .\" REQ | ||
4019 | .\" | ||
4020 | .Sh REQ | ||
4021 | .Nm openssl req | ||
4022 | .Bk -words | ||
4023 | .Op Fl inform Ar PEM|DER | ||
4024 | .Op Fl outform Ar PEM|DER | ||
4025 | .Op Fl in Ar filename | ||
4026 | .Op Fl passin Ar arg | ||
4027 | .Op Fl out Ar filename | ||
4028 | .Op Fl passout Ar arg | ||
4029 | .Op Fl text | ||
4030 | .Op Fl pubkey | ||
4031 | .Op Fl noout | ||
4032 | .Op Fl verify | ||
4033 | .Op Fl modulus | ||
4034 | .Op Fl new | ||
4035 | .Op Fl rand Ar file ... | ||
4036 | .Op Fl newkey Ar rsa:bits | ||
4037 | .Op Fl newkey Ar dsa:file | ||
4038 | .Op Fl nodes | ||
4039 | .Op Fl key Ar filename | ||
4040 | .Op Fl keyform Ar PEM|DER | ||
4041 | .Op Fl keyout Ar filename | ||
4042 | .Op Fl Op Cm md5|sha1|md2|mdc2 | ||
4043 | .Op Fl config Ar filename | ||
4044 | .Op Fl subj Ar arg | ||
4045 | .Op Fl x509 | ||
4046 | .Op Fl days Ar n | ||
4047 | .Op Fl set_serial Ar n | ||
4048 | .Op Fl asn1-kludge | ||
4049 | .Op Fl newhdr | ||
4050 | .Op Fl extensions Ar section | ||
4051 | .Op Fl reqexts Ar section | ||
4052 | .Op Fl utf8 | ||
4053 | .Op Fl nameopt | ||
4054 | .Op Fl batch | ||
4055 | .Op Fl verbose | ||
4056 | .Ek | ||
4057 | .Pp | ||
4058 | The | ||
4059 | .Nm req | ||
4060 | command primarily creates and processes certificate requests | ||
4061 | in PKCS#10 format. | ||
4062 | It can additionally create self-signed certificates, | ||
4063 | for use as root CAs, for example. | ||
4064 | .Pp | ||
4065 | The options are as follows: | ||
4066 | .Bd -ragged -offset indent | ||
4067 | .It Fl inform Ar DER|PEM | ||
4068 | This specifies the input format. | ||
4069 | The | ||
4070 | .Ar DER | ||
4071 | argument uses an ASN1 DER encoded | ||
4072 | form compatible with the PKCS#10. | ||
4073 | The | ||
4074 | .Ar PEM | ||
4075 | form is the default format: | ||
4076 | it consists of the DER format base64 encoded with additional header and | ||
4077 | footer lines. | ||
4078 | .It Fl outform Ar DER|PEM | ||
4079 | This specifies the output format, the options have the same meaning as the | ||
4080 | .Fl inform | ||
4081 | option. | ||
4082 | .It Fl in Ar filename | ||
4083 | This specifies the input | ||
4084 | .Ar filename | ||
4085 | to read a request from, or standard input | ||
4086 | if this option is not specified. | ||
4087 | A request is only read if the creation options | ||
4088 | .Fl new | ||
4089 | and | ||
4090 | .Fl newkey | ||
4091 | are not specified. | ||
4092 | .It Fl passin Ar arg | ||
4093 | The input file password source. | ||
4094 | For more information about the format of | ||
4095 | .Ar arg | ||
4096 | see the | ||
4097 | .Sx PASS PHRASE ARGUMENTS | ||
4098 | section above. | ||
4099 | .It Fl out Ar filename | ||
4100 | This specifies the output | ||
4101 | .Ar filename | ||
4102 | to write to, or standard output by default. | ||
4103 | .It Fl passout Ar arg | ||
4104 | The output file password source. | ||
4105 | For more information about the format of | ||
4106 | .Ar arg | ||
4107 | see the | ||
4108 | .Sx PASS PHRASE ARGUMENTS | ||
4109 | section above. | ||
4110 | .It Fl text | ||
4111 | Prints out the certificate request in text form. | ||
4112 | .It Fl pubkey | ||
4113 | Outputs the public key. | ||
4114 | .It Fl noout | ||
4115 | This option prevents output of the encoded version of the request. | ||
4116 | .It Fl modulus | ||
4117 | This option prints out the value of the modulus of the public key | ||
4118 | contained in the request. | ||
4119 | .It Fl verify | ||
4120 | Verifies the signature on the request. | ||
4121 | .It Fl new | ||
4122 | This option generates a new certificate request. | ||
4123 | It will prompt the user for the relevant field values. | ||
4124 | The actual fields prompted for and their maximum and minimum sizes | ||
4125 | are specified in the configuration file and any requested extensions. | ||
4126 | .Pp | ||
4127 | If the | ||
4128 | .Fl key | ||
4129 | option is not used it will generate a new RSA private | ||
4130 | key using information specified in the configuration file. | ||
4131 | .It Fl rand Ar file ... | ||
4132 | A | ||
4133 | .Ar file | ||
4134 | or | ||
4135 | .Ar file Ns Li s | ||
4136 | containing random data used to seed the random number generator, | ||
4137 | or an EGD socket (see | ||
4138 | .Xr RAND_egd 3 ) . | ||
4139 | Multiple files can be specified separated by an OS-dependent character. | ||
4140 | The separator is | ||
4141 | .Cm \&; | ||
4142 | for MS-Windows, | ||
4143 | .Cm \&, | ||
4144 | for OpenVMS, and | ||
4145 | .Cm \&: | ||
4146 | for all others. | ||
4147 | .It Fl newkey Ar arg | ||
4148 | This option creates a new certificate request and a new private key. | ||
4149 | The argument takes one of two forms: | ||
4150 | .Ar rsa:nbits , | ||
4151 | where | ||
4152 | .Ar nbits | ||
4153 | is the number of bits, generates an RSA key | ||
4154 | .Ar nbits | ||
4155 | in size. | ||
4156 | .Ar dsa:filename | ||
4157 | generates a DSA key using the parameters in the file | ||
4158 | .Ar filename. | ||
4159 | .It Fl key Ar filename | ||
4160 | This specifies the file to read the private key from. | ||
4161 | It also accepts PKCS#8 format private keys for | ||
4162 | .Em PEM | ||
4163 | format files. | ||
4164 | .It Fl keyform Ar PEM|DER | ||
4165 | The format of the private key file specified in the | ||
4166 | .Fl key | ||
4167 | argument. | ||
4168 | .AR PEM | ||
4169 | is the default. | ||
4170 | .It Fl keyout Ar filename | ||
4171 | This gives the | ||
4172 | .Ar filename | ||
4173 | to write the newly created private key to. | ||
4174 | If this option is not specified, then the filename present in the | ||
4175 | configuration file is used. | ||
4176 | .It Fl nodes | ||
4177 | If this option is specified then if a private key is created it | ||
4178 | will not be encrypted. | ||
4179 | .It Fl md5|sha1|md2|mdc2 | ||
4180 | This specifies the message digest to sign the request with. | ||
4181 | This overrides the digest algorithm specified in the configuration file. | ||
4182 | This option is ignored for DSA requests: they always use SHA1. | ||
4183 | .It Fl config Ar filename | ||
4184 | This allows an alternative configuration file to be specified; | ||
4185 | this overrides the compile time filename or any specified in | ||
4186 | the | ||
4187 | .Em OPENSSL_CONF | ||
4188 | environment variable. | ||
4189 | .It Fl subj Ar arg | ||
4190 | Sets subject name for new request or supersedes the subject name | ||
4191 | when processing a request. | ||
4192 | The arg must be formatted as | ||
4193 | .Em /type0=value0/type1=value1/type2=... , | ||
4194 | characters may be escaped by \e (backslash), no spaces are skipped. | ||
4195 | .It Fl x509 | ||
4196 | This option outputs a self-signed certificate instead of a certificate | ||
4197 | request. | ||
4198 | This is typically used to generate a test certificate or | ||
4199 | a self-signed root CA. | ||
4200 | The extensions added to the certificate | ||
4201 | (if any) are specified in the configuration file. | ||
4202 | Unless specified using the | ||
4203 | .Fl set_serial | ||
4204 | option, 0 will be used for the serial number. | ||
4205 | .It Fl days Ar n | ||
4206 | When the | ||
4207 | .Fl x509 | ||
4208 | option is being used this specifies the number of | ||
4209 | days to certify the certificate for. | ||
4210 | The default is 30 days. | ||
4211 | .It Fl set_serial Ar n | ||
4212 | Serial number to use when outputting a self-signed certificate. | ||
4213 | This may be specified as a decimal value or a hex value if preceded by | ||
4214 | .Em 0x . | ||
4215 | It is possible to use negative serial numbers but this is not recommended. | ||
4216 | .It Fl extensions Ar section , Fl reqexts Ar section | ||
4217 | These options specify alternative sections to include certificate | ||
4218 | extensions (if the | ||
4219 | .Fl x509 | ||
4220 | option is present) or certificate request extensions. | ||
4221 | This allows several different sections to | ||
4222 | be used in the same configuration file to specify requests for | ||
4223 | a variety of purposes. | ||
4224 | .It Fl utf8 | ||
4225 | This option causes field values to be interpreted as UTF8 strings, by | ||
4226 | default they are interpreted as ASCII. | ||
4227 | This means that the field values, whether prompted from a terminal or | ||
4228 | obtained from a configuration file, must be valid UTF8 strings. | ||
4229 | .It Fl nameopt Ar option | ||
4230 | Option which determines how the subject or issuer names are displayed. | ||
4231 | The | ||
4232 | .Ar option | ||
4233 | argument can be a single option or multiple options separated by commas. | ||
4234 | Alternatively, the | ||
4235 | .Fl nameopt | ||
4236 | switch may be used more than once to set multiple options. | ||
4237 | See the | ||
4238 | .Sx X509 | ||
4239 | section below for details. | ||
4240 | .It Fl asn1-kludge | ||
4241 | By default the | ||
4242 | .Nm req | ||
4243 | command outputs certificate requests containing | ||
4244 | no attributes in the correct PKCS#10 format. | ||
4245 | However certain CAs will only | ||
4246 | accept requests containing no attributes in an invalid form: this | ||
4247 | option produces this invalid format. | ||
4248 | .Pp | ||
4249 | More precisely the | ||
4250 | .Em Attributes | ||
4251 | in a PKCS#10 certificate request are defined as a SET OF Attribute. | ||
4252 | They are | ||
4253 | .Em not | ||
4254 | optional, so if no attributes are present then they should be encoded as an | ||
4255 | empty SET OF. | ||
4256 | The invalid form does not include the empty | ||
4257 | SET OF, whereas the correct form does. | ||
4258 | .Pp | ||
4259 | It should be noted that very few CAs still require the use of this option. | ||
4260 | .It Fl newhdr | ||
4261 | Adds the word NEW to the | ||
4262 | .Em PEM | ||
4263 | file header and footer lines on the outputed request. | ||
4264 | Some software (Netscape certificate server) and some CAs need this. | ||
4265 | .It Fl batch | ||
4266 | Non-interactive mode. | ||
4267 | .It Fl verbose | ||
4268 | Print extra details about the operations being performed. | ||
4269 | .Ed | ||
4270 | .Sh REQ CONFIGURATION FILE FORMAT | ||
4271 | The configuration options are specified in the | ||
4272 | .Em req | ||
4273 | section of the configuration file. | ||
4274 | As with all configuration files, if no value is specified in the specific | ||
4275 | section (i.e. | ||
4276 | .Em req ) | ||
4277 | then the initial unnamed or | ||
4278 | .Em default | ||
4279 | section is searched too. | ||
4280 | .Pp | ||
4281 | The options available are described in detail below. | ||
4282 | .Bd -ragged -offset indent | ||
4283 | .It Ar input_password output_password | ||
4284 | The passwords for the input private key file (if present) and | ||
4285 | the output private key file (if one will be created). | ||
4286 | The command line options | ||
4287 | .Fl passin | ||
4288 | and | ||
4289 | .Fl passout | ||
4290 | override the configuration file values. | ||
4291 | .It Ar default_bits | ||
4292 | This specifies the default key size in bits. | ||
4293 | If not specified, then 512 is used. | ||
4294 | It is used if the | ||
4295 | .Fl new | ||
4296 | option is used. | ||
4297 | It can be overridden by using the | ||
4298 | .Fl newkey | ||
4299 | option. | ||
4300 | .It Ar default_keyfile | ||
4301 | This is the default filename to write a private key to. | ||
4302 | If not specified, the key is written to standard output. | ||
4303 | This can be overridden by the | ||
4304 | .Fl keyout | ||
4305 | option. | ||
4306 | .It Ar oid_file | ||
4307 | This specifies a file containing additional OBJECT IDENTIFIERS. | ||
4308 | Each line of the file should consist of the numerical form of the | ||
4309 | object identifier, followed by whitespace, then the short name followed | ||
4310 | by whitespace and finally the long name. | ||
4311 | .It Ar oid_section | ||
4312 | This specifies a section in the configuration file containing extra | ||
4313 | object identifiers. | ||
4314 | Each line should consist of the short name of the | ||
4315 | object identifier followed by | ||
4316 | .Cm = | ||
4317 | and the numerical form. | ||
4318 | The short and long names are the same when this option is used. | ||
4319 | .It Ar RANDFILE | ||
4320 | This specifies a filename in which random number seed information is | ||
4321 | placed and read from, or an EGD socket (see | ||
4322 | .Xr RAND_egd 3 ) . | ||
4323 | It is used for private key generation. | ||
4324 | .It Ar encrypt_key | ||
4325 | If this is set to | ||
4326 | .Em no | ||
4327 | then if a private key is generated it is | ||
4328 | .Em not | ||
4329 | encrypted. | ||
4330 | This is equivalent to the | ||
4331 | .Fl nodes | ||
4332 | command line option. | ||
4333 | For compatibility, | ||
4334 | .Ar encrypt_rsa_key | ||
4335 | is an equivalent option. | ||
4336 | .It Ar default_md | ||
4337 | This option specifies the digest algorithm to use. | ||
4338 | Possible values include | ||
4339 | .Ar md5, sha1 | ||
4340 | and | ||
4341 | .Ar mdc2 . | ||
4342 | If not present then MD5 is used. | ||
4343 | This option can be overridden on the command line. | ||
4344 | .It Ar string_mask | ||
4345 | This option masks out the use of certain string types in certain | ||
4346 | fields. | ||
4347 | Most users will not need to change this option. | ||
4348 | .Pp | ||
4349 | It can be set to several values: | ||
4350 | .Ar default , | ||
4351 | which is also the default option, uses | ||
4352 | .Em PrintableStrings , T61Strings | ||
4353 | and | ||
4354 | .Em BMPStrings ; | ||
4355 | if the | ||
4356 | .Ar pkix | ||
4357 | value is used then only | ||
4358 | .Em PrintableStrings | ||
4359 | and | ||
4360 | .Em BMPStrings | ||
4361 | will be used. | ||
4362 | This follows the PKIX recommendation in RFC2459. | ||
4363 | If the | ||
4364 | .Fl utf8only | ||
4365 | option is used then only | ||
4366 | .Em UTF8Strings | ||
4367 | will be used: this is the PKIX recommendation in RFC2459 after 2003. | ||
4368 | Finally, the | ||
4369 | .Ar nombstr | ||
4370 | option just uses | ||
4371 | .Em PrintableStrings | ||
4372 | and | ||
4373 | .Em T61Strings : | ||
4374 | certain software has problems with | ||
4375 | .Em BMPStrings | ||
4376 | and | ||
4377 | .Em UTF8Strings : | ||
4378 | in particular Netscape. | ||
4379 | .It Ar req_extensions | ||
4380 | This specifies the configuration file section containing a list of | ||
4381 | extensions to add to the certificate request. | ||
4382 | It can be overridden by the | ||
4383 | .Fl reqexts | ||
4384 | command line switch. | ||
4385 | .It Ar x509_extensions | ||
4386 | This specifies the configuration file section containing a list of | ||
4387 | extensions to add to a certificate generated when the | ||
4388 | .Fl x509 | ||
4389 | switch is used. | ||
4390 | It can be overridden by the | ||
4391 | .Fl extensions | ||
4392 | command line switch. | ||
4393 | .It Ar prompt | ||
4394 | If set to the value | ||
4395 | .Em no , | ||
4396 | this disables prompting of certificate fields | ||
4397 | and just takes values from the config file directly. | ||
4398 | It also changes the expected format of the | ||
4399 | .Em distinguished_name | ||
4400 | and | ||
4401 | .Em attributes | ||
4402 | sections. | ||
4403 | .It Ar utf8 | ||
4404 | If set to the value | ||
4405 | .Em yes , | ||
4406 | then field values are interpreted as UTF8 strings; | ||
4407 | by default they are interpreted as ASCII. | ||
4408 | This means that the field values, whether prompted from a terminal or | ||
4409 | obtained from a configuration file, must be valid UTF8 strings. | ||
4410 | .It Ar attributes | ||
4411 | This specifies the section containing any request attributes: its format | ||
4412 | is the same as | ||
4413 | .Ar distinguished_name . | ||
4414 | Typically these may contain the | ||
4415 | .Em challengePassword | ||
4416 | or | ||
4417 | .Em unstructuredName | ||
4418 | types. | ||
4419 | They are currently ignored by | ||
4420 | .Nm OpenSSL Ns Li 's | ||
4421 | request signing utilities, but some CAs might want them. | ||
4422 | .It Ar distinguished_name | ||
4423 | This specifies the section containing the distinguished name fields to | ||
4424 | prompt for when generating a certificate or certificate request. | ||
4425 | The format is described in the next section. | ||
4426 | .Ed | ||
4427 | .Sh REQ DISTINGUISHED NAME AND ATTRIBUTE SECTION FORMAT | ||
4428 | There are two separate formats for the distinguished name and attribute | ||
4429 | sections. | ||
4430 | If the | ||
4431 | .Fl prompt | ||
4432 | option is set to | ||
4433 | .Em no | ||
4434 | then these sections just consist of field names and values: for example, | ||
4435 | .Pp | ||
4436 | .Bd -literal | ||
4437 | \& CN=My Name | ||
4438 | \& OU=My Organization | ||
4439 | \& emailAddress=someone@somewhere.org | ||
4440 | .Ed | ||
4441 | .Pp | ||
4442 | This allows external programs (e.g. GUI based) to generate a template file | ||
4443 | with all the field names and values and just pass it to | ||
4444 | .Nm req . | ||
4445 | An example of this kind of configuration file is contained in the | ||
4446 | .Sx REQ EXAMPLES | ||
4447 | section. | ||
4448 | .Pp | ||
4449 | Alternatively if the | ||
4450 | .Fl prompt | ||
4451 | option is absent or not set to | ||
4452 | .Em no , | ||
4453 | then the file contains field prompting information. | ||
4454 | It consists of lines of the form: | ||
4455 | .Pp | ||
4456 | .Bd -literal | ||
4457 | \& fieldName="prompt" | ||
4458 | \& fieldName_default="default field value" | ||
4459 | \& fieldName_min= 2 | ||
4460 | \& fieldName_max= 4 | ||
4461 | .Ed | ||
4462 | .Pp | ||
4463 | "fieldName" is the field name being used, for example | ||
4464 | .Em commonName | ||
4465 | (or CN). | ||
4466 | The "prompt" string is used to ask the user to enter the relevant details. | ||
4467 | If the user enters nothing, then the default value is used; | ||
4468 | if no default value is present then the field is omitted. | ||
4469 | A field can still be omitted if a default value is present, | ||
4470 | if the user just enters the '.' character. | ||
4471 | .Pp | ||
4472 | The number of characters entered must be between the | ||
4473 | .Em fieldName_min | ||
4474 | and | ||
4475 | .Em fieldName_max | ||
4476 | limits: | ||
4477 | there may be additional restrictions based on the field being used | ||
4478 | (for example | ||
4479 | .Em countryName | ||
4480 | can only ever be two characters long and must fit in a | ||
4481 | .Em PrintableString ) . | ||
4482 | .Pp | ||
4483 | Some fields (such as | ||
4484 | .Em organizationName ) | ||
4485 | can be used more than once in a DN. | ||
4486 | This presents a problem because configuration files will | ||
4487 | not recognize the same name occurring twice. | ||
4488 | To avoid this problem if the | ||
4489 | .Em fieldName | ||
4490 | contains some characters followed by a full stop they will be ignored. | ||
4491 | So, for example, a second | ||
4492 | .Em organizationName | ||
4493 | can be input by calling it "1.organizationName". | ||
4494 | .Pp | ||
4495 | The actual permitted field names are any object identifier short or | ||
4496 | long names. | ||
4497 | These are compiled into | ||
4498 | .Nm OpenSSL | ||
4499 | and include the usual values such as | ||
4500 | .Em commonName , countryName , localityName , organizationName , | ||
4501 | .Em organizationUnitName , stateOrPrivinceName . | ||
4502 | Additionally | ||
4503 | .Em emailAddress | ||
4504 | is included as well as | ||
4505 | .Em name , surname , givenName initials | ||
4506 | and | ||
4507 | .Em dnQualifier . | ||
4508 | .Pp | ||
4509 | Additional object identifiers can be defined with the | ||
4510 | .Ar oid_file | ||
4511 | or | ||
4512 | .Ar oid_section | ||
4513 | options in the configuration file. | ||
4514 | Any additional fields will be treated as though they were a | ||
4515 | .Em DirectoryString . | ||
4516 | .Sh REQ EXAMPLES | ||
4517 | Examine and verify certificate request: | ||
4518 | .Pp | ||
4519 | \& $ openssl req -in req.pem -text -verify -noout | ||
4520 | .Pp | ||
4521 | Create a private key and then generate a certificate request from it: | ||
4522 | .Pp | ||
4523 | .Bd -literal | ||
4524 | \& $ openssl genrsa -out key.pem 1024 | ||
4525 | \& $ openssl req -new -key key.pem -out req.pem | ||
4526 | .Ed | ||
4527 | .Pp | ||
4528 | The same but just using req: | ||
4529 | .Pp | ||
4530 | \& $ openssl req -newkey rsa:1024 -keyout key.pem -out req.pem | ||
4531 | .Pp | ||
4532 | Generate a self-signed root certificate: | ||
4533 | .Pp | ||
4534 | \& $ openssl req -x509 -newkey rsa:1024 -keyout key.pem -out req.pem | ||
4535 | .br | ||
4536 | .Pp | ||
4537 | Example of a file pointed to by the | ||
4538 | .Ar oid_file | ||
4539 | option: | ||
4540 | .Pp | ||
4541 | .Bd -literal | ||
4542 | \& 1.2.3.4 shortName A longer Name | ||
4543 | \& 1.2.3.6 otherName Other longer Name | ||
4544 | .Ed | ||
4545 | .Pp | ||
4546 | Example of a section pointed to by | ||
4547 | .Ar oid_section | ||
4548 | making use of variable expansion: | ||
4549 | .Pp | ||
4550 | .Bd -literal | ||
4551 | \& testoid1=1.2.3.5 | ||
4552 | \& testoid2=${testoid1}.6 | ||
4553 | .Ed | ||
4554 | .Pp | ||
4555 | Sample configuration file prompting for field values: | ||
4556 | .Pp | ||
4557 | .Bd -literal | ||
4558 | \& [ req ] | ||
4559 | \& default_bits = 1024 | ||
4560 | \& default_keyfile = privkey.pem | ||
4561 | \& distinguished_name = req_distinguished_name | ||
4562 | \& attributes = req_attributes | ||
4563 | \& x509_extensions = v3_ca | ||
4564 | .Pp | ||
4565 | \& dirstring_type = nobmp | ||
4566 | .Pp | ||
4567 | \& [ req_distinguished_name ] | ||
4568 | \& countryName = Country Name (2 letter code) | ||
4569 | \& countryName_default = AU | ||
4570 | \& countryName_min = 2 | ||
4571 | \& countryName_max = 2 | ||
4572 | .Pp | ||
4573 | \& localityName = Locality Name (eg, city) | ||
4574 | .Pp | ||
4575 | \& organizationalUnitName = Organizational Unit Name (eg, section) | ||
4576 | .Pp | ||
4577 | \& commonName = Common Name (eg, YOUR name) | ||
4578 | \& commonName_max = 64 | ||
4579 | .Pp | ||
4580 | \& emailAddress = Email Address | ||
4581 | \& emailAddress_max = 40 | ||
4582 | .Pp | ||
4583 | \& [ req_attributes ] | ||
4584 | \& challengePassword = A challenge password | ||
4585 | \& challengePassword_min = 4 | ||
4586 | \& challengePassword_max = 20 | ||
4587 | .Pp | ||
4588 | \& [ v3_ca ] | ||
4589 | .Pp | ||
4590 | \& subjectKeyIdentifier=hash | ||
4591 | \& authorityKeyIdentifier=keyid:always,issuer:always | ||
4592 | \& basicConstraints = CA:true | ||
4593 | .Ed | ||
4594 | .Pp | ||
4595 | Sample configuration containing all field values: | ||
4596 | .Pp | ||
4597 | .Bd -literal | ||
4598 | \& RANDFILE = $ENV::HOME/.rnd | ||
4599 | .Pp | ||
4600 | \& [ req ] | ||
4601 | \& default_bits = 1024 | ||
4602 | \& default_keyfile = keyfile.pem | ||
4603 | \& distinguished_name = req_distinguished_name | ||
4604 | \& attributes = req_attributes | ||
4605 | \& prompt = no | ||
4606 | \& output_password = mypass | ||
4607 | .Pp | ||
4608 | \& [ req_distinguished_name ] | ||
4609 | \& C = GB | ||
4610 | \& ST = Test State or Province | ||
4611 | \& L = Test Locality | ||
4612 | \& O = Organization Name | ||
4613 | \& OU = Organizational Unit Name | ||
4614 | \& CN = Common Name | ||
4615 | \& emailAddress = test@email.address | ||
4616 | .Pp | ||
4617 | \& [ req_attributes ] | ||
4618 | \& challengePassword = A challenge password | ||
4619 | .Ed | ||
4620 | .Sh REQ NOTES | ||
4621 | The header and footer lines in the | ||
4622 | .Ar PEM | ||
4623 | format are normally: | ||
4624 | .Pp | ||
4625 | .Bd -literal | ||
4626 | \& -----BEGIN CERTIFICATE REQUEST---- | ||
4627 | \& -----END CERTIFICATE REQUEST---- | ||
4628 | .Ed | ||
4629 | .Pp | ||
4630 | Some software (some versions of Netscape certificate server) instead needs: | ||
4631 | .Pp | ||
4632 | .Bd -literal | ||
4633 | \& -----BEGIN NEW CERTIFICATE REQUEST---- | ||
4634 | \& -----END NEW CERTIFICATE REQUEST---- | ||
4635 | .Ed | ||
4636 | .Pp | ||
4637 | which is produced with the | ||
4638 | .Fl newhdr | ||
4639 | option but is otherwise compatible. | ||
4640 | Either form is accepted transparently on input. | ||
4641 | .Pp | ||
4642 | The certificate requests generated by Xenroll with MSIE have extensions added. | ||
4643 | It includes the | ||
4644 | .Em keyUsage | ||
4645 | extension which determines the type of | ||
4646 | key (signature only or general purpose) and any additional OIDs entered | ||
4647 | by the script in an | ||
4648 | .Em extendedKeyUsage | ||
4649 | extension. | ||
4650 | .Sh REQ DIAGNOSTICS | ||
4651 | The following messages are frequently asked about: | ||
4652 | .Pp | ||
4653 | .Bd -literal | ||
4654 | \& Using configuration from /some/path/openssl.cnf | ||
4655 | \& Unable to load config info | ||
4656 | .Ed | ||
4657 | .Pp | ||
4658 | This is followed some time later by... | ||
4659 | .Pp | ||
4660 | .Bd -literal | ||
4661 | \& unable to find 'distinguished_name' in config | ||
4662 | \& problems making Certificate Request | ||
4663 | .Ed | ||
4664 | .Pp | ||
4665 | The first error message is the clue: it can't find the configuration | ||
4666 | file! | ||
4667 | Certain operations (like examining a certificate request) don't | ||
4668 | need a configuration file so its use isn't enforced. | ||
4669 | Generation of certificates or requests, however, do need a configuration file. | ||
4670 | This could be regarded as a bug. | ||
4671 | .Pp | ||
4672 | Another puzzling message is this: | ||
4673 | .Pp | ||
4674 | .Bd -literal | ||
4675 | \& Attributes: | ||
4676 | \& a0:00 | ||
4677 | .Ed | ||
4678 | .Pp | ||
4679 | This is displayed when no attributes are present and the request includes | ||
4680 | the correct empty SET OF structure (the DER encoding of which is 0xa0 0x00). | ||
4681 | If you just see: | ||
4682 | .Pp | ||
4683 | \& Attributes: | ||
4684 | .Pp | ||
4685 | then the SET OF is missing and the encoding is technically invalid (but | ||
4686 | it is tolerated). | ||
4687 | See the description of the command line option | ||
4688 | .Fl asn1-kludge | ||
4689 | for more information. | ||
4690 | .Sh REQ ENVIRONMENT VARIABLES | ||
4691 | The variable | ||
4692 | .Em OPENSSL_CONF , | ||
4693 | if defined, allows an alternative configuration | ||
4694 | file location to be specified; it will be overridden by the | ||
4695 | .Fl config | ||
4696 | command line switch if it is present. | ||
4697 | For compatibility reasons the | ||
4698 | .Em SSLEAY_CONF | ||
4699 | environment variable serves the same purpose but its use is discouraged. | ||
4700 | .Sh REQ BUGS | ||
4701 | .Nm OpenSSL Ns Li 's | ||
4702 | handling of T61Strings (aka TeletexStrings) is broken: it effectively | ||
4703 | treats them as ISO-8859-1 (Latin 1); | ||
4704 | Netscape and MSIE have similar behaviour. | ||
4705 | This can cause problems if you need characters that aren't available in | ||
4706 | .Em PrintableStrings | ||
4707 | and you don't want to or can't use | ||
4708 | .Em BMPStrings . | ||
4709 | .Pp | ||
4710 | As a consequence of the T61String handling the only correct way to represent | ||
4711 | accented characters in | ||
4712 | .Nm OpenSSL | ||
4713 | is to use a | ||
4714 | .Em BMPString : | ||
4715 | unfortunately Netscape currently chokes on these. | ||
4716 | If you have to use accented characters with Netscape | ||
4717 | and MSIE then you currently need to use the invalid T61String form. | ||
4718 | .Pp | ||
4719 | The current prompting is not very friendly. | ||
4720 | It doesn't allow you to confirm what you've just entered. | ||
4721 | Other things like extensions in certificate requests are | ||
4722 | statically defined in the configuration file. | ||
4723 | Some of these, like an email address in | ||
4724 | .Em subjectAltName | ||
4725 | should be input by the user. | ||
4726 | .\" | ||
4727 | .\" RSA | ||
4728 | .\" | ||
4729 | .Sh RSA | ||
4730 | .Cm openssl rsa | ||
4731 | .Op Fl inform Ar PEM|NET|DER | ||
4732 | .Op Fl outform Ar PEM|NET|DER | ||
4733 | .Op Fl in Ar filename | ||
4734 | .Op Fl passin Ar arg | ||
4735 | .Op Fl out Ar filename | ||
4736 | .Op Fl passout Ar arg | ||
4737 | .Op Fl sgckey | ||
4738 | .Op Fl des | ||
4739 | .Op Fl des3 | ||
4740 | .Op Fl idea | ||
4741 | .Op Fl text | ||
4742 | .Op Fl noout | ||
4743 | .Op Fl modulus | ||
4744 | .Op Fl check | ||
4745 | .Op Fl pubin | ||
4746 | .Op Fl pubout | ||
4747 | .Pp | ||
4748 | The | ||
4749 | .Nm rsa | ||
4750 | command processes RSA keys. | ||
4751 | They can be converted between various forms and their components printed out. | ||
4752 | .Pp | ||
4753 | .Sy Note : | ||
4754 | this command uses the traditional | ||
4755 | .Nm SSLeay | ||
4756 | compatible format for private key encryption: | ||
4757 | newer applications should use the more secure PKCS#8 format using the | ||
4758 | .Nm pkcs8 | ||
4759 | utility. | ||
4760 | .Pp | ||
4761 | The options are as follows: | ||
4762 | .Bd -ragged -offset indent | ||
4763 | .It Fl inform Ar DER|NET|PEM | ||
4764 | This specifies the input format. | ||
4765 | The | ||
4766 | .Ar DER | ||
4767 | argument | ||
4768 | uses an ASN1 DER encoded form compatible with the PKCS#1 | ||
4769 | RSAPrivateKey or SubjectPublicKeyInfo format. | ||
4770 | The | ||
4771 | .Ar PEM | ||
4772 | form is the default format: it consists of the DER format base64 | ||
4773 | encoded with additional header and footer lines. | ||
4774 | On input PKCS#8 format private keys are also accepted. | ||
4775 | The | ||
4776 | .Ar NET | ||
4777 | form is a format described in the | ||
4778 | .Sx RSA NOTES | ||
4779 | section. | ||
4780 | .It Fl outform Ar DER|NET|PEM | ||
4781 | This specifies the output format, the options have the same meaning as the | ||
4782 | .Fl inform | ||
4783 | option. | ||
4784 | .It Fl in Ar filename | ||
4785 | This specifies the input | ||
4786 | .Ar filename | ||
4787 | to read a key from or standard input if this | ||
4788 | option is not specified. | ||
4789 | If the key is encrypted, a pass phrase will be prompted for. | ||
4790 | .It Fl passin Ar arg | ||
4791 | The input file password source. | ||
4792 | For more information about the format of | ||
4793 | .Ar arg | ||
4794 | see the | ||
4795 | .Sx PASS PHRASE ARGUMENTS | ||
4796 | section above. | ||
4797 | .It Fl out Ar filename | ||
4798 | This specifies the output | ||
4799 | .Ar filename | ||
4800 | to write a key to, or standard output if this option is not specified. | ||
4801 | If any encryption options are set then a pass phrase will be prompted for. | ||
4802 | The output filename should | ||
4803 | .Em not | ||
4804 | be the same as the input filename. | ||
4805 | .It Fl passout Ar password | ||
4806 | The output file password source. | ||
4807 | For more information about the format of | ||
4808 | .Ar arg | ||
4809 | see the | ||
4810 | .Sx PASS PHRASE ARGUMENTS | ||
4811 | section above. | ||
4812 | .It Fl sgckey | ||
4813 | Use the modified | ||
4814 | .Em NET | ||
4815 | algorithm used with some versions of Microsoft IIS and SGC keys. | ||
4816 | .It Cm -des|-des3|-idea | ||
4817 | These options encrypt the private key with the DES, triple DES, or the | ||
4818 | IDEA ciphers, respectively, before outputting it. | ||
4819 | A pass phrase is prompted for. | ||
4820 | If none of these options is specified the key is written in plain text. | ||
4821 | This means that using the | ||
4822 | .Nm rsa | ||
4823 | utility to read in an encrypted key with no encryption option can be used | ||
4824 | to remove the pass phrase from a key, or by setting the encryption options | ||
4825 | it can be used to add or change the pass phrase. | ||
4826 | These options can only be used with | ||
4827 | .Ar PEM | ||
4828 | format output files. | ||
4829 | .It Fl text | ||
4830 | Prints out the various public or private key components in | ||
4831 | plain text, in addition to the encoded version. | ||
4832 | .It Fl noout | ||
4833 | This option prevents output of the encoded version of the key. | ||
4834 | .It Fl modulus | ||
4835 | This option prints out the value of the modulus of the key. | ||
4836 | .It Fl check | ||
4837 | This option checks the consistency of an RSA private key. | ||
4838 | .It Fl pubin | ||
4839 | By default a private key is read from the input file: with this | ||
4840 | option a public key is read instead. | ||
4841 | .It Fl pubout | ||
4842 | By default a private key is output: | ||
4843 | with this option a public key will be output instead. | ||
4844 | This option is automatically set if the input is a public key. | ||
4845 | .Ed | ||
4846 | .Sh RSA NOTES | ||
4847 | The | ||
4848 | .Em PEM | ||
4849 | private key format uses the header and footer lines: | ||
4850 | .Pp | ||
4851 | .Bd -literal | ||
4852 | \& -----BEGIN RSA PRIVATE KEY----- | ||
4853 | \& -----END RSA PRIVATE KEY----- | ||
4854 | .Ed | ||
4855 | .Pp | ||
4856 | The | ||
4857 | .Em PEM | ||
4858 | public key format uses the header and footer lines: | ||
4859 | .Pp | ||
4860 | .Bd -literal | ||
4861 | \& -----BEGIN PUBLIC KEY----- | ||
4862 | \& -----END PUBLIC KEY----- | ||
4863 | .Ed | ||
4864 | .Pp | ||
4865 | The | ||
4866 | .Em NET | ||
4867 | form is a format compatible with older Netscape servers | ||
4868 | and Microsoft IIS .key files; this uses unsalted RC4 for its encryption. | ||
4869 | It is not very secure and so should only be used when necessary. | ||
4870 | .Pp | ||
4871 | Some newer version of IIS have additional data in the exported .key files. | ||
4872 | To use these with the | ||
4873 | .Nm rsa | ||
4874 | utility, view the file with a binary editor | ||
4875 | and look for the string "private-key", then trace back to the byte | ||
4876 | sequence 0x30, 0x82 (this is an ASN1 SEQUENCE). | ||
4877 | Copy all the data from this point onwards to another file and use that as | ||
4878 | the input to the | ||
4879 | .Nm rsa | ||
4880 | utility with the | ||
4881 | .Fl inform Ar NET | ||
4882 | option. | ||
4883 | If there is an error after entering the password, try the | ||
4884 | .Fl sgckey | ||
4885 | option. | ||
4886 | .Sh RSA EXAMPLES | ||
4887 | To remove the pass phrase on an RSA private key: | ||
4888 | .Pp | ||
4889 | \& $ openssl rsa -in key.pem -out keyout.pem | ||
4890 | .Pp | ||
4891 | To encrypt a private key using triple DES: | ||
4892 | .Pp | ||
4893 | \& $ openssl rsa -in key.pem -des3 -out keyout.pem | ||
4894 | .Pp | ||
4895 | To convert a private key from | ||
4896 | .Em PEM | ||
4897 | to | ||
4898 | .Em DER | ||
4899 | format: | ||
4900 | .Pp | ||
4901 | \& $ openssl rsa -in key.pem -outform DER -out keyout.der | ||
4902 | .br | ||
4903 | .Pp | ||
4904 | To print out the components of a private key to standard output: | ||
4905 | .Pp | ||
4906 | \& $ openssl rsa -in key.pem -text -noout | ||
4907 | .Pp | ||
4908 | To just output the public part of a private key: | ||
4909 | .Pp | ||
4910 | \& $ openssl rsa -in key.pem -pubout -out pubkey.pem | ||
4911 | .Sh RSA BUGS | ||
4912 | The command line password arguments don't currently work with | ||
4913 | .Em NET | ||
4914 | format. | ||
4915 | .Pp | ||
4916 | There should be an option that automatically handles .key files, | ||
4917 | without having to manually edit them. | ||
4918 | .\" | ||
4919 | .\" RSAUTL | ||
4920 | .\" | ||
4921 | .Sh RSAUTL | ||
4922 | .Nm openssl rsautl | ||
4923 | .Op Fl in Ar file | ||
4924 | .Op Fl out Ar file | ||
4925 | .Op Fl inkey Ar file | ||
4926 | .Op Fl pubin | ||
4927 | .Op Fl certin | ||
4928 | .Op Fl sign | ||
4929 | .Op Fl verify | ||
4930 | .Op Fl encrypt | ||
4931 | .Op Fl decrypt | ||
4932 | .Op Fl pkcs | ||
4933 | .Op Fl ssl | ||
4934 | .Op Fl raw | ||
4935 | .Op Fl hexdump | ||
4936 | .Op Fl asn1parse | ||
4937 | .Pp | ||
4938 | The | ||
4939 | .Nm rsautl | ||
4940 | command can be used to sign, verify, encrypt and decrypt | ||
4941 | data using the RSA algorithm. | ||
4942 | .Pp | ||
4943 | The options are as follows: | ||
4944 | .Bd -ragged -offset indent | ||
4945 | .It Fl in Ar filename | ||
4946 | This specifies the input | ||
4947 | .Ar filename | ||
4948 | to read data from or standard input | ||
4949 | if this option is not specified. | ||
4950 | .It Fl out Ar filename | ||
4951 | Specifies the output | ||
4952 | .Ar filename | ||
4953 | to write to or standard output by | ||
4954 | default. | ||
4955 | .It Fl inkey Ar file | ||
4956 | The input key file, by default it should be an RSA private key. | ||
4957 | .It Fl pubin | ||
4958 | The input file is an RSA public key. | ||
4959 | .It Fl certin | ||
4960 | The input is a certificate containing an RSA public key. | ||
4961 | .It Fl sign | ||
4962 | Sign the input data and output the signed result. | ||
4963 | This requires an RSA private key. | ||
4964 | .It Fl verify | ||
4965 | Verify the input data and output the recovered data. | ||
4966 | .It Fl encrypt | ||
4967 | Encrypt the input data using an RSA public key. | ||
4968 | .It Fl decrypt | ||
4969 | Decrypt the input data using an RSA private key. | ||
4970 | .It Fl pkcs , oaep , ssl , raw | ||
4971 | The padding to use: PKCS#1 v1.5 (the default), PKCS#1 OAEP, | ||
4972 | special padding used in SSL v2 backwards compatible handshakes, | ||
4973 | or no padding, respectively. | ||
4974 | For signatures, only | ||
4975 | .Fl pkcs | ||
4976 | and | ||
4977 | .Fl raw | ||
4978 | can be used. | ||
4979 | .It Fl hexdump | ||
4980 | Hex dump the output data. | ||
4981 | .It Fl asn1parse | ||
4982 | Asn1parse the output data, this is useful when combined with the | ||
4983 | .Fl verify | ||
4984 | option. | ||
4985 | .El | ||
4986 | .Sh RSAUTL NOTES | ||
4987 | .Nm rsautl , | ||
4988 | because it uses the RSA algorithm directly, can only be | ||
4989 | used to sign or verify small pieces of data. | ||
4990 | .Sh RSAUTL EXAMPLES | ||
4991 | Sign some data using a private key: | ||
4992 | .Pp | ||
4993 | \& $ openssl rsautl -sign -in file -inkey key.pem -out sig | ||
4994 | .Pp | ||
4995 | Recover the signed data: | ||
4996 | .Pp | ||
4997 | \& $ openssl rsautl -verify -in sig -inkey key.pem | ||
4998 | .Pp | ||
4999 | Examine the raw signed data: | ||
5000 | .Pp | ||
5001 | \& $ openssl rsautl -verify -in file -inkey key.pem -raw -hexdump | ||
5002 | .Pp | ||
5003 | .Bd -literal | ||
5004 | \& 0000 - 00 01 ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................ | ||
5005 | \& 0010 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................ | ||
5006 | \& 0020 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................ | ||
5007 | \& 0030 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................ | ||
5008 | \& 0040 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................ | ||
5009 | \& 0050 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................ | ||
5010 | \& 0060 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................ | ||
5011 | \& 0070 - ff ff ff ff 00 68 65 6c-6c 6f 20 77 6f 72 6c 64 .....hello world | ||
5012 | .Ed | ||
5013 | .Pp | ||
5014 | The PKCS#1 block formatting is evident from this. If this was done using | ||
5015 | encrypt and decrypt the block would have been of type 2 (the second byte) | ||
5016 | and random padding data visible instead of the 0xff bytes. | ||
5017 | .Pp | ||
5018 | It is possible to analyse the signature of certificates using this | ||
5019 | utility in conjunction with | ||
5020 | .Nm asn1parse . | ||
5021 | Consider the self-signed example in | ||
5022 | .Pa certs/pca-cert.pem : | ||
5023 | Running | ||
5024 | .Nm asn1parse | ||
5025 | as follows yields: | ||
5026 | .Pp | ||
5027 | \& $ openssl asn1parse -in pca-cert.pem | ||
5028 | .Pp | ||
5029 | .Bd -literal | ||
5030 | \& 0:d=0 hl=4 l= 742 cons: SEQUENCE | ||
5031 | \& 4:d=1 hl=4 l= 591 cons: SEQUENCE | ||
5032 | \& 8:d=2 hl=2 l= 3 cons: cont [ 0 ] | ||
5033 | \& 10:d=3 hl=2 l= 1 prim: INTEGER :02 | ||
5034 | \& 13:d=2 hl=2 l= 1 prim: INTEGER :00 | ||
5035 | \& 16:d=2 hl=2 l= 13 cons: SEQUENCE | ||
5036 | \& 18:d=3 hl=2 l= 9 prim: OBJECT :md5WithRSAEncryption | ||
5037 | \& 29:d=3 hl=2 l= 0 prim: NULL | ||
5038 | \& 31:d=2 hl=2 l= 92 cons: SEQUENCE | ||
5039 | \& 33:d=3 hl=2 l= 11 cons: SET | ||
5040 | \& 35:d=4 hl=2 l= 9 cons: SEQUENCE | ||
5041 | \& 37:d=5 hl=2 l= 3 prim: OBJECT :countryName | ||
5042 | \& 42:d=5 hl=2 l= 2 prim: PRINTABLESTRING :AU | ||
5043 | \& .... | ||
5044 | \& 599:d=1 hl=2 l= 13 cons: SEQUENCE | ||
5045 | \& 601:d=2 hl=2 l= 9 prim: OBJECT :md5WithRSAEncryption | ||
5046 | \& 612:d=2 hl=2 l= 0 prim: NULL | ||
5047 | \& 614:d=1 hl=3 l= 129 prim: BIT STRING | ||
5048 | .Ed | ||
5049 | .Pp | ||
5050 | The final BIT STRING contains the actual signature. | ||
5051 | It can be extracted with: | ||
5052 | .Pp | ||
5053 | \& $ openssl asn1parse -in pca-cert.pem -out sig -noout -strparse 614 | ||
5054 | .Pp | ||
5055 | The certificate public key can be extracted with: | ||
5056 | .Pp | ||
5057 | \& $ openssl x509 -in test/testx509.pem -pubout -noout >pubkey.pem | ||
5058 | .Pp | ||
5059 | The signature can be analysed with: | ||
5060 | .Pp | ||
5061 | \& $ openssl rsautl -in sig -verify -asn1parse -inkey pubkey.pem -pubin | ||
5062 | .Pp | ||
5063 | .Bd -literal | ||
5064 | \& 0:d=0 hl=2 l= 32 cons: SEQUENCE | ||
5065 | \& 2:d=1 hl=2 l= 12 cons: SEQUENCE | ||
5066 | \& 4:d=2 hl=2 l= 8 prim: OBJECT :md5 | ||
5067 | \& 14:d=2 hl=2 l= 0 prim: NULL | ||
5068 | \& 16:d=1 hl=2 l= 16 prim: OCTET STRING | ||
5069 | \& 0000 - f3 46 9e aa 1a 4a 73 c9-37 ea 93 00 48 25 08 b5 .F...Js.7...H%.. | ||
5070 | .Ed | ||
5071 | .Pp | ||
5072 | This is the parsed version of an ASN1 | ||
5073 | .Em DigestInfo | ||
5074 | structure. | ||
5075 | It can be seen that the digest used was md5. | ||
5076 | The actual part of the certificate that was signed can be extracted with: | ||
5077 | .Pp | ||
5078 | \& $ openssl asn1parse -in pca-cert.pem -out tbs -noout -strparse 4 | ||
5079 | .Pp | ||
5080 | and its digest computed with: | ||
5081 | .Pp | ||
5082 | .Bd -literal | ||
5083 | \& $ openssl md5 -c tbs | ||
5084 | \& MD5(tbs)= f3:46:9e:aa:1a:4a:73:c9:37:ea:93:00:48:25:08:b5 | ||
5085 | .Ed | ||
5086 | .Pp | ||
5087 | which it can be seen agrees with the recovered value above. | ||
5088 | .\" | ||
5089 | .\" S_CLIENT | ||
5090 | .\" | ||
5091 | .Sh S_CLIENT | ||
5092 | .Nm openssl s_client | ||
5093 | .Op Fl connect Ar host:port> | ||
5094 | .Op Fl verify Ar depth | ||
5095 | .Op Fl cert Ar filename | ||
5096 | .Op Fl key Ar filename | ||
5097 | .Op Fl CApath Ar directory | ||
5098 | .Op Fl CAfile Ar filename | ||
5099 | .Op Fl reconnect | ||
5100 | .Op Fl pause | ||
5101 | .Op Fl showcerts | ||
5102 | .Op Fl debug | ||
5103 | .Op Fl msg | ||
5104 | .Op Fl nbio_test | ||
5105 | .Op Fl state | ||
5106 | .Op Fl nbio | ||
5107 | .Op Fl crlf | ||
5108 | .Op Fl ign_eof | ||
5109 | .Op Fl quiet | ||
5110 | .Op Fl ssl2 | ||
5111 | .Op Fl ssl3 | ||
5112 | .Op Fl tls1 | ||
5113 | .Op Fl no_ssl2 | ||
5114 | .Op Fl no_ssl3 | ||
5115 | .Op Fl no_tls1 | ||
5116 | .Op Fl bugs | ||
5117 | .Op Fl cipher Ar cipherlist | ||
5118 | .Op Fl engine Ar id | ||
5119 | .Op Fl rand Ar file ... | ||
5120 | .Pp | ||
5121 | The | ||
5122 | .Nm s_client | ||
5123 | command implements a generic SSL/TLS client which connects | ||
5124 | to a remote host using SSL/TLS. | ||
5125 | It is a | ||
5126 | .Em very | ||
5127 | useful diagnostic tool for SSL servers. | ||
5128 | .Pp | ||
5129 | The options are as follows: | ||
5130 | .Bd -ragged -offset indent | ||
5131 | .It Fl connect Ar host:port | ||
5132 | This specifies the | ||
5133 | .Ar host | ||
5134 | and optional | ||
5135 | .Ar port | ||
5136 | to connect to. | ||
5137 | If not specified then an attempt is made to connect to the local host | ||
5138 | on port 4433. | ||
5139 | .It Fl cert Ar certname | ||
5140 | The certificate to use, if one is requested by the server. | ||
5141 | The default is not to use a certificate. | ||
5142 | .It Fl key Ar keyfile | ||
5143 | The private key to use. | ||
5144 | If not specified then the certificate file will be used. | ||
5145 | .It Fl verify Ar depth | ||
5146 | The verify | ||
5147 | .Ar depth | ||
5148 | to use. | ||
5149 | This specifies the maximum length of the | ||
5150 | server certificate chain and turns on server certificate verification. | ||
5151 | Currently the verify operation continues after errors so all the problems | ||
5152 | with a certificate chain can be seen. | ||
5153 | As a side effect the connection will never fail due to a server | ||
5154 | certificate verify failure. | ||
5155 | .It Fl CApath Ar directory | ||
5156 | The | ||
5157 | .Ar directory | ||
5158 | to use for server certificate verification. | ||
5159 | This directory must be in "hash format", see | ||
5160 | .Fl verify | ||
5161 | for more information. | ||
5162 | These are also used when building the client certificate chain. | ||
5163 | .It Fl CAfile Ar file | ||
5164 | A | ||
5165 | .Ar file | ||
5166 | containing trusted certificates to use during server authentication | ||
5167 | and to use when attempting to build the client certificate chain. | ||
5168 | .It Fl reconnect | ||
5169 | Reconnects to the same server 5 times using the same session ID; this can | ||
5170 | be used as a test that session caching is working. | ||
5171 | .It Fl pause | ||
5172 | Pauses 1 second between each read and write call. | ||
5173 | .It Fl showcerts | ||
5174 | Display the whole server certificate chain: normally only the server | ||
5175 | certificate itself is displayed. | ||
5176 | .It Fl prexit | ||
5177 | Print session information when the program exits. | ||
5178 | This will always attempt | ||
5179 | to print out information even if the connection fails. | ||
5180 | Normally information will only be printed out once if the connection succeeds. | ||
5181 | This option is useful because the cipher in use may be renegotiated | ||
5182 | or the connection may fail because a client certificate is required or is | ||
5183 | requested only after an attempt is made to access a certain URL. | ||
5184 | .Sy Note : | ||
5185 | the output produced by this option is not always accurate because a | ||
5186 | connection might never have been established. | ||
5187 | .It Fl state | ||
5188 | Prints out the SSL session states. | ||
5189 | .It Fl debug | ||
5190 | Print extensive debugging information including a hex dump of all traffic. | ||
5191 | .It Fl msg | ||
5192 | Show all protocol messages with hex dump. | ||
5193 | .It Fl nbio_test | ||
5194 | Tests non-blocking I/O. | ||
5195 | .It Fl nbio | ||
5196 | Turns on non-blocking I/O. | ||
5197 | .It Fl crlf | ||
5198 | This option translates a line feed from the terminal into CR+LF as required | ||
5199 | by some servers. | ||
5200 | .It Fl ign_eof | ||
5201 | Inhibit shutting down the connection when end of file is reached in the | ||
5202 | input. | ||
5203 | .It Fl quiet | ||
5204 | Inhibit printing of session and certificate information. | ||
5205 | This implicitly turns on | ||
5206 | .Fl ign_eof | ||
5207 | as well. | ||
5208 | .It Fl ssl2 , ssl3 , tls1 , no_ssl2 , | ||
5209 | .It Fl no_ssl3 , no_tls1 | ||
5210 | These options disable the use of certain SSL or TLS protocols. | ||
5211 | By default the initial handshake uses a method which should be compatible | ||
5212 | with all servers and permit them to use SSL v3, SSL v2 or TLS as appropriate. | ||
5213 | .Pp | ||
5214 | Unfortunately there are a lot of ancient and broken servers in use which | ||
5215 | cannot handle this technique and will fail to connect. | ||
5216 | Some servers only work if TLS is turned off with the | ||
5217 | .Fl no_tls | ||
5218 | option, others will only support SSL v2 and may need the | ||
5219 | .Fl ssl2 | ||
5220 | option. | ||
5221 | .It Fl bugs | ||
5222 | There are several known bugs in SSL and TLS implementations. | ||
5223 | Adding this option enables various workarounds. | ||
5224 | .It Fl cipher Ar cipherlist | ||
5225 | This allows the cipher list sent by the client to be modified. | ||
5226 | Although the server determines which cipher suite is used it should take | ||
5227 | the first supported cipher in the list sent by the client. | ||
5228 | See the | ||
5229 | .Sx CIPHERS | ||
5230 | section above for more information. | ||
5231 | .It Fl engine Ar id | ||
5232 | Specifying an engine (by it's unique | ||
5233 | .Ar id | ||
5234 | string) will cause | ||
5235 | .Nm s_client | ||
5236 | to attempt to obtain a functional reference to the specified engine, | ||
5237 | thus initialising it if needed. | ||
5238 | The engine will then be set as the default for all available algorithms. | ||
5239 | .It Fl rand Ar file ... | ||
5240 | A | ||
5241 | .Ar file | ||
5242 | or | ||
5243 | .Ar file Ns Li s | ||
5244 | containing random data used to seed the random number generator, | ||
5245 | or an EGD socket (see | ||
5246 | .Xr RAND_egd 3 ) . | ||
5247 | Multiple files can be specified separated by an OS-dependent character. | ||
5248 | The separator is | ||
5249 | .Cm \&; | ||
5250 | for MS-Windows, | ||
5251 | .Cm \&, | ||
5252 | for OpenVMS, and | ||
5253 | .Cm \&: | ||
5254 | for | ||
5255 | all others. | ||
5256 | .Ed | ||
5257 | .Sh S_CLIENT CONNECTED COMMANDS | ||
5258 | If a connection is established with an SSL server then any data received | ||
5259 | from the server is displayed and any key presses will be sent to the | ||
5260 | server. | ||
5261 | When used interactively (which means neither | ||
5262 | .Fl quiet | ||
5263 | nor | ||
5264 | .Fl ign_eof | ||
5265 | have been given), the session will be renegotiated if the line begins with an | ||
5266 | .Em R , | ||
5267 | and if the line begins with a | ||
5268 | .Em Q | ||
5269 | or if end of file is reached, the connection will be closed down. | ||
5270 | .Sh S_CLIENT NOTES | ||
5271 | .Nm s_client | ||
5272 | can be used to debug SSL servers. | ||
5273 | To connect to an SSL HTTP server the command: | ||
5274 | .Pp | ||
5275 | \& $ openssl s_client -connect servername:443 | ||
5276 | .Pp | ||
5277 | would typically be used (https uses port 443). | ||
5278 | If the connection succeeds then an HTTP command can be given such as | ||
5279 | "GET" to retrieve a web page. | ||
5280 | .Pp | ||
5281 | If the handshake fails then there are several possible causes; if it is | ||
5282 | nothing obvious like no client certificate then the | ||
5283 | .Fl bugs , ssl2 , ssl3 , tls1 , | ||
5284 | .Fl no_ssl2 , no_ssl3 | ||
5285 | and | ||
5286 | .Fl no_tls1 | ||
5287 | options can be tried in case it is a buggy server. | ||
5288 | In particular these options should be tried | ||
5289 | .Em before | ||
5290 | submitting a bug report to an | ||
5291 | .Nm OpenSSL | ||
5292 | mailing list. | ||
5293 | .Pp | ||
5294 | A frequent problem when attempting to get client certificates working | ||
5295 | is that a web client complains it has no certificates or gives an empty | ||
5296 | list to choose from. | ||
5297 | This is normally because the server is not sending the clients certificate | ||
5298 | authority in its "acceptable CA list" when it | ||
5299 | requests a certificate. | ||
5300 | By using | ||
5301 | .Nm s_client | ||
5302 | the CA list can be viewed and checked. | ||
5303 | However some servers only request client authentication | ||
5304 | after a specific URL is requested. | ||
5305 | To obtain the list in this case it is necessary to use the | ||
5306 | .Fl prexit | ||
5307 | command and send an HTTP request for an appropriate page. | ||
5308 | .Pp | ||
5309 | If a certificate is specified on the command line using the | ||
5310 | .Fl cert | ||
5311 | option it will not be used unless the server specifically requests | ||
5312 | a client certificate. | ||
5313 | Therefore merely including a client certificate | ||
5314 | on the command line is no guarantee that the certificate works. | ||
5315 | .Pp | ||
5316 | If there are problems verifying a server certificate then the | ||
5317 | .Fl showcerts | ||
5318 | option can be used to show the whole chain. | ||
5319 | .Sh S_CLIENT BUGS | ||
5320 | Because this program has a lot of options and also because some of | ||
5321 | the techniques used are rather old, the C source of | ||
5322 | .Nm s_client | ||
5323 | is rather hard to read and not a model of how things should be done. | ||
5324 | A typical SSL client program would be much simpler. | ||
5325 | .Pp | ||
5326 | The | ||
5327 | .Fl verify | ||
5328 | option should really exit if the server verification fails. | ||
5329 | .Pp | ||
5330 | The | ||
5331 | .Fl prexit | ||
5332 | option is a bit of a hack. | ||
5333 | We should really report information whenever a session is renegotiated. | ||
5334 | .\" | ||
5335 | .\" S_SERVER | ||
5336 | .\" | ||
5337 | .Sh S_SERVER | ||
5338 | .Nm openssl s_server | ||
5339 | .Bk -words | ||
5340 | .Op Fl accept Ar port | ||
5341 | .Op Fl context Ar id | ||
5342 | .Op Fl verify Ar depth | ||
5343 | .Op Fl Verify Ar depth | ||
5344 | .Op Fl cert Ar filename | ||
5345 | .Op Fl key Ar keyfile | ||
5346 | .Op Fl dcert Ar filename | ||
5347 | .Op Fl dkey Ar keyfile | ||
5348 | .Op Fl dhparam Ar filename | ||
5349 | .Op Fl nbio | ||
5350 | .Op Fl nbio_test | ||
5351 | .Op Fl crlf | ||
5352 | .Op Fl debug | ||
5353 | .Op Fl msg | ||
5354 | .Op Fl state | ||
5355 | .Op Fl CApath Ar directory | ||
5356 | .Op Fl CAfile Ar filename | ||
5357 | .Op Fl nocert | ||
5358 | .Op Fl cipher Ar cipherlist | ||
5359 | .Op Fl quiet | ||
5360 | .Op Fl no_tmp_rsa | ||
5361 | .Op Fl ssl2 | ||
5362 | .Op Fl ssl3 | ||
5363 | .Op Fl tls1 | ||
5364 | .Op Fl no_ssl2 | ||
5365 | .Op Fl no_ssl3 | ||
5366 | .Op Fl no_tls1 | ||
5367 | .Op Fl no_dhe | ||
5368 | .Op Fl bugs | ||
5369 | .Op Fl hack | ||
5370 | .Op Fl www | ||
5371 | .Op Fl WWW | ||
5372 | .Op Fl HTTP | ||
5373 | .Op Fl engine Ar id | ||
5374 | .Op Fl rand Ar file ... | ||
5375 | .Ek | ||
5376 | .Pp | ||
5377 | The | ||
5378 | .Nm s_server | ||
5379 | command implements a generic SSL/TLS server which listens | ||
5380 | for connections on a given port using SSL/TLS. | ||
5381 | .Pp | ||
5382 | The options are as follows: | ||
5383 | .Bd -ragged -offset indent | ||
5384 | .It Fl accept Ar port | ||
5385 | The TCP | ||
5386 | .Ar port | ||
5387 | to listen on for connections. | ||
5388 | If not specified, 4433 is used. | ||
5389 | .It Fl context Ar id | ||
5390 | Sets the SSL context id. | ||
5391 | It can be given any string value. | ||
5392 | If this option is not present, a default value will be used. | ||
5393 | .It Fl cert Ar certname | ||
5394 | The certificate to use; most servers cipher suites require the use of a | ||
5395 | certificate and some require a certificate with a certain public key type: | ||
5396 | for example the DSS cipher suites require a certificate containing a DSS | ||
5397 | (DSA) key. | ||
5398 | If not specified then the filename | ||
5399 | .Pa server.pem | ||
5400 | will be used. | ||
5401 | .It Fl key Ar keyfile | ||
5402 | The private key to use. | ||
5403 | If not specified then the certificate file will be used. | ||
5404 | .It Fl dcert Ar filename , Fl dkey Ar keyname | ||
5405 | Specify an additional certificate and private key; these behave in the | ||
5406 | same manner as the | ||
5407 | .Fl cert | ||
5408 | and | ||
5409 | .Fl key | ||
5410 | options except there is no default if they are not specified | ||
5411 | (no additional certificate and key is used). | ||
5412 | As noted above some cipher suites require a certificate containing a key of | ||
5413 | a certain type. | ||
5414 | Some cipher suites need a certificate carrying an RSA key | ||
5415 | and some a DSS (DSA) key. | ||
5416 | By using RSA and DSS certificates and keys | ||
5417 | a server can support clients which only support RSA or DSS cipher suites | ||
5418 | by using an appropriate certificate. | ||
5419 | .It Fl nocert | ||
5420 | If this option is set then no certificate is used. | ||
5421 | This restricts the cipher suites available to the anonymous ones | ||
5422 | (currently just anonymous DH). | ||
5423 | .It Fl dhparam Ar filename | ||
5424 | The DH parameter file to use. | ||
5425 | The ephemeral DH cipher suites generate keys | ||
5426 | using a set of DH parameters. | ||
5427 | If not specified, then an attempt is made to | ||
5428 | load the parameters from the server certificate file. | ||
5429 | If this fails then a static set of parameters hard coded into the | ||
5430 | .Nm s_server | ||
5431 | program will be used. | ||
5432 | .It Fl no_dhe | ||
5433 | If this option is set, then no DH parameters will be loaded, effectively | ||
5434 | disabling the ephemeral DH cipher suites. | ||
5435 | .It Fl no_tmp_rsa | ||
5436 | Certain export cipher suites sometimes use a temporary RSA key; this option | ||
5437 | disables temporary RSA key generation. | ||
5438 | .It Fl verify Ar depth , Fl Verify Ar depth | ||
5439 | The verify | ||
5440 | .Ar depth | ||
5441 | to use. | ||
5442 | This specifies the maximum length of the client certificate chain | ||
5443 | and makes the server request a certificate from the client. | ||
5444 | With the | ||
5445 | .Fl verify | ||
5446 | option a certificate is requested but the client does not have to send one. | ||
5447 | With the | ||
5448 | .Fl Verify | ||
5449 | option the client must supply a certificate or an error occurs. | ||
5450 | .It Fl CApath Ar directory | ||
5451 | The | ||
5452 | .Ar directory | ||
5453 | to use for client certificate verification. | ||
5454 | This directory must be in "hash format", see | ||
5455 | .Fl verify | ||
5456 | for more information. | ||
5457 | These are also used when building the server certificate chain. | ||
5458 | .It Fl CAfile Ar file | ||
5459 | A file containing trusted certificates to use during client authentication | ||
5460 | and to use when attempting to build the server certificate chain. | ||
5461 | The list is also used in the list of acceptable client CAs passed to the | ||
5462 | client when a certificate is requested. | ||
5463 | .It Fl state | ||
5464 | Prints out the SSL session states. | ||
5465 | .It Fl debug | ||
5466 | Print extensive debugging information including a hex dump of all traffic. | ||
5467 | .It Fl msg | ||
5468 | Show all protocol messages with hex dump. | ||
5469 | .It Fl nbio_test | ||
5470 | Tests non blocking I/O. | ||
5471 | .It Fl nbio | ||
5472 | Turns on non blocking I/O. | ||
5473 | .It Fl crlf | ||
5474 | This option translates a line feed from the terminal into CR+LF. | ||
5475 | .It Fl quiet | ||
5476 | Inhibit printing of session and certificate information. | ||
5477 | .It Fl ssl2 , ssl3 , tls1 , no_ssl2 , | ||
5478 | .It Fl no_ssl3 , no_tls1 | ||
5479 | These options disable the use of certain SSL or TLS protocols. | ||
5480 | By default, the initial handshake uses a method which should be compatible | ||
5481 | with all servers and permit them to use SSL v3, SSL v2 or TLS as appropriate. | ||
5482 | .It Fl bugs | ||
5483 | There are several known bugs in SSL and TLS implementations. | ||
5484 | Adding this option enables various workarounds. | ||
5485 | .It Fl hack | ||
5486 | This option enables a further workaround for some some early Netscape | ||
5487 | SSL code (?). | ||
5488 | .It Fl cipher Ar cipherlist | ||
5489 | This allows the cipher list used by the server to be modified. | ||
5490 | When the client sends a list of supported ciphers, the first client cipher | ||
5491 | also included in the server list is used. | ||
5492 | Because the client specifies the preference order, the order of the server | ||
5493 | cipherlist irrelevant. | ||
5494 | See the | ||
5495 | .Sx CIPHERS | ||
5496 | section for more information. | ||
5497 | .It Fl www | ||
5498 | Sends a status message back to the client when it connects. | ||
5499 | This includes lots of information about the ciphers used and various | ||
5500 | session parameters. | ||
5501 | The output is in HTML format so this option will normally be used with a | ||
5502 | web browser. | ||
5503 | .It Fl WWW | ||
5504 | Emulates a simple web server. | ||
5505 | Pages will be resolved relative to the current directory; | ||
5506 | for example if the URL | ||
5507 | .Pa https://myhost/page.html | ||
5508 | is requested, the file | ||
5509 | .Pa ./page.html | ||
5510 | will be loaded. | ||
5511 | .It Fl HTTP | ||
5512 | Emulates a simple web server. | ||
5513 | Pages will be resolved relative to the current directory; | ||
5514 | for example if the URL | ||
5515 | .Pa https://myhost/page.html | ||
5516 | is requested the file | ||
5517 | .Pa ./page.html | ||
5518 | will be loaded. | ||
5519 | The files loaded are assumed to contain a complete and correct HTTP | ||
5520 | response (lines that are part of the HTTP response line and headers | ||
5521 | must end with CRLF). | ||
5522 | .It Fl engine Ar id | ||
5523 | Specifying an engine (by it's unique | ||
5524 | .Ar id | ||
5525 | string) will cause | ||
5526 | .Nm s_server | ||
5527 | to attempt to obtain a functional reference to the specified engine, | ||
5528 | thus initialising it if needed. | ||
5529 | The engine will then be set as the default for all available algorithms. | ||
5530 | .It Fl rand Ar file ... | ||
5531 | A | ||
5532 | .Ar file | ||
5533 | or | ||
5534 | .Ar file Ns Li s | ||
5535 | containing random data used to seed the random number generator, | ||
5536 | or an EGD socket (see | ||
5537 | .Xr RAND_egd 3 ) . | ||
5538 | Multiple files can be specified separated by an OS-dependent character. | ||
5539 | The separator is | ||
5540 | .Cm \&; | ||
5541 | for MS-Windows, | ||
5542 | .Cm \&, | ||
5543 | for OpenVMS, and | ||
5544 | .Cm \&: | ||
5545 | for all others. | ||
5546 | .Ed | ||
5547 | .Sh S_SERVER CONNECTED COMMANDS | ||
5548 | If a connection request is established with an SSL client and neither the | ||
5549 | .Fl www | ||
5550 | nor the | ||
5551 | .Fl WWW | ||
5552 | option has been used, then normally any data received | ||
5553 | from the client is displayed and any key presses will be sent to the client. | ||
5554 | .Pp | ||
5555 | Certain single letter commands are also recognized which perform special | ||
5556 | operations: these are listed below. | ||
5557 | .Pp | ||
5558 | .Bd -ragged -offset indent | ||
5559 | .It Ar q | ||
5560 | End the current SSL connection, but still accept new connections. | ||
5561 | .It Ar Q | ||
5562 | End the current SSL connection and exit. | ||
5563 | .It Ar r | ||
5564 | Renegotiate the SSL session. | ||
5565 | .It Ar R | ||
5566 | Renegotiate the SSL session and request a client certificate. | ||
5567 | .It Ar P | ||
5568 | Send some plain text down the underlying TCP connection: this should | ||
5569 | cause the client to disconnect due to a protocol violation. | ||
5570 | .It Ar S | ||
5571 | Print out some session cache status information. | ||
5572 | .Ed | ||
5573 | .Sh S_SERVER NOTES | ||
5574 | .Nm s_server | ||
5575 | can be used to debug SSL clients. | ||
5576 | To accept connections from a web browser the command: | ||
5577 | .Pp | ||
5578 | \& $ openssl s_server -accept 443 -www | ||
5579 | .Pp | ||
5580 | can be used for example. | ||
5581 | .Pp | ||
5582 | Most web browsers (in particular Netscape and MSIE) only support RSA cipher | ||
5583 | suites, so they cannot connect to servers which don't use a certificate | ||
5584 | carrying an RSA key or a version of | ||
5585 | .Nm OpenSSL | ||
5586 | with RSA disabled. | ||
5587 | .Pp | ||
5588 | Although specifying an empty list of CAs when requesting a client certificate | ||
5589 | is strictly speaking a protocol violation, some SSL | ||
5590 | clients interpret this to mean any CA is acceptable. | ||
5591 | This is useful for debugging purposes. | ||
5592 | .Pp | ||
5593 | The session parameters can printed out using the | ||
5594 | .Nm sess_id | ||
5595 | program. | ||
5596 | .Sh S_SERVER BUGS | ||
5597 | Because this program has a lot of options and also because some of | ||
5598 | the techniques used are rather old, the C source of | ||
5599 | .Nm s_server | ||
5600 | is rather hard to read and not a model of how things should be done. | ||
5601 | A typical SSL server program would be much simpler. | ||
5602 | .Pp | ||
5603 | The output of common ciphers is wrong: it just gives the list of ciphers that | ||
5604 | .Nm OpenSSL | ||
5605 | recognizes and the client supports. | ||
5606 | .Pp | ||
5607 | There should be a way for the | ||
5608 | .Nm s_server | ||
5609 | program to print out details of any | ||
5610 | unknown cipher suites a client says it supports. | ||
5611 | .\" | ||
5612 | .\" S_TIME | ||
5613 | .\" | ||
5614 | .Sh S_TIME | ||
5615 | The | ||
5616 | .Nm s_time | ||
5617 | utility is undocumented. | ||
5618 | .\" | ||
5619 | .\" SESS_ID | ||
5620 | .\" | ||
5621 | .Sh SESS_ID | ||
5622 | .Nm openssl sess_id | ||
5623 | .Bk -words | ||
5624 | .Op Fl inform Ar PEM|DER | ||
5625 | .Op Fl outform Ar PEM|DER | ||
5626 | .Op Fl in Ar filename | ||
5627 | .Op Fl out Ar filename | ||
5628 | .Op Fl text | ||
5629 | .Op Fl noout | ||
5630 | .Op Fl context Ar ID | ||
5631 | .Ek | ||
5632 | .Pp | ||
5633 | The | ||
5634 | .Nm sess_id | ||
5635 | program processes the encoded version of the SSL | ||
5636 | session structure and optionally prints out SSL | ||
5637 | session details (for example the SSL | ||
5638 | session master key) in human readable format. | ||
5639 | Since this is a diagnostic tool that needs some knowledge of the SSL | ||
5640 | protocol to use properly, most users will not need to use it. | ||
5641 | .Pp | ||
5642 | The options are as follows: | ||
5643 | .Bd -ragged -offset indent | ||
5644 | .It Fl inform Ar DER|PEM | ||
5645 | This specifies the input format. | ||
5646 | The | ||
5647 | .Ar DER | ||
5648 | argument uses an ASN1 DER encoded | ||
5649 | format containing session details. | ||
5650 | The precise format can vary from one version to the next. | ||
5651 | The | ||
5652 | .Ar PEM | ||
5653 | form is the default format: it consists of the DER | ||
5654 | format base64 encoded with additional header and footer lines. | ||
5655 | .It Fl outform Ar DER|PEM | ||
5656 | This specifies the output format, the options have the same meaning as the | ||
5657 | .Fl inform | ||
5658 | option. | ||
5659 | .It Fl in Ar filename | ||
5660 | This specifies the input | ||
5661 | .Ar filename | ||
5662 | to read session information from, or standard input by default. | ||
5663 | .It Fl out Ar filename | ||
5664 | This specifies the output | ||
5665 | .Ar filename | ||
5666 | to write session information to, or standard | ||
5667 | output if this option is not specified. | ||
5668 | .It Fl text | ||
5669 | Prints out the various public or private key components in | ||
5670 | plain text in addition to the encoded version. | ||
5671 | .It Fl cert | ||
5672 | If a certificate is present in the session it will be output using this option, | ||
5673 | if the | ||
5674 | .Fl text | ||
5675 | option is also present then it will be printed out in text form. | ||
5676 | .It Fl noout | ||
5677 | This option prevents output of the encoded version of the session. | ||
5678 | .It Fl context Ar ID | ||
5679 | This option can set the session id so the output session information uses the | ||
5680 | supplied | ||
5681 | .Ar ID . | ||
5682 | The | ||
5683 | .Ar ID | ||
5684 | can be any string of characters. | ||
5685 | This option won't normally be used. | ||
5686 | .Ed | ||
5687 | .Sh SESS_ID OUTPUT | ||
5688 | Typical output: | ||
5689 | .Pp | ||
5690 | .Bd -literal | ||
5691 | \& SSL-Session: | ||
5692 | \& Protocol : TLSv1 | ||
5693 | \& Cipher : 0016 | ||
5694 | \& Session-ID: 871E62626C554CE95488823752CBD5F3673A3EF3DCE9C67BD916C809914B40ED | ||
5695 | \& Session-ID-ctx: 01000000 | ||
5696 | \& Master-Key: A7CEFC571974BE02CAC305269DC59F76EA9F0B180CB6642697A68251F2D2BB57E51DBBB4C7885573192AE9AEE220FACD | ||
5697 | \& Key-Arg : None | ||
5698 | \& Start Time: 948459261 | ||
5699 | \& Timeout : 300 (sec) | ||
5700 | \& Verify return code 0 (ok) | ||
5701 | .Ed | ||
5702 | .Pp | ||
5703 | These are described below in more detail. | ||
5704 | .Bd -ragged -offset indent | ||
5705 | .It Ar Protocol | ||
5706 | This is the protocol in use: TLSv1, SSLv3 or SSLv2. | ||
5707 | .It Ar Cipher | ||
5708 | The cipher used is the actual raw SSL or TLS cipher code; | ||
5709 | see the SSL or TLS specifications for more information. | ||
5710 | .It Ar Session-ID | ||
5711 | The SSL session ID in hex format. | ||
5712 | .It Ar Session-ID-ctx | ||
5713 | The session ID context in hex format. | ||
5714 | .It Ar Master-Key | ||
5715 | This is the SSL session master key. | ||
5716 | .It Ar Key-Arg | ||
5717 | The key argument, this is only used in SSL v2. | ||
5718 | .It Ar Start Time | ||
5719 | This is the session start time, represented as an integer | ||
5720 | in standard Unix format. | ||
5721 | .It Ar Timeout | ||
5722 | The timeout in seconds. | ||
5723 | .It Ar Verify return code | ||
5724 | This is the return code when an SSL client certificate is verified. | ||
5725 | .Ed | ||
5726 | .Sh SESS_ID NOTES | ||
5727 | The | ||
5728 | .Em PEM | ||
5729 | encoded session format uses the header and footer lines: | ||
5730 | .Pp | ||
5731 | .Bd -literal | ||
5732 | \& -----BEGIN SSL SESSION PARAMETERS----- | ||
5733 | \& -----END SSL SESSION PARAMETERS----- | ||
5734 | .Ed | ||
5735 | .Pp | ||
5736 | Since the SSL session output contains the master key, it is possible to read | ||
5737 | the contents of an encrypted session using this information. | ||
5738 | Therefore appropriate security precautions | ||
5739 | should be taken if the information is being output by a "real" application. | ||
5740 | This is, however, strongly discouraged and should only be used for | ||
5741 | debugging purposes. | ||
5742 | .Sh SESS_ID BUGS | ||
5743 | The cipher and start time should be printed out in human readable form. | ||
5744 | .\" | ||
5745 | .\" SMIME | ||
5746 | .\" | ||
5747 | .Sh SMIME | ||
5748 | .Nm openssl smime | ||
5749 | .Bk -words | ||
5750 | .Op Fl encrypt | ||
5751 | .Op Fl decrypt | ||
5752 | .Op Fl sign | ||
5753 | .Op Fl verify | ||
5754 | .Op Fl pk7out | ||
5755 | .Op Fl des | ||
5756 | .Op Fl des3 | ||
5757 | .Op Fl rc2-40 | ||
5758 | .Op Fl rc2-64 | ||
5759 | .Op Fl rc2-128 | ||
5760 | .Op Fl in Ar file | ||
5761 | .Op Fl certfile Ar file | ||
5762 | .Op Fl signer Ar file | ||
5763 | .Op Fl recip Ar file | ||
5764 | .Op Fl inform Ar SMIME|PEM|DER | ||
5765 | .Op Fl passin Ar arg | ||
5766 | .Op Fl inkey Ar file | ||
5767 | .Op Fl out Ar file | ||
5768 | .Op Fl outform Ar SMIME|PEM|DER | ||
5769 | .Op Fl content Ar file | ||
5770 | .Op Fl to Ar addr | ||
5771 | .Op Fl from Ar addr | ||
5772 | .Op Fl subject Ar s | ||
5773 | .Op Fl text | ||
5774 | .Op Fl rand Ar file ... | ||
5775 | .Op Ar cert.pem ... | ||
5776 | .Ek | ||
5777 | .Pp | ||
5778 | The | ||
5779 | .Nm smime | ||
5780 | command handles | ||
5781 | .Em S/MIME | ||
5782 | mail. | ||
5783 | It can encrypt, decrypt, sign and verify | ||
5784 | .Em S/MIME | ||
5785 | messages. | ||
5786 | .Pp | ||
5787 | There are five operation options that set the type of operation to be performed. | ||
5788 | The meaning of the other options varies according to the operation type. | ||
5789 | .Pp | ||
5790 | The options are as follows: | ||
5791 | .Bd -ragged -offset indent | ||
5792 | .It Fl encrypt | ||
5793 | Encrypt mail for the given recipient certificates. | ||
5794 | Input file is the message to be encrypted. | ||
5795 | The output file is the encrypted mail in | ||
5796 | .Em MIME | ||
5797 | format. | ||
5798 | .It Fl decrypt | ||
5799 | Decrypt mail using the supplied certificate and private key. | ||
5800 | Expects an encrypted mail message in | ||
5801 | .Em MIME | ||
5802 | format for the input file. | ||
5803 | The decrypted mail is written to the output file. | ||
5804 | .It Fl sign | ||
5805 | Sign mail using the supplied certificate and private key. | ||
5806 | Input file is the message to be signed. | ||
5807 | The signed message in | ||
5808 | .Em MIME | ||
5809 | format is written to the output file. | ||
5810 | .It Fl verify | ||
5811 | Verify signed mail. | ||
5812 | Expects a signed mail message on input and outputs the signed data. | ||
5813 | Both clear text and opaque signing is supported. | ||
5814 | .It Fl pk7out | ||
5815 | Takes an input message and writes out a | ||
5816 | .Em PEM | ||
5817 | encoded PKCS#7 structure. | ||
5818 | .It Fl in Ar filename | ||
5819 | The input message to be encrypted or signed or the | ||
5820 | .Em MIME | ||
5821 | message to | ||
5822 | be decrypted or verified. | ||
5823 | .It Fl inform Ar SMIME|PEM|DER | ||
5824 | This specifies the input format for the PKCS#7 structure. | ||
5825 | The default is | ||
5826 | .Em SMIME | ||
5827 | which reads an | ||
5828 | .Em S/MIME | ||
5829 | format message. | ||
5830 | .Em PEM | ||
5831 | and | ||
5832 | .Em DER | ||
5833 | format change this to expect PEM and DER format PKCS#7 structures | ||
5834 | instead. | ||
5835 | This currently only affects the input format of the PKCS#7 | ||
5836 | structure, if no PKCS#7 structure is being input (for example with | ||
5837 | .Fl encrypt | ||
5838 | or | ||
5839 | .Fl sign ) | ||
5840 | this option has no effect. | ||
5841 | .It Fl out Ar filename | ||
5842 | The message text that has been decrypted or verified, or the output | ||
5843 | .Em MIME | ||
5844 | format message that has been signed or verified. | ||
5845 | .It Fl outform Ar SMIME|PEM|DER | ||
5846 | This specifies the output format for the PKCS#7 structure. | ||
5847 | The default is | ||
5848 | .Em SMIME | ||
5849 | which writes an | ||
5850 | .Em S/MIME | ||
5851 | format message. | ||
5852 | .Em PEM | ||
5853 | and | ||
5854 | .Em DER | ||
5855 | format change this to write PEM and DER format PKCS#7 structures | ||
5856 | instead. | ||
5857 | This currently only affects the output format of the PKCS#7 | ||
5858 | structure; if no PKCS#7 structure is being output (for example with | ||
5859 | .Fl verify | ||
5860 | or | ||
5861 | .Fl decrypt ) | ||
5862 | this option has no effect. | ||
5863 | .It Fl content Ar filename | ||
5864 | This specifies a file containing the detached content. | ||
5865 | This is only useful with the | ||
5866 | .Fl verify | ||
5867 | command. | ||
5868 | This is only usable if the PKCS#7 structure is using the detached | ||
5869 | signature form where the content is not included. | ||
5870 | This option will override any content if the input format is | ||
5871 | .Em S/MIME | ||
5872 | and it uses the multipart/signed | ||
5873 | .Em MIME | ||
5874 | content type. | ||
5875 | .It Fl text | ||
5876 | This option adds plain text (text/plain) | ||
5877 | .Em MIME | ||
5878 | headers to the supplied message if encrypting or signing. | ||
5879 | If decrypting or verifying it strips off text headers: | ||
5880 | if the decrypted or verified message is not of | ||
5881 | .Em MIME | ||
5882 | type text/plain then an error occurs. | ||
5883 | .It Fl CAfile Ar file | ||
5884 | A | ||
5885 | .Ar file | ||
5886 | containing trusted CA certificates, only used with | ||
5887 | .Fl verify . | ||
5888 | .It Fl CApath Ar dir | ||
5889 | A | ||
5890 | .Ar directory | ||
5891 | containing trusted CA certificates, only used with | ||
5892 | .Fl verify . | ||
5893 | This directory must be a standard certificate directory; | ||
5894 | that is, a hash of each subject name (using | ||
5895 | .Nm x509 -hash ) | ||
5896 | should be linked to each certificate. | ||
5897 | .It Fl des des3 rc2-40 rc2-64 rc2-128 | ||
5898 | The encryption algorithm to use. | ||
5899 | DES (56 bits), triple DES\s0 (168 bits) | ||
5900 | or 40, 64 or 128 bit RC2, respectively; if not specified 40 bit RC2 is | ||
5901 | used. | ||
5902 | Only used with | ||
5903 | .Fl encrypt . | ||
5904 | .It Fl nointern | ||
5905 | When verifying a message, normally certificates (if any) included in | ||
5906 | the message are searched for the signing certificate. | ||
5907 | With this option only the certificates specified in the | ||
5908 | .Fl certfile | ||
5909 | option are used. | ||
5910 | The supplied certificates can still be used as untrusted CAs however. | ||
5911 | .It Fl noverify | ||
5912 | Do not verify the signer's certificate of a signed message. | ||
5913 | .It Fl nochain | ||
5914 | Do not do chain verification of signers' certificates: that is don't | ||
5915 | use the certificates in the signed message as untrusted CAs. | ||
5916 | .It Fl nosigs | ||
5917 | Don't try to verify the signatures on the message. | ||
5918 | .It Fl nocerts | ||
5919 | When signing a message, the signer's certificate is normally included; | ||
5920 | with this option it is excluded. | ||
5921 | This will reduce the size of the signed message but the verifier must | ||
5922 | have a copy of the signer's certificate available locally (passed using the | ||
5923 | .Fl certfile | ||
5924 | option, for example). | ||
5925 | .It Fl noattr | ||
5926 | Normally, when a message is signed a set of attributes are included which | ||
5927 | include the signing time and supported symmetric algorithms. | ||
5928 | With this option they are not included. | ||
5929 | .It Fl binary | ||
5930 | Normally the input message is converted to "canonical" format which is | ||
5931 | effectively using CR and LF as end of line: as required by the | ||
5932 | .Em S/MIME | ||
5933 | specification. | ||
5934 | When this option is present no translation occurs. | ||
5935 | This is useful when handling binary data which may not be in | ||
5936 | .Em MIME | ||
5937 | format. | ||
5938 | .It Fl nodetach | ||
5939 | When signing a message use opaque signing: this form is more resistant | ||
5940 | to translation by mail relays but it cannot be read by mail agents that | ||
5941 | do not support | ||
5942 | .Em S/MIME . | ||
5943 | Without this option cleartext signing with the | ||
5944 | .Em MIME | ||
5945 | type multipart/signed is used. | ||
5946 | .It Fl certfile Ar file | ||
5947 | Allows additional certificates to be specified. | ||
5948 | When signing these will be included with the message. | ||
5949 | When verifying these will be searched for the signers' certificates. | ||
5950 | The certificates should be in | ||
5951 | .Em PEM | ||
5952 | format. | ||
5953 | .It Fl signer Ar file | ||
5954 | The signer's certificate when signing a message. | ||
5955 | If a message is being verified, then the signer's certificates will be | ||
5956 | written to this file if the verification was successful. | ||
5957 | .It Fl recip Ar file | ||
5958 | The recipients certificate when decrypting a message. | ||
5959 | This certificate | ||
5960 | must match one of the recipients of the message or an error occurs. | ||
5961 | .It Fl inkey Ar file | ||
5962 | The private key to use when signing or decrypting. | ||
5963 | This must match the corresponding certificate. | ||
5964 | If this option is not specified then the private key must be included | ||
5965 | in the certificate file specified with | ||
5966 | the | ||
5967 | .Fl recip | ||
5968 | or | ||
5969 | .Fl signer | ||
5970 | file. | ||
5971 | .It Fl passin Ar arg | ||
5972 | The private key password source. | ||
5973 | For more information about the format of | ||
5974 | .Ar arg | ||
5975 | see the | ||
5976 | .Sx PASS PHRASE ARGUMENTS | ||
5977 | section above. | ||
5978 | .It Fl rand Ar file ... | ||
5979 | A | ||
5980 | .Ar file | ||
5981 | or | ||
5982 | .Ar file Ns Li s | ||
5983 | containing random data used to seed the random number generator, | ||
5984 | or an EGD socket (see | ||
5985 | .Xr RAND_egd 3 ) . | ||
5986 | Multiple files can be specified separated by an OS-dependent character. | ||
5987 | The separator is | ||
5988 | .Cm \&; | ||
5989 | for MS-Windows, | ||
5990 | .Cm \&, | ||
5991 | for OpenVMS, and | ||
5992 | .Cm \&: | ||
5993 | for all others. | ||
5994 | .It Ar cert.pem ... | ||
5995 | One or more certificates of message recipients: used when encrypting | ||
5996 | a message. | ||
5997 | .It Fl to , from , subject | ||
5998 | The relevant mail headers. | ||
5999 | These are included outside the signed | ||
6000 | portion of a message so they may be included manually. | ||
6001 | If signing, then many | ||
6002 | .Em S/MIME | ||
6003 | mail clients check the signer's certificate email | ||
6004 | address matches that specified in the From: address. | ||
6005 | .Ed | ||
6006 | .Sh SMIME NOTES | ||
6007 | The | ||
6008 | .Em MIME | ||
6009 | message must be sent without any blank lines between the | ||
6010 | headers and the output. | ||
6011 | Some mail programs will automatically add a blank line. | ||
6012 | Piping the mail directly to sendmail is one way to | ||
6013 | achieve the correct format. | ||
6014 | .Pp | ||
6015 | The supplied message to be signed or encrypted must include the | ||
6016 | necessary | ||
6017 | .Em MIME | ||
6018 | headers or many | ||
6019 | .Em S/MIME | ||
6020 | clients won't display it properly (if at all). | ||
6021 | You can use the | ||
6022 | .Fl text | ||
6023 | option to automatically add plain text headers. | ||
6024 | .Pp | ||
6025 | A "signed and encrypted" message is one where a signed message is | ||
6026 | then encrypted. | ||
6027 | This can be produced by encrypting an already signed message: | ||
6028 | see the | ||
6029 | .Sx SMIME EXAMPLES | ||
6030 | section. | ||
6031 | .Pp | ||
6032 | This version of the program only allows one signer per message, but it | ||
6033 | will verify multiple signers on received messages. | ||
6034 | Some | ||
6035 | .Em S/MIME | ||
6036 | clients choke if a message contains multiple signers. | ||
6037 | It is possible to sign messages "in parallel" by signing an already | ||
6038 | signed message. | ||
6039 | .Pp | ||
6040 | The options | ||
6041 | .Fl encrypt | ||
6042 | and | ||
6043 | .Fl decrypt | ||
6044 | reflect common usage in | ||
6045 | .Em S/MIME | ||
6046 | clients. | ||
6047 | Strictly speaking these process PKCS#7 enveloped data: PKCS#7 | ||
6048 | encrypted data is used for other purposes. | ||
6049 | .Sh SMIME EXIT CODES | ||
6050 | .Bd -ragged -offset indent | ||
6051 | .It Ar 0 | ||
6052 | The operation was completely successful. | ||
6053 | .It Ar 1 | ||
6054 | An error occurred parsing the command options. | ||
6055 | .It Ar 2 | ||
6056 | One of the input files could not be read. | ||
6057 | .It Ar 3 | ||
6058 | An error occurred creating the PKCS#7 file or when reading the | ||
6059 | .Em MIME | ||
6060 | message. | ||
6061 | .It Ar 4 | ||
6062 | An error occurred decrypting or verifying the message. | ||
6063 | .It Ar 5 | ||
6064 | The message was verified correctly, but an error occurred writing out | ||
6065 | the signers certificates. | ||
6066 | .Ed | ||
6067 | .Sh SMIME EXAMPLES | ||
6068 | Create a cleartext signed message: | ||
6069 | .Pp | ||
6070 | .Bd -literal | ||
6071 | \& $ openssl smime -sign -in message.txt -text -out mail.msg \e | ||
6072 | \& -signer mycert.pem | ||
6073 | .Ed | ||
6074 | .Pp | ||
6075 | Create an opaque signed message: | ||
6076 | .Pp | ||
6077 | .Bd -literal | ||
6078 | \& $ openssl smime -sign -in message.txt -text -out mail.msg -nodetach \e | ||
6079 | \& -signer mycert.pem | ||
6080 | .Ed | ||
6081 | .Pp | ||
6082 | Create a signed message, include some additional certificates and | ||
6083 | read the private key from another file: | ||
6084 | .Pp | ||
6085 | .Bd -literal | ||
6086 | \& $ openssl smime -sign -in in.txt -text -out mail.msg \e | ||
6087 | \& -signer mycert.pem -inkey mykey.pem -certfile mycerts.pem | ||
6088 | .Ed | ||
6089 | .Pp | ||
6090 | Send a signed message under Unix directly to | ||
6091 | .Xr sendmail 8 , | ||
6092 | including headers: | ||
6093 | .Pp | ||
6094 | .Bd -literal | ||
6095 | \& $ openssl smime -sign -in in.txt -text -signer mycert.pem \e | ||
6096 | \& -from steve@openssl.org -to someone@somewhere \e | ||
6097 | \& -subject "Signed message" | sendmail someone@somewhere | ||
6098 | .Ed | ||
6099 | .Pp | ||
6100 | Verify a message and extract the signer's certificate if successful: | ||
6101 | .Pp | ||
6102 | .Bd -literal | ||
6103 | \& $ openssl smime -verify -in mail.msg -signer user.pem \e | ||
6104 | \& -out signedtext.txt | ||
6105 | .Ed | ||
6106 | .Pp | ||
6107 | Send encrypted mail using triple DES: | ||
6108 | .Pp | ||
6109 | .Bd -literal | ||
6110 | \& $ openssl smime -encrypt -in in.txt -from steve@openssl.org \e | ||
6111 | \& -to someone@somewhere -subject "Encrypted message" \e | ||
6112 | \& -des3 user.pem -out mail.msg | ||
6113 | .Ed | ||
6114 | .Pp | ||
6115 | Sign and encrypt mail: | ||
6116 | .Pp | ||
6117 | .Bd -literal | ||
6118 | \& $ openssl smime -sign -in ml.txt -signer my.pem -text \e | ||
6119 | \& | openssl smime -encrypt -out mail.msg \e | ||
6120 | \& -from steve@openssl.org -to someone@somewhere \e | ||
6121 | \& -subject "Signed and Encrypted message" -des3 user.pem | ||
6122 | .Ed | ||
6123 | .Pp | ||
6124 | .Sy Note : | ||
6125 | The encryption command does not include the | ||
6126 | .Fl text | ||
6127 | option because the message being encrypted already has | ||
6128 | .Em MIME | ||
6129 | headers. | ||
6130 | .Pp | ||
6131 | Decrypt mail: | ||
6132 | .Pp | ||
6133 | \& $ openssl smime -decrypt -in mail.msg -recip mycert.pem -inkey key.pem | ||
6134 | .Pp | ||
6135 | The output from Netscape form signing is a PKCS#7 structure with the | ||
6136 | detached signature format. | ||
6137 | You can use this program to verify the signature by line wrapping the | ||
6138 | base64 encoded structure and surrounding it with: | ||
6139 | .Pp | ||
6140 | .Bd -literal | ||
6141 | \& -----BEGIN PKCS7---- | ||
6142 | \& -----END PKCS7---- | ||
6143 | .Ed | ||
6144 | .Pp | ||
6145 | and using the command: | ||
6146 | .br | ||
6147 | .Pp | ||
6148 | .Bd -literal | ||
6149 | \& $ openssl smime -verify -inform PEM -in signature.pem | ||
6150 | \& -content content.txt | ||
6151 | .Ed | ||
6152 | .Pp | ||
6153 | Alternatively, you can base64 decode the signature and use: | ||
6154 | .Pp | ||
6155 | .Bd -literal | ||
6156 | \& $ openssl smime -verify -inform DER -in signature.der | ||
6157 | \& -content content.txt | ||
6158 | .Ed | ||
6159 | .Sh SMIME BUGS | ||
6160 | The | ||
6161 | .Em MIME | ||
6162 | parser isn't very clever: it seems to handle most messages that I've thrown | ||
6163 | at it, but it may choke on others. | ||
6164 | .Pp | ||
6165 | The code currently will only write out the signer's certificate to a file: | ||
6166 | if the signer has a separate encryption certificate this must be manually | ||
6167 | extracted. | ||
6168 | There should be some heuristic that determines the correct encryption | ||
6169 | certificate. | ||
6170 | .Pp | ||
6171 | Ideally a database should be maintained of a certificate for each email | ||
6172 | address. | ||
6173 | .Pp | ||
6174 | The code doesn't currently take note of the permitted symmetric encryption | ||
6175 | algorithms as supplied in the | ||
6176 | .Em SMIMECapabilities | ||
6177 | signed attribute. | ||
6178 | This means the user has to manually include the correct encryption algorithm. | ||
6179 | It should store the list of permitted ciphers in a database and only use those. | ||
6180 | .Pp | ||
6181 | No revocation checking is done on the signer's certificate. | ||
6182 | .Pp | ||
6183 | The current code can only handle | ||
6184 | .Em S/MIME | ||
6185 | v2 messages, the more complex | ||
6186 | .Em S/MIME | ||
6187 | v3 structures may cause parsing errors. | ||
6188 | .\" | ||
6189 | .\" SPEED | ||
6190 | .\" | ||
6191 | .Sh SPEED | ||
6192 | .Nm openssl speed | ||
6193 | .Op Fl engine Ar id | ||
6194 | .Op Cm md2 | ||
6195 | .Op Cm mdc2 | ||
6196 | .Op Cm md5 | ||
6197 | .Op Cm hmac | ||
6198 | .Op Cm sha1 | ||
6199 | .Op Cm rmd160 | ||
6200 | .Op Cm idea-cbc | ||
6201 | .Op Cm rc2-cbc | ||
6202 | .Op Cm rc5-cbc | ||
6203 | .Op Cm bf-cbc | ||
6204 | .Op Cm des-cbc | ||
6205 | .Op Cm des-ede3 | ||
6206 | .Op Cm rc4 | ||
6207 | .Op Cm rsa512 | ||
6208 | .Op Cm rsa1024 | ||
6209 | .Op Cm rsa2048 | ||
6210 | .Op Cm rsa4096 | ||
6211 | .Op Cm dsa512 | ||
6212 | .Op Cm dsa1024 | ||
6213 | .Op Cm dsa2048 | ||
6214 | .Op Cm idea | ||
6215 | .Op Cm rc2 | ||
6216 | .Op Cm des | ||
6217 | .Op Cm rsa | ||
6218 | .Op Cm blowfish | ||
6219 | .Pp | ||
6220 | The | ||
6221 | .Nm speed | ||
6222 | command is used to test the performance of cryptographic algorithms. | ||
6223 | .Pp | ||
6224 | .Bd -ragged -offset indent | ||
6225 | .It Fl engine Ar id | ||
6226 | Specifying an engine (by it's unique | ||
6227 | .Ar id | ||
6228 | string) will cause | ||
6229 | .Nm speed | ||
6230 | to attempt to obtain a functional reference to the specified engine, | ||
6231 | thus initialising it if needed. | ||
6232 | The engine will then be set as the default | ||
6233 | for all available algorithms. | ||
6234 | .It Cm [zero or more test algorithms] | ||
6235 | If any options are given, | ||
6236 | .Nm speed | ||
6237 | tests those algorithms, otherwise all of the above are tested. | ||
6238 | .Ed | ||
6239 | .\" | ||
6240 | .\" SPKAC | ||
6241 | .\" | ||
6242 | .Sh SPKAC | ||
6243 | .Nm openssl spkac | ||
6244 | .Op Fl in Ar filename | ||
6245 | .Op Fl out Ar filename | ||
6246 | .Op Fl key Ar keyfile | ||
6247 | .Op Fl passin Ar arg | ||
6248 | .Op Fl challenge Ar string | ||
6249 | .Op Fl pubkey | ||
6250 | .Op Fl spkac Ar spkacname | ||
6251 | .Op Fl spksect Ar section | ||
6252 | .Op Fl noout | ||
6253 | .Op Fl verify | ||
6254 | .Pp | ||
6255 | The | ||
6256 | .Nm spkac | ||
6257 | command processes Netscape signed public key and challenge | ||
6258 | (SPKAC) files. | ||
6259 | It can print out their contents, verify the signature and | ||
6260 | produce its own SPKACs from a supplied private key. | ||
6261 | .Pp | ||
6262 | The options are as follows: | ||
6263 | .Bd -ragged -offset indent | ||
6264 | .It Fl in Ar filename | ||
6265 | This specifies the input | ||
6266 | .Ar filename | ||
6267 | to read from or standard input if this option is not specified. | ||
6268 | Ignored if the | ||
6269 | .Fl key | ||
6270 | option is used. | ||
6271 | .It Fl out Ar filename | ||
6272 | Specifies the output | ||
6273 | .Ar filename | ||
6274 | to write to or standard output by default. | ||
6275 | .It Fl key Ar keyfile | ||
6276 | Create an SPKAC file using the private key in | ||
6277 | .Ar keyfile . | ||
6278 | The | ||
6279 | .Fl in , noout , spksect | ||
6280 | and | ||
6281 | .Fl verify | ||
6282 | options are ignored if present. | ||
6283 | .It Fl passin Ar password | ||
6284 | The input file password source. | ||
6285 | For more information about the format of | ||
6286 | .Ar arg | ||
6287 | see the | ||
6288 | .Sx PASS PHRASE ARGUMENTS | ||
6289 | section above. | ||
6290 | .It Fl challenge Ar string | ||
6291 | Specifies the challenge string if an SPKAC is being created. | ||
6292 | .It Fl spkac Ar spkacname | ||
6293 | Allows an alternative name for the variable containing the SPKAC. | ||
6294 | The default is "SPKAC". | ||
6295 | This option affects both generated and input SPKAC files. | ||
6296 | .It Fl spksect Ar section | ||
6297 | Allows an alternative name for the | ||
6298 | .Ar section | ||
6299 | containing the SPKAC. | ||
6300 | The default is the default section. | ||
6301 | .It Fl noout | ||
6302 | Don't output the text version of the SPKAC (not used if an | ||
6303 | SPKAC is being created). | ||
6304 | .It Fl pubkey | ||
6305 | Output the public key of an SPKAC (not used if an SPKAC is | ||
6306 | being created). | ||
6307 | .It Fl verify | ||
6308 | Verifies the digital signature on the supplied SPKAC. | ||
6309 | .Ed | ||
6310 | .Sh SPKAC EXAMPLES | ||
6311 | Print out the contents of an SPKAC: | ||
6312 | .Pp | ||
6313 | \& $ openssl spkac -in spkac.cnf | ||
6314 | .Pp | ||
6315 | Verify the signature of an SPKAC: | ||
6316 | .Pp | ||
6317 | \& $ openssl spkac -in spkac.cnf -noout -verify | ||
6318 | .Pp | ||
6319 | Create an SPKAC using the challenge string "hello": | ||
6320 | .Pp | ||
6321 | \& $ openssl spkac -key key.pem -challenge hello -out spkac.cnf | ||
6322 | .Pp | ||
6323 | Example of an SPKAC, (long lines split up for clarity): | ||
6324 | .Pp | ||
6325 | .Bd -literal | ||
6326 | \& SPKAC=MIG5MGUwXDANBgkqhkiG9w0BAQEFAANLADBIAkEA1cCoq2Wa3Ixs47uI7F\e | ||
6327 | \& PVwHVIPDx5yso105Y6zpozam135a8R0CpoRvkkigIyXfcCjiVi5oWk+6FfPaD03u\e | ||
6328 | \& PFoQIDAQABFgVoZWxsbzANBgkqhkiG9w0BAQQFAANBAFpQtY/FojdwkJh1bEIYuc\e | ||
6329 | \& 2EeM2KHTWPEepWYeawvHD0gQ3DngSC75YCWnnDdq+NQ3F+X4deMx9AaEglZtULwV\e | ||
6330 | \& 4= | ||
6331 | .Ed | ||
6332 | .Sh SPKAC NOTES | ||
6333 | A created SPKAC with suitable DN components appended can be fed into | ||
6334 | the | ||
6335 | .Nm ca | ||
6336 | utility. | ||
6337 | .Pp | ||
6338 | SPKACs are typically generated by Netscape when a form is submitted | ||
6339 | containing the | ||
6340 | .Em KEYGEN | ||
6341 | tag as part of the certificate enrollment process. | ||
6342 | .Pp | ||
6343 | The challenge string permits a primitive form of proof of possession | ||
6344 | of private key. | ||
6345 | By checking the SPKAC signature and a random challenge | ||
6346 | string, some guarantee is given that the user knows the private key | ||
6347 | corresponding to the public key being certified. | ||
6348 | This is important in some applications. | ||
6349 | Without this it is possible for a previous SPKAC | ||
6350 | to be used in a "replay attack". | ||
6351 | .\" | ||
6352 | .\" VERIFY | ||
6353 | .\" | ||
6354 | .Sh VERIFY | ||
6355 | .Nm openssl verify | ||
6356 | .Op Fl CApath Ar directory | ||
6357 | .Op Fl CAfile Ar file | ||
6358 | .Op Fl purpose Ar purpose | ||
6359 | .Op Fl untrusted Ar file | ||
6360 | .Op Fl help | ||
6361 | .Op Fl issuer_checks | ||
6362 | .Op Fl verbose | ||
6363 | .Op Fl | ||
6364 | .Op Ar certificates | ||
6365 | .Pp | ||
6366 | The | ||
6367 | .Nm verify | ||
6368 | command verifies certificate chains. | ||
6369 | .Pp | ||
6370 | The options are as follows: | ||
6371 | .Bd -ragged -offset indent | ||
6372 | .It Fl CApath directory | ||
6373 | A | ||
6374 | .Ar directory | ||
6375 | of trusted certificates. | ||
6376 | The certificates should have names of the form | ||
6377 | .Em hash.0 , | ||
6378 | or have symbolic links to them of this form. | ||
6379 | ("hash" is the hashed certificate subject name: see the | ||
6380 | .Fl hash | ||
6381 | option of the | ||
6382 | .Nm x509 | ||
6383 | utility). | ||
6384 | Under Unix the | ||
6385 | .Nm c_rehash | ||
6386 | script will automatically create symbolic links to a directory of certificates. | ||
6387 | .It Fl CAfile Ar file | ||
6388 | A | ||
6389 | .Ar file | ||
6390 | of trusted certificates. | ||
6391 | The | ||
6392 | .Ar file | ||
6393 | should contain multiple certificates in | ||
6394 | .Em PEM | ||
6395 | format concatenated together. | ||
6396 | .It Fl untrusted Ar file | ||
6397 | A | ||
6398 | .Ar file | ||
6399 | of untrusted certificates. | ||
6400 | The | ||
6401 | .Ar file | ||
6402 | should contain multiple certificates. | ||
6403 | .It Fl purpose Ar purpose | ||
6404 | The intended use for the certificate. | ||
6405 | Without this option no chain verification will be done. | ||
6406 | Currently accepted uses are | ||
6407 | .Ar sslclient , sslserver , | ||
6408 | .Ar nssslserver , smimesign , | ||
6409 | and | ||
6410 | .Ar smimeencrypt . | ||
6411 | See the | ||
6412 | .Sx VERIFY OPERATION | ||
6413 | section for more information. | ||
6414 | .It Fl help | ||
6415 | Prints out a usage message. | ||
6416 | .It Fl verbose | ||
6417 | Print extra information about the operations being performed. | ||
6418 | .It Fl issuer_checks | ||
6419 | Print out diagnostics relating to searches for the issuer certificate | ||
6420 | of the current certificate. | ||
6421 | This shows why each candidate issuer certificate was rejected. | ||
6422 | However the presence of rejection messages | ||
6423 | does not itself imply that anything is wrong: during the normal | ||
6424 | verify process several rejections may take place. | ||
6425 | .It Fl | ||
6426 | Marks the last option. | ||
6427 | All arguments following this are assumed to be certificate files. | ||
6428 | This is useful if the first certificate filename begins with a | ||
6429 | .Cm \&- . | ||
6430 | .It Ar certificates | ||
6431 | One or more | ||
6432 | .Ar certificates | ||
6433 | to verify. | ||
6434 | If no certificate filenames are included then an attempt is made to read | ||
6435 | a certificate from standard input. | ||
6436 | They should all be in | ||
6437 | .Em PEM | ||
6438 | format. | ||
6439 | .Ed | ||
6440 | .Sh VERIFY OPERATION | ||
6441 | The | ||
6442 | .Nm verify | ||
6443 | program uses the same functions as the internal SSL and S/MIME verification, | ||
6444 | therefore this description applies to these verify operations too. | ||
6445 | .Pp | ||
6446 | There is one crucial difference between the verify operations performed | ||
6447 | by the | ||
6448 | .Nm verify | ||
6449 | program: wherever possible an attempt is made to continue | ||
6450 | after an error, whereas normally the verify operation would halt on the | ||
6451 | first error. | ||
6452 | This allows all the problems with a certificate chain to be determined. | ||
6453 | .Pp | ||
6454 | The verify operation consists of a number of separate steps. | ||
6455 | .Pp | ||
6456 | Firstly a certificate chain is built up starting from the supplied certificate | ||
6457 | and ending in the root CA. | ||
6458 | It is an error if the whole chain cannot be built up. | ||
6459 | The chain is built up by looking up the issuers certificate of the current | ||
6460 | certificate. | ||
6461 | If a certificate is found which is its own issuer it is assumed | ||
6462 | to be the root CA. | ||
6463 | .Pp | ||
6464 | The process of 'looking up the issuers certificate' itself involves a number | ||
6465 | of steps. | ||
6466 | In versions of | ||
6467 | .Nm OpenSSL | ||
6468 | before 0.9.5a the first certificate whose subject name matched the issuer | ||
6469 | of the current certificate was assumed to be the issuers certificate. | ||
6470 | In | ||
6471 | .Nm OpenSSL | ||
6472 | 0.9.6 and later all certificates whose subject name matches the issuer name | ||
6473 | of the current certificate are subject to further tests. | ||
6474 | The relevant authority key identifier components of the current certificate | ||
6475 | (if present) must match the subject key identifier (if present) | ||
6476 | and issuer and serial number of the candidate issuer; in addition the | ||
6477 | .Em keyUsage | ||
6478 | extension of the candidate issuer (if present) must permit certificate signing. | ||
6479 | .Pp | ||
6480 | The lookup first looks in the list of untrusted certificates and if no match | ||
6481 | is found the remaining lookups are from the trusted certificates. | ||
6482 | The root CA is always looked up in the trusted certificate list: if the | ||
6483 | certificate to verify is a root certificate, then an exact match must be | ||
6484 | found in the trusted list. | ||
6485 | .Pp | ||
6486 | The second operation is to check every untrusted certificate's extensions for | ||
6487 | consistency with the supplied purpose. | ||
6488 | If the | ||
6489 | .Fl purpose | ||
6490 | option is not included, then no checks are done. | ||
6491 | The supplied or "leaf" certificate must have extensions compatible with the | ||
6492 | supplied purpose and all other certificates must also be valid | ||
6493 | CA certificates. | ||
6494 | The precise extensions required are described in more detail in | ||
6495 | the | ||
6496 | .Sx X509 CERTIFICATE EXTENSIONS | ||
6497 | section below. | ||
6498 | .Pp | ||
6499 | The third operation is to check the trust settings on the root CA. | ||
6500 | The root CA should be trusted for the supplied purpose. | ||
6501 | For compatibility with previous versions of | ||
6502 | .Nm SSLeay | ||
6503 | and | ||
6504 | .Nm OpenSSL , | ||
6505 | a certificate with no trust settings is considered to be valid for | ||
6506 | all purposes. | ||
6507 | .Pp | ||
6508 | The final operation is to check the validity of the certificate chain. | ||
6509 | The validity period is checked against the current system time and the | ||
6510 | .Em notBefore | ||
6511 | and | ||
6512 | .Em notAfter | ||
6513 | dates in the certificate. | ||
6514 | The certificate signatures are also checked at this point. | ||
6515 | .Pp | ||
6516 | If all operations complete successfully, then the certificate is considered | ||
6517 | valid. | ||
6518 | If any operation fails then the certificate is not valid. | ||
6519 | .Sh VERIFY DIAGNOSTICS | ||
6520 | When a verify operation fails, the output messages can be somewhat cryptic. | ||
6521 | The general form of the error message is: | ||
6522 | .Pp | ||
6523 | .Bd -literal | ||
6524 | \& server.pem: /C=AU/ST=Queensland/O=CryptSoft Pty Ltd/CN=Test CA (1024 bit) | ||
6525 | \& error 24 at 1 depth lookup:invalid CA certificate | ||
6526 | .Ed | ||
6527 | .Pp | ||
6528 | The first line contains the name of the certificate being verified followed by | ||
6529 | the subject name of the certificate. | ||
6530 | The second line contains the error number and the depth. | ||
6531 | The depth is number of the certificate being verified when a | ||
6532 | problem was detected starting with zero for the certificate being verified | ||
6533 | itself, then 1 for the CA that signed the certificate and so on. | ||
6534 | Finally a text version of the error number is presented. | ||
6535 | .Pp | ||
6536 | An exhaustive list of the error codes and messages is shown below; this also | ||
6537 | includes the name of the error code as defined in the header file | ||
6538 | .Aq Pa x509_vfy.h . | ||
6539 | Some of the error codes are defined but never returned: these are described | ||
6540 | as "unused". | ||
6541 | .Pp | ||
6542 | .Bd -ragged -offset indent | ||
6543 | .It Ar "0 X509_V_OK: ok" | ||
6544 | The operation was successful. | ||
6545 | .It Ar 2 X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT: unable to get issuer certificate | ||
6546 | The issuer certificate could not be found: this occurs if the issuer certificate | ||
6547 | of an untrusted certificate cannot be found. | ||
6548 | .It Ar 3 X509_V_ERR_UNABLE_TO_GET_CRL: unable to get certificate CRL | ||
6549 | The CRL of a certificate could not be found. | ||
6550 | Unused. | ||
6551 | .It Ar 4 X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE: unable to decrypt certificate's signature | ||
6552 | The certificate signature could not be decrypted. | ||
6553 | This means that the actual signature value could not be determined rather | ||
6554 | than it not matching the expected value. | ||
6555 | This is only meaningful for RSA keys. | ||
6556 | .It Ar 5 X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE: unable to decrypt CRL's signature | ||
6557 | The CRL signature could not be decrypted: this means that the actual | ||
6558 | signature value could not be determined rather than it not matching the | ||
6559 | expected value. | ||
6560 | Unused. | ||
6561 | .It Ar 6 X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY: unable to decode issuer public key | ||
6562 | The public key in the certificate | ||
6563 | .Em SubjectPublicKeyInfo | ||
6564 | could not be read. | ||
6565 | .It Ar 7 X509_V_ERR_CERT_SIGNATURE_FAILURE: certificate signature failure | ||
6566 | The signature of the certificate is invalid. | ||
6567 | .It Ar 8 X509_V_ERR_CRL_SIGNATURE_FAILURE: CRL signature failure | ||
6568 | The signature of the certificate is invalid. | ||
6569 | Unused. | ||
6570 | .It Ar 9 X509_V_ERR_CERT_NOT_YET_VALID: certificate is not yet valid | ||
6571 | The certificate is not yet valid: the | ||
6572 | .Em notBefore | ||
6573 | date is after the current time. | ||
6574 | .It Ar 10 X509_V_ERR_CERT_HAS_EXPIRED: certificate has expired | ||
6575 | The certificate has expired; that is, the | ||
6576 | .Em notAfter | ||
6577 | date is before the current time. | ||
6578 | .It Ar 11 X509_V_ERR_CRL_NOT_YET_VALID: CRL is not yet valid | ||
6579 | The CRL is not yet valid. | ||
6580 | Unused. | ||
6581 | .It Ar 12 X509_V_ERR_CRL_HAS_EXPIRED: CRL has expired | ||
6582 | The CRL has expired. | ||
6583 | Unused. | ||
6584 | .It Ar 13 X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD: format error in certificate's notBefore field | ||
6585 | The certificate | ||
6586 | .Em notBefore | ||
6587 | field contains an invalid time. | ||
6588 | .It Ar 14 X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD: format error in certificate's notAfter field | ||
6589 | The certificate | ||
6590 | .Em notAfter | ||
6591 | field contains an invalid time. | ||
6592 | .It Ar 15 X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD: format error in CRL's lastUpdate field | ||
6593 | The CRL | ||
6594 | .Em lastUpdate | ||
6595 | field contains an invalid time. | ||
6596 | Unused. | ||
6597 | .It Ar 16 X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD: format error in CRL's nextUpdate field | ||
6598 | The CRL | ||
6599 | .Em nextUpdate | ||
6600 | field contains an invalid time. | ||
6601 | Unused. | ||
6602 | .It Ar 17 X509_V_ERR_OUT_OF_MEM: out of memory | ||
6603 | An error occurred trying to allocate memory. | ||
6604 | This should never happen. | ||
6605 | .It Ar 18 X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT: self signed certificate | ||
6606 | The passed certificate is self-signed and the same certificate cannot be | ||
6607 | found in the list of trusted certificates. | ||
6608 | .It Ar 19 X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN: self signed certificate in certificate chain | ||
6609 | The certificate chain could be built up using the untrusted certificates but | ||
6610 | the root could not be found locally. | ||
6611 | .It Ar 20 X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY: unable to get local issuer certificate | ||
6612 | The issuer certificate of a locally looked up certificate could not be found. | ||
6613 | This normally means the list of trusted certificates is not complete. | ||
6614 | .It Ar 21 X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE: unable to verify the first certificate | ||
6615 | No signatures could be verified because the chain contains only one | ||
6616 | certificate and it is not self-signed. | ||
6617 | .It Ar 22 X509_V_ERR_CERT_CHAIN_TOO_LONG: certificate chain too long | ||
6618 | The certificate chain length is greater than the supplied maximum depth. | ||
6619 | Unused. | ||
6620 | .It Ar 23 X509_V_ERR_CERT_REVOKED: certificate revoked | ||
6621 | The certificate has been revoked. | ||
6622 | Unused. | ||
6623 | .It Ar 24 X509_V_ERR_INVALID_CA: invalid CA certificate | ||
6624 | A CA certificate is invalid. | ||
6625 | Either it is not a CA or its extensions are not consistent | ||
6626 | with the supplied purpose. | ||
6627 | .It Ar 25 X509_V_ERR_PATH_LENGTH_EXCEEDED: path length constraint exceeded | ||
6628 | The | ||
6629 | .Em basicConstraints | ||
6630 | pathlength parameter has been exceeded. | ||
6631 | .It Ar 26 X509_V_ERR_INVALID_PURPOSE: unsupported certificate purpose | ||
6632 | The supplied certificate cannot be used for the specified purpose. | ||
6633 | .It Ar 27 X509_V_ERR_CERT_UNTRUSTED: certificate not trusted | ||
6634 | The root CA is not marked as trusted for the specified purpose. | ||
6635 | .It Ar 28 X509_V_ERR_CERT_REJECTED: certificate rejected | ||
6636 | The root CA is marked to reject the specified purpose. | ||
6637 | .It Ar 29 X509_V_ERR_SUBJECT_ISSUER_MISMATCH: subject issuer mismatch | ||
6638 | The current candidate issuer certificate was rejected because its subject name | ||
6639 | did not match the issuer name of the current certificate. | ||
6640 | Only displayed when the | ||
6641 | .Fl issuer_checks | ||
6642 | option is set. | ||
6643 | .It Ar 30 X509_V_ERR_AKID_SKID_MISMATCH: authority and subject key identifier mismatch | ||
6644 | The current candidate issuer certificate was rejected because its subject key | ||
6645 | identifier was present and did not match the authority key identifier current | ||
6646 | certificate. | ||
6647 | Only displayed when the | ||
6648 | .Fl issuer_checks | ||
6649 | option is set. | ||
6650 | .It Ar 31 X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH: authority and issuer serial number mismatch | ||
6651 | The current candidate issuer certificate was rejected because its issuer name | ||
6652 | and serial number were present and did not match the authority key identifier | ||
6653 | of the current certificate. | ||
6654 | Only displayed when the | ||
6655 | .Fl issuer_checks | ||
6656 | option is set. | ||
6657 | .It Ar 32 X509_V_ERR_KEYUSAGE_NO_CERTSIGN:key usage does not include certificate signing | ||
6658 | The current candidate issuer certificate was rejected because its | ||
6659 | .Em keyUsage | ||
6660 | extension does not permit certificate signing. | ||
6661 | .It Ar 50 X509_V_ERR_APPLICATION_VERIFICATION: application verification failure | ||
6662 | An application specific error. | ||
6663 | Unused. | ||
6664 | .Ed | ||
6665 | .Sh VERIFY BUGS | ||
6666 | Although the issuer checks are a considerable improvement over the old | ||
6667 | technique, they still suffer from limitations in the underlying | ||
6668 | X509_LOOKUP API. | ||
6669 | One consequence of this is that trusted certificates with matching subject | ||
6670 | name must either appear in a file (as specified by the | ||
6671 | .Fl CAfile | ||
6672 | option) or a directory (as specified by | ||
6673 | .Fl CApath ) . | ||
6674 | If they occur in both, then only the certificates in the file will | ||
6675 | be recognised. | ||
6676 | .Pp | ||
6677 | Previous versions of | ||
6678 | .Nm OpenSSL | ||
6679 | assume certificates with matching subject name are identical and | ||
6680 | mishandled them. | ||
6681 | .\" | ||
6682 | .\" VERSION | ||
6683 | .\" | ||
6684 | .Sh VERSION | ||
6685 | .Nm openssl version | ||
6686 | .Op Fl a | ||
6687 | .Op Fl v | ||
6688 | .Op Fl b | ||
6689 | .Op Fl o | ||
6690 | .Op Fl f | ||
6691 | .Op Fl p | ||
6692 | .Pp | ||
6693 | The | ||
6694 | .Nm version | ||
6695 | command is used to print out version information about | ||
6696 | .Nm OpenSSL . | ||
6697 | .Pp | ||
6698 | The options are as follows: | ||
6699 | .Bd -ragged -offset indent | ||
6700 | .It Fl a | ||
6701 | All information: this is the same as setting all the other flags. | ||
6702 | .It Fl v | ||
6703 | The current | ||
6704 | .Nm OpenSSL | ||
6705 | version. | ||
6706 | .It Fl b | ||
6707 | The date the current version of | ||
6708 | .Nm OpenSSL | ||
6709 | was built. | ||
6710 | .It Fl o | ||
6711 | Option information: various options set when the library was built. | ||
6712 | .It Fl c | ||
6713 | Compilation flags. | ||
6714 | .It Fl p | ||
6715 | Platform setting. | ||
6716 | .It Fl d | ||
6717 | .Em OPENSSLDIR | ||
6718 | setting. | ||
6719 | .Ed | ||
6720 | .Sh VERSION NOTES | ||
6721 | The output of | ||
6722 | .Nm openssl version -a | ||
6723 | would typically be used when sending in a bug report. | ||
6724 | .Sh VERSION HISTORY | ||
6725 | The | ||
6726 | .Fl d | ||
6727 | option was added in | ||
6728 | .Nm OpenSSL | ||
6729 | 0.9.7. | ||
6730 | .\" | ||
6731 | .\" X509 | ||
6732 | .\" | ||
6733 | .Sh X509 | ||
6734 | .Nm openssl x509 | ||
6735 | .Bk -words | ||
6736 | .Op Fl inform Ar DER|PEM|NET | ||
6737 | .Op Fl outform Ar DER|PEM|NET | ||
6738 | .Op Fl keyform Ar DER|PEM | ||
6739 | .Op Fl CAform Ar DER|PEM | ||
6740 | .Op Fl CAkeyform Ar DER|PEM | ||
6741 | .Op Fl in Ar filename | ||
6742 | .Op Fl out Ar filename | ||
6743 | .Op Fl serial | ||
6744 | .Op Fl hash | ||
6745 | .Op Fl subject | ||
6746 | .Op Fl issuer | ||
6747 | .Op Fl nameopt Ar option | ||
6748 | .Op Fl email | ||
6749 | .Op Fl startdate | ||
6750 | .Op Fl enddate | ||
6751 | .Op Fl purpose | ||
6752 | .Op Fl dates | ||
6753 | .Op Fl modulus | ||
6754 | .Op Fl fingerprint | ||
6755 | .Op Fl alias | ||
6756 | .Op Fl noout | ||
6757 | .Op Fl trustout | ||
6758 | .Op Fl clrtrust | ||
6759 | .Op Fl clrreject | ||
6760 | .Op Fl addtrust Ar arg | ||
6761 | .Op Fl addreject Ar arg | ||
6762 | .Op Fl setalias Ar arg | ||
6763 | .Op Fl days Ar arg | ||
6764 | .Op Fl set_serial Ar n | ||
6765 | .Op Fl signkey Ar filename | ||
6766 | .Op Fl x509toreq | ||
6767 | .Op Fl req | ||
6768 | .Op Fl CA Ar filename | ||
6769 | .Op Fl CAkey Ar filename | ||
6770 | .Op Fl CAcreateserial | ||
6771 | .Op Fl CAserial Ar filename | ||
6772 | .Op Fl text | ||
6773 | .Op Fl C | ||
6774 | .Op Cm -md2|-md5|-sha1|-mdc2 | ||
6775 | .Op Fl clrext | ||
6776 | .Op Fl extfile Ar filename | ||
6777 | .Op Fl extensions Ar section | ||
6778 | .Ek | ||
6779 | .Pp | ||
6780 | The | ||
6781 | .Nm x509 | ||
6782 | command is a multi-purpose certificate utility. | ||
6783 | It can be used to display certificate information, convert certificates to | ||
6784 | various forms, sign certificate requests like a "mini CA" or edit | ||
6785 | certificate trust settings. | ||
6786 | .Pp | ||
6787 | Since there are a large number of options, they are split up into | ||
6788 | various sections. | ||
6789 | .Sh X509 INPUT, OUTPUT AND GENERAL PURPOSE OPTIONS | ||
6790 | .Bd -ragged -offset indent | ||
6791 | .It Fl inform Ar DER|PEM|NET | ||
6792 | This specifies the input format. | ||
6793 | Normally the command will expect an X509 certificate, | ||
6794 | but this can change if other options such as | ||
6795 | .Fl req | ||
6796 | are present. | ||
6797 | The | ||
6798 | .Ar DER | ||
6799 | format is the DER encoding of the certificate and | ||
6800 | .Ar PEM | ||
6801 | is the base64 encoding of the DER encoding with header and footer lines added. | ||
6802 | The | ||
6803 | .Ar NET | ||
6804 | option is an obscure Netscape server format that is now | ||
6805 | obsolete. | ||
6806 | .It Fl outform Ar DER|PEM|NET | ||
6807 | This specifies the output format; | ||
6808 | the options have the same meaning as the | ||
6809 | .Fl inform | ||
6810 | option. | ||
6811 | .It Fl in Ar filename | ||
6812 | This specifies the input | ||
6813 | .Ar filename | ||
6814 | to read a certificate from or standard input if this option is not specified. | ||
6815 | .It Fl out Ar filename | ||
6816 | This specifies the output | ||
6817 | .Ar filename | ||
6818 | to write to or standard output by default. | ||
6819 | .It Fl md2|-md5|-sha1|-mdc2 | ||
6820 | The digest to use. | ||
6821 | This affects any signing or display option that uses a message digest, | ||
6822 | such as the | ||
6823 | .Fl fingerprint , signkey | ||
6824 | and | ||
6825 | .Fl CA | ||
6826 | options. | ||
6827 | If not specified then MD5 is used. | ||
6828 | If the key being used to sign with is a DSA key then | ||
6829 | this option has no effect: SHA1 is always used with DSA keys. | ||
6830 | .Ed | ||
6831 | .Sh X509 DISPLAY OPTIONS | ||
6832 | .Sy Note : | ||
6833 | The | ||
6834 | .Fl alias | ||
6835 | and | ||
6836 | .Fl purpose | ||
6837 | options are also display options but are described in the | ||
6838 | .Sx X509 TRUST OPTIONS | ||
6839 | section. | ||
6840 | .Bd -ragged -offset indent | ||
6841 | .It Fl text | ||
6842 | Prints out the certificate in text form. | ||
6843 | Full details are output including the public key, signature algorithms, | ||
6844 | issuer and subject names, serial number, any extensions present and any | ||
6845 | trust settings. | ||
6846 | .It Fl certopt Ar option | ||
6847 | Customise the output format used with | ||
6848 | .Fl text . | ||
6849 | The | ||
6850 | .Ar option | ||
6851 | argument can be a single option or multiple options separated by commas. | ||
6852 | The | ||
6853 | .Fl certopt | ||
6854 | switch may be also be used more than once to set multiple options. | ||
6855 | See the | ||
6856 | .Sx X509 TEXT OPTIONS | ||
6857 | section for more information. | ||
6858 | .It Fl noout | ||
6859 | This option prevents output of the encoded version of the request. | ||
6860 | .It Fl modulus | ||
6861 | This option prints out the value of the modulus of the public key | ||
6862 | contained in the certificate. | ||
6863 | .It Fl serial | ||
6864 | Outputs the certificate serial number. | ||
6865 | .It Fl hash | ||
6866 | Outputs the "hash" of the certificate subject name. | ||
6867 | This is used in | ||
6868 | .Nm OpenSSL | ||
6869 | to form an index to allow certificates in a directory to be looked up | ||
6870 | by subject name. | ||
6871 | .It Fl subject | ||
6872 | Outputs the subject name. | ||
6873 | .It Fl issuer | ||
6874 | Outputs the issuer name. | ||
6875 | .It Fl nameopt Ar option | ||
6876 | Option which determines how the subject or issuer names are displayed. | ||
6877 | The | ||
6878 | .Ar option | ||
6879 | argument can be a single option or multiple options separated by commas. | ||
6880 | Alternatively, the | ||
6881 | .Fl nameopt | ||
6882 | switch may be used more than once to set multiple options. | ||
6883 | See the | ||
6884 | .Sx X509 NAME OPTIONS | ||
6885 | section for more information. | ||
6886 | .It Fl email | ||
6887 | Outputs the email address(es) if any. | ||
6888 | .It Fl startdate | ||
6889 | Prints out the start date of the certificate; that is, the | ||
6890 | .Em notBefore | ||
6891 | date. | ||
6892 | .It Fl enddate | ||
6893 | Prints out the expiry date of the certificate; that is, the | ||
6894 | .Em notAfter | ||
6895 | date. | ||
6896 | .It Fl dates | ||
6897 | Prints out the start and expiry dates of a certificate. | ||
6898 | .It Fl fingerprint | ||
6899 | Prints out the digest of the DER encoded version of the whole certificate | ||
6900 | (see | ||
6901 | .Sx DIGEST OPTIONS ) . | ||
6902 | .It Fl C | ||
6903 | This outputs the certificate in the form of a C source file. | ||
6904 | .Ed | ||
6905 | .Sh X509 TRUST SETTINGS | ||
6906 | Please note these options are currently experimental and may well change. | ||
6907 | .Pp | ||
6908 | A | ||
6909 | .Em trusted certificate | ||
6910 | is an ordinary certificate which has several | ||
6911 | additional pieces of information attached to it such as the permitted | ||
6912 | and prohibited uses of the certificate and an "alias". | ||
6913 | .Pp | ||
6914 | Normally when a certificate is being verified at least one certificate | ||
6915 | must be "trusted". | ||
6916 | By default a trusted certificate must be stored | ||
6917 | locally and must be a root CA: any certificate chain ending in this CA | ||
6918 | is then usable for any purpose. | ||
6919 | .Pp | ||
6920 | Trust settings currently are only used with a root CA. | ||
6921 | They allow a finer control over the purposes the root CA can be used for. | ||
6922 | For example, a CA may be trusted for an SSL client but not for | ||
6923 | SSL server use. | ||
6924 | .Pp | ||
6925 | See the description of the | ||
6926 | .Nm verify | ||
6927 | utility for more information on the meaning of trust settings. | ||
6928 | .Pp | ||
6929 | Future versions of | ||
6930 | .Nm OpenSSL | ||
6931 | will recognize trust settings on any certificate: not just root CAs. | ||
6932 | .Bd -ragged -offset indent | ||
6933 | .It Fl trustout | ||
6934 | This causes | ||
6935 | .Nm x509 | ||
6936 | to output a | ||
6937 | .Em trusted certificate . | ||
6938 | An ordinary or trusted certificate can be input, but by default an ordinary | ||
6939 | certificate is output and any trust settings are discarded. | ||
6940 | With the | ||
6941 | .Fl trustout | ||
6942 | option a trusted certificate is output. | ||
6943 | A trusted certificate is automatically output if any trust settings | ||
6944 | are modified. | ||
6945 | .It Fl setalias Ar arg | ||
6946 | Sets the alias of the certificate. | ||
6947 | This will allow the certificate to be referred to using a nickname, | ||
6948 | for example "Steve's Certificate". | ||
6949 | .It Fl alias | ||
6950 | Outputs the certificate alias, if any. | ||
6951 | .It Fl clrtrust | ||
6952 | Clears all the permitted or trusted uses of the certificate. | ||
6953 | .It Fl clrreject | ||
6954 | Clears all the prohibited or rejected uses of the certificate. | ||
6955 | .It Fl addtrust Ar arg | ||
6956 | Adds a trusted certificate use. | ||
6957 | Any object name can be used here, but currently only | ||
6958 | .Ar clientAuth | ||
6959 | .Po Em SSL | ||
6960 | client use | ||
6961 | .Pc , | ||
6962 | .Ar serverAuth | ||
6963 | .Po Em SSL | ||
6964 | server use | ||
6965 | .Pc | ||
6966 | and | ||
6967 | .Ar emailProtection | ||
6968 | .Po Em S/MIME | ||
6969 | |||
6970 | .Pc | ||
6971 | are used. | ||
6972 | Other | ||
6973 | .Nm OpenSSL | ||
6974 | applications may define additional uses. | ||
6975 | .It Fl addreject Ar arg | ||
6976 | Adds a prohibited use. | ||
6977 | It accepts the same values as the | ||
6978 | .Fl addtrust | ||
6979 | option. | ||
6980 | .It Fl purpose | ||
6981 | This option performs tests on the certificate extensions and outputs | ||
6982 | the results. | ||
6983 | For a more complete description see the | ||
6984 | .Sx X509 CERTIFICATE EXTENSIONS | ||
6985 | section. | ||
6986 | .Ed | ||
6987 | .Sh X509 SIGNING OPTIONS | ||
6988 | The | ||
6989 | .Nm x509 | ||
6990 | utility can be used to sign certificates and requests: it | ||
6991 | can thus behave like a "mini CA". | ||
6992 | .Pp | ||
6993 | .Bd -ragged -offset indent | ||
6994 | .It Fl signkey Ar filename | ||
6995 | This option causes the input file to be self-signed using the supplied | ||
6996 | private key. | ||
6997 | .Pp | ||
6998 | If the input file is a certificate, it sets the issuer name to the | ||
6999 | subject name (i.e. makes it self-signed), changes the public key to the | ||
7000 | supplied value and changes the start and end dates. | ||
7001 | The start date is set to the current time and the end date is set to | ||
7002 | a value determined by the | ||
7003 | .Fl days | ||
7004 | option. | ||
7005 | Any certificate extensions are retained unless the | ||
7006 | .Fl clrext | ||
7007 | option is supplied. | ||
7008 | .Pp | ||
7009 | If the input is a certificate request, then a self-signed certificate | ||
7010 | is created using the supplied private key using the subject name in | ||
7011 | the request. | ||
7012 | .It Fl clrext | ||
7013 | Delete any extensions from a certificate. | ||
7014 | This option is used when a certificate is being created from another | ||
7015 | certificate (for example with the | ||
7016 | .Fl signkey | ||
7017 | or the | ||
7018 | .Fl CA | ||
7019 | options). | ||
7020 | Normally all extensions are retained. | ||
7021 | .It Fl keyform Ar PEM|DER | ||
7022 | Specifies the format | ||
7023 | .Po Em DER | ||
7024 | or | ||
7025 | .Em PEM | ||
7026 | .Pc | ||
7027 | of the private key file used in the | ||
7028 | .Fl signkey | ||
7029 | option. | ||
7030 | .It Fl days Ar arg | ||
7031 | Specifies the number of days to make a certificate valid for. | ||
7032 | The default is 30 days. | ||
7033 | .It Fl x509toreq | ||
7034 | Converts a certificate into a certificate request. | ||
7035 | The | ||
7036 | .Fl signkey | ||
7037 | option is used to pass the required private key. | ||
7038 | .It Fl req | ||
7039 | By default a certificate is expected on input. | ||
7040 | With this option a certificate request is expected instead. | ||
7041 | .It Fl set_serial Ar n | ||
7042 | Specifies the serial number to use. | ||
7043 | This option can be used with either the | ||
7044 | .Fl signkey | ||
7045 | or | ||
7046 | .Fl CA | ||
7047 | options. | ||
7048 | If used in conjunction with the | ||
7049 | .Fl CA | ||
7050 | option, the serial number file (as specified by the | ||
7051 | .Fl CAserial | ||
7052 | or | ||
7053 | .Fl CAcreateserial | ||
7054 | options) is not used. | ||
7055 | .Pp | ||
7056 | The serial number can be decimal or hex (if preceded by | ||
7057 | .Em 0x ) . | ||
7058 | Negative serial numbers can also be specified but their use is not recommended. | ||
7059 | .It Fl CA Ar filename | ||
7060 | Specifies the CA certificate to be used for signing. | ||
7061 | When this option is present | ||
7062 | .Nm x509 | ||
7063 | behaves like a "mini CA". | ||
7064 | The input file is signed by the CA using this option; | ||
7065 | that is, its issuer name is set to the subject name of the CA and it is | ||
7066 | digitally signed using the CAs private key. | ||
7067 | .Pp | ||
7068 | This option is normally combined with the | ||
7069 | .Fl req | ||
7070 | option. | ||
7071 | Without the | ||
7072 | .Fl req | ||
7073 | option, the input is a certificate which must be self-signed. | ||
7074 | .It Fl CAkey Ar filename | ||
7075 | Sets the CA private key to sign a certificate with. | ||
7076 | If this option is not specified then it is assumed that the CA private key | ||
7077 | is present in the CA certificate file. | ||
7078 | .It Fl CAserial Ar filename | ||
7079 | Sets the CA serial number file to use. | ||
7080 | .Pp | ||
7081 | When the | ||
7082 | .Fl CA | ||
7083 | option is used to sign a certificate it uses a serial | ||
7084 | number specified in a file. | ||
7085 | This file consist of one line containing an even number of hex digits | ||
7086 | with the serial number to use. | ||
7087 | After each use the serial number is incremented and written out | ||
7088 | to the file again. | ||
7089 | .Pp | ||
7090 | The default filename consists of the CA certificate file base name with | ||
7091 | .Pa .srl | ||
7092 | appended. | ||
7093 | For example if the CA certificate file is called | ||
7094 | .Pa mycacert.pem , | ||
7095 | it expects to find a serial number file called | ||
7096 | .Pa mycacert.srl . | ||
7097 | .It Fl CAcreateserial Ar filename | ||
7098 | With this option the CA serial number file is created if it does not exist: | ||
7099 | it will contain the serial number "02" and the certificate being signed will | ||
7100 | have 1 as its serial number. | ||
7101 | Normally if the | ||
7102 | .Fl CA | ||
7103 | option is specified and the serial number file does not exist it is an error. | ||
7104 | .It Fl extfile Ar filename | ||
7105 | File containing certificate extensions to use. | ||
7106 | If not specified, then no extensions are added to the certificate. | ||
7107 | .It Fl extensions Ar section | ||
7108 | The section to add certificate extensions from. | ||
7109 | If this option is not specified then the extensions should either be | ||
7110 | contained in the unnamed (default) section or the default section should | ||
7111 | contain a variable called "extensions" which contains the section to use. | ||
7112 | .Ed | ||
7113 | .Sh X509 NAME OPTIONS | ||
7114 | The | ||
7115 | .Fl nameopt | ||
7116 | command line switch determines how the subject and issuer | ||
7117 | names are displayed. | ||
7118 | If no | ||
7119 | .Fl nameopt | ||
7120 | switch is present, the default "oneline" | ||
7121 | format is used which is compatible with previous versions of | ||
7122 | .Nm OpenSSL . | ||
7123 | Each option is described in detail below, all options can be preceded by | ||
7124 | a | ||
7125 | .Cm \&- | ||
7126 | to turn the option off. | ||
7127 | Only the first four will normally be used. | ||
7128 | .Bd -ragged -offset indent | ||
7129 | .It Ar compat | ||
7130 | Use the old format. | ||
7131 | This is equivalent to specifying no name options at all. | ||
7132 | .It Ar RFC2253 | ||
7133 | Displays names compatible with RFC2253; equivalent to | ||
7134 | .Ar esc_2253 , esc_ctrl , | ||
7135 | .Ar esc_msb , utf8 , dump_nostr , dump_unknown , | ||
7136 | .Ar dump_der , sep_comma_plus , dn_rev and sname . | ||
7137 | .It Ar oneline | ||
7138 | A oneline format which is more readable than RFC2253. | ||
7139 | It is equivalent to specifying the | ||
7140 | .Ar esc_2253 , esc_ctrl , esc_msb , utf8 , | ||
7141 | .Ar dump_nostr , dump_der , use_quote , sep_comma_plus_spc , | ||
7142 | .Ar spc_eq | ||
7143 | and | ||
7144 | .Ar sname | ||
7145 | options. | ||
7146 | .It Ar multiline | ||
7147 | A multiline format. | ||
7148 | It is equivalent to | ||
7149 | .Ar esc_ctrl , esc_msb , sep_multiline , | ||
7150 | .Ar spc_eq , lname | ||
7151 | and | ||
7152 | .Ar align . | ||
7153 | .It Ar esc_2253 | ||
7154 | Escape the "special" characters required by RFC2253 in a field that is | ||
7155 | .Cm \& ,+"<>; . | ||
7156 | Additionally, | ||
7157 | .Cm \&# | ||
7158 | is escaped at the beginning of a string | ||
7159 | and a space character at the beginning or end of a string. | ||
7160 | .It Ar esc_ctrl | ||
7161 | Escape control characters. | ||
7162 | That is, those with ASCII values less than | ||
7163 | 0x20 (space) and the delete (0x7f) character. | ||
7164 | They are escaped using the RFC2253 \eXX notation (where XX are two hex | ||
7165 | digits representing the character value). | ||
7166 | .It Ar esc_msb | ||
7167 | Escape characters with the MSB set; that is, with ASCII values larger than | ||
7168 | 127. | ||
7169 | .It Ar use_quote | ||
7170 | Escapes some characters by surrounding the whole string with | ||
7171 | .Cm \&" | ||
7172 | characters. | ||
7173 | Without the option, all escaping is done with the | ||
7174 | .Cm \&\e | ||
7175 | character. | ||
7176 | .It Ar utf8 | ||
7177 | Convert all strings to UTF8 format first. | ||
7178 | This is required by RFC2253. | ||
7179 | If you are lucky enough to have a UTF8 compatible terminal then the use | ||
7180 | of this option (and | ||
7181 | .Em not | ||
7182 | setting | ||
7183 | .Ar esc_msb ) | ||
7184 | may result in the correct display of multibyte (international) characters. | ||
7185 | If this option is not present, then multibyte characters larger than 0xff | ||
7186 | will be represented using the format \eUXXXX for 16 bits and \eWXXXXXXXX | ||
7187 | for 32 bits. | ||
7188 | Also, if this option is off, any UTF8Strings will be converted to their | ||
7189 | character form first. | ||
7190 | .It Ar no_type | ||
7191 | This option does not attempt to interpret multibyte characters in any | ||
7192 | way. | ||
7193 | That is, their content octets are merely dumped as though one octet | ||
7194 | represents each character. | ||
7195 | This is useful for diagnostic purposes but will result in rather odd | ||
7196 | looking output. | ||
7197 | .It Ar show_type | ||
7198 | Show the type of the ASN1 character string. | ||
7199 | The type precedes the field contents. | ||
7200 | For example "BMPSTRING: Hello World". | ||
7201 | .It Ar dump_der | ||
7202 | When this option is set, any fields that need to be hexdumped will | ||
7203 | be dumped using the DER encoding of the field. | ||
7204 | Otherwise just the content octets will be displayed. | ||
7205 | Both options use the RFC2253 #XXXX... format. | ||
7206 | .It Ar dump_nostr | ||
7207 | Dump non-character string types (for example OCTET STRING); if this | ||
7208 | option is not set then non-character string types will be displayed | ||
7209 | as though each content octet represents a single character. | ||
7210 | .It Ar dump_all | ||
7211 | Dump all fields. | ||
7212 | This option, when used with | ||
7213 | .Ar dump_der , | ||
7214 | allows the DER encoding of the structure to be unambiguously determined. | ||
7215 | .It Ar dump_unknown | ||
7216 | Dump any field whose OID is not recognised by | ||
7217 | .Nm OpenSSL . | ||
7218 | .It Ar sep_comma_plus , sep_comma_plus_space , sep_semi_plus_space , sep_multiline | ||
7219 | These options determine the field separators. | ||
7220 | The first character is between RDNs and the second between multiple AVAs | ||
7221 | (multiple AVAs are very rare and their use is discouraged). | ||
7222 | The options ending in "space" additionally place a space after the | ||
7223 | separator to make it more readable. | ||
7224 | The | ||
7225 | .Ar sep_multiline | ||
7226 | uses a linefeed character for the RDN separator and a spaced | ||
7227 | .Cm \&+ | ||
7228 | for the AVA separator. | ||
7229 | It also indents the fields by four characters. | ||
7230 | .It Ar dn_rev | ||
7231 | Reverse the fields of the DN. | ||
7232 | This is required by RFC2253. | ||
7233 | As a side effect, this also reverses the order of multiple AVAs but this is | ||
7234 | permissible. | ||
7235 | .It Ar nofname , sname , lname , oid | ||
7236 | These options alter how the field name is displayed. | ||
7237 | .Ar nofname | ||
7238 | does not display the field at all. | ||
7239 | .Ar sname | ||
7240 | uses the "short name" form (CN for | ||
7241 | .Ar commonName , | ||
7242 | for example). | ||
7243 | .Ar lname | ||
7244 | uses the long form. | ||
7245 | .Ar oid | ||
7246 | represents the OID in numerical form and is useful for diagnostic purpose. | ||
7247 | .It Ar align | ||
7248 | Align field values for a more readable output. | ||
7249 | Only usable with | ||
7250 | .Ar sep_multiline . | ||
7251 | .It Ar spc_eq | ||
7252 | Places spaces round the | ||
7253 | .Cm \&= | ||
7254 | character which follows the field name. | ||
7255 | .Ed | ||
7256 | .Sh X509 TEXT OPTIONS | ||
7257 | As well as customising the name output format, it is also possible to | ||
7258 | customise the actual fields printed using the | ||
7259 | .Fl certopt | ||
7260 | options when the | ||
7261 | .Fl text | ||
7262 | option is present. | ||
7263 | The default behaviour is to print all fields. | ||
7264 | .Bd -ragged -offset indent | ||
7265 | .It Ar compatible | ||
7266 | Use the old format. | ||
7267 | This is equivalent to specifying no output options at all. | ||
7268 | .It Ar no_header | ||
7269 | Don't print header information: that is, the lines saying "Certificate" | ||
7270 | and "Data". | ||
7271 | .It Ar no_version | ||
7272 | Don't print out the version number. | ||
7273 | .It Ar no_serial | ||
7274 | Don't print out the serial number. | ||
7275 | .It Ar no_signame | ||
7276 | Don't print out the signature algorithm used. | ||
7277 | .It Ar no_validity | ||
7278 | Don't print the validity; that is, the | ||
7279 | .Em notBefore | ||
7280 | and | ||
7281 | .Em notAfter | ||
7282 | fields. | ||
7283 | .It Ar no_subject | ||
7284 | Don't print out the subject name. | ||
7285 | .It Ar no_issuer | ||
7286 | Don't print out the issuer name. | ||
7287 | .It Ar no_pubkey | ||
7288 | Don't print out the public key. | ||
7289 | .It Ar no_sigdump | ||
7290 | Don't give a hexadecimal dump of the certificate signature. | ||
7291 | .It Ar no_aux | ||
7292 | Don't print out certificate trust information. | ||
7293 | .It Ar no_extensions | ||
7294 | Don't print out any X509V3 extensions. | ||
7295 | .It Ar ext_default | ||
7296 | Retain default extension behaviour: attempt to print out unsupported | ||
7297 | certificate extensions. | ||
7298 | .It Ar ext_error | ||
7299 | Print an error message for unsupported certificate extensions. | ||
7300 | .It Ar ext_parse | ||
7301 | ASN1 parse unsupported extensions. | ||
7302 | .It Ar ext_dump | ||
7303 | Hex dump unsupported extensions. | ||
7304 | .It Ar ca_default | ||
7305 | The value used by the | ||
7306 | .Nm ca | ||
7307 | utility, equivalent to | ||
7308 | .Ar no_issuer , no_pubkey , no_header , | ||
7309 | .Ar no_version , no_sigdump | ||
7310 | and | ||
7311 | .Ar no_signame . | ||
7312 | .Ed | ||
7313 | .Sh X509 EXAMPLES | ||
7314 | .Sy Note : | ||
7315 | In these examples the '\e' means the example should be all on one | ||
7316 | line. | ||
7317 | .Pp | ||
7318 | Display the contents of a certificate: | ||
7319 | .Pp | ||
7320 | \& $ openssl x509 -in cert.pem -noout -text | ||
7321 | .Pp | ||
7322 | Display the certificate serial number: | ||
7323 | .Pp | ||
7324 | \& $ openssl x509 -in cert.pem -noout -serial | ||
7325 | .Pp | ||
7326 | Display the certificate subject name: | ||
7327 | .Pp | ||
7328 | \& $ openssl x509 -in cert.pem -noout -subject | ||
7329 | .Pp | ||
7330 | Display the certificate subject name in RFC2253 form: | ||
7331 | .Pp | ||
7332 | \& $ openssl x509 -in cert.pem -noout -subject -nameopt RFC2253 | ||
7333 | .Pp | ||
7334 | Display the certificate subject name in oneline form on a terminal | ||
7335 | supporting UTF8: | ||
7336 | .Pp | ||
7337 | \& $ openssl x509 -in cert.pem -noout -subject -nameopt oneline,-escmsb | ||
7338 | .Pp | ||
7339 | Display the certificate MD5 fingerprint: | ||
7340 | .Pp | ||
7341 | \& $ openssl x509 -in cert.pem -noout -fingerprint | ||
7342 | .Pp | ||
7343 | Display the certificate SHA1 fingerprint: | ||
7344 | .Pp | ||
7345 | \& $ openssl x509 -sha1 -in cert.pem -noout -fingerprint | ||
7346 | .Pp | ||
7347 | Convert a certificate from | ||
7348 | .Em PEM | ||
7349 | to | ||
7350 | .Em DER | ||
7351 | format: | ||
7352 | .Pp | ||
7353 | \& $ openssl x509 -in cert.pem -inform PEM -out cert.der -outform DER | ||
7354 | .Pp | ||
7355 | Convert a certificate to a certificate request: | ||
7356 | .Pp | ||
7357 | \& $ openssl x509 -x509toreq -in cert.pem -out req.pem -signkey key.pem | ||
7358 | .Pp | ||
7359 | Convert a certificate request into a self-signed certificate using | ||
7360 | extensions for a CA: | ||
7361 | .Pp | ||
7362 | .Bd -literal | ||
7363 | \& $ openssl x509 -req -in careq.pem -extfile openssl.cnf -extensions \e | ||
7364 | \& v3_ca -signkey key.pem -out cacert.pem | ||
7365 | .Ed | ||
7366 | .Pp | ||
7367 | Sign a certificate request using the CA certificate above and add user | ||
7368 | certificate extensions: | ||
7369 | .Pp | ||
7370 | .Bd -literal | ||
7371 | \& $ openssl x509 -req -in req.pem -extfile openssl.cnf -extensions \e | ||
7372 | v3_usr -CA cacert.pem -CAkey key.pem -CAcreateserial | ||
7373 | .Ed | ||
7374 | .Pp | ||
7375 | Set a certificate to be trusted for SSL | ||
7376 | client use and change set its alias to "Steve's Class 1 CA": | ||
7377 | .Pp | ||
7378 | .Bd -literal | ||
7379 | \& $ openssl x509 -in cert.pem -addtrust sslclient \e | ||
7380 | \& -alias "Steve's Class 1 CA" -out trust.pem | ||
7381 | .Ed | ||
7382 | .Sh X509 NOTES | ||
7383 | The | ||
7384 | .Em PEM | ||
7385 | format uses the header and footer lines: | ||
7386 | .Pp | ||
7387 | .Bd -literal | ||
7388 | \& -----BEGIN CERTIFICATE---- | ||
7389 | \& -----END CERTIFICATE---- | ||
7390 | .Ed | ||
7391 | .Pp | ||
7392 | It will also handle files containing: | ||
7393 | .Pp | ||
7394 | .Bd -literal | ||
7395 | \& -----BEGIN X509 CERTIFICATE---- | ||
7396 | \& -----END X509 CERTIFICATE---- | ||
7397 | .Ed | ||
7398 | .Pp | ||
7399 | Trusted certificates have the lines: | ||
7400 | .Pp | ||
7401 | .Bd -literal | ||
7402 | \& -----BEGIN TRUSTED CERTIFICATE---- | ||
7403 | \& -----END TRUSTED CERTIFICATE---- | ||
7404 | .Ed | ||
7405 | .Pp | ||
7406 | The conversion to UTF8 format used with the name options assumes that | ||
7407 | T61Strings use the ISO8859-1 character set. | ||
7408 | This is wrong, but Netscape and MSIE do this, as do many certificates. | ||
7409 | So although this is incorrect | ||
7410 | it is more likely to display the majority of certificates correctly. | ||
7411 | .Pp | ||
7412 | The | ||
7413 | .Fl fingerprint | ||
7414 | option takes the digest of the DER encoded certificate. | ||
7415 | This is commonly called a "fingerprint". | ||
7416 | Because of the nature of message digests, the fingerprint of a certificate | ||
7417 | is unique to that certificate and two certificates with the same fingerprint | ||
7418 | can be considered to be the same. | ||
7419 | .Pp | ||
7420 | The Netscape fingerprint uses MD5, whereas MSIE uses SHA1. | ||
7421 | .Pp | ||
7422 | The | ||
7423 | .Fl email | ||
7424 | option searches the subject name and the subject alternative | ||
7425 | name extension. | ||
7426 | Only unique email addresses will be printed out: it will | ||
7427 | not print the same address more than once. | ||
7428 | .Sh X509 CERTIFICATE EXTENSIONS | ||
7429 | The | ||
7430 | .Fl purpose | ||
7431 | option checks the certificate extensions and determines | ||
7432 | what the certificate can be used for. | ||
7433 | The actual checks done are rather | ||
7434 | complex and include various hacks and workarounds to handle broken | ||
7435 | certificates and software. | ||
7436 | .Pp | ||
7437 | The same code is used when verifying untrusted certificates in chains, | ||
7438 | so this section is useful if a chain is rejected by the verify code. | ||
7439 | .Pp | ||
7440 | The | ||
7441 | .Em basicConstraints | ||
7442 | extension CA flag is used to determine whether the | ||
7443 | certificate can be used as a CA. | ||
7444 | If the CA flag is true then it is a CA, | ||
7445 | if the CA flag is false then it is not a CA. | ||
7446 | .Em All | ||
7447 | CAs should have the CA flag set to true. | ||
7448 | .Pp | ||
7449 | If the | ||
7450 | .Em basicConstraints | ||
7451 | extension is absent then the certificate is | ||
7452 | considered to be a "possible CA"; other extensions are checked according | ||
7453 | to the intended use of the certificate. | ||
7454 | A warning is given in this case because the certificate should really not | ||
7455 | be regarded as a CA: however, | ||
7456 | it is allowed to be a CA to work around some broken software. | ||
7457 | .Pp | ||
7458 | If the certificate is a V1 certificate (and thus has no extensions) and | ||
7459 | it is self-signed, it is also assumed to be a CA but a warning is again | ||
7460 | given: this is to work around the problem of Verisign roots which are V1 | ||
7461 | self-signed certificates. | ||
7462 | .Pp | ||
7463 | If the | ||
7464 | .Em keyUsage | ||
7465 | extension is present, then additional restraints are | ||
7466 | made on the uses of the certificate. | ||
7467 | A CA certificate | ||
7468 | .Em must | ||
7469 | have the | ||
7470 | .Em keyCertSign | ||
7471 | bit set if the | ||
7472 | .Em keyUsage | ||
7473 | extension is present. | ||
7474 | .Pp | ||
7475 | The extended key usage extension places additional restrictions on the | ||
7476 | certificate uses. | ||
7477 | If this extension is present (whether critical or not) | ||
7478 | the key can only be used for the purposes specified. | ||
7479 | .Pp | ||
7480 | A complete description of each test is given below. | ||
7481 | The comments about | ||
7482 | .Em basicConstraints | ||
7483 | and | ||
7484 | .Em keyUsage | ||
7485 | and V1 certificates above apply to | ||
7486 | .Em all | ||
7487 | CA certificates. | ||
7488 | .Pp | ||
7489 | .Bd -ragged -offset indent | ||
7490 | .It Ar SSL Client | ||
7491 | The extended key usage extension must be absent or include the | ||
7492 | "web client authentication" OID. | ||
7493 | .Ar keyUsage | ||
7494 | must be absent or it must have the | ||
7495 | .Em digitalSignature | ||
7496 | bit set. | ||
7497 | Netscape certificate type must be absent or it must have the SSL | ||
7498 | client bit set. | ||
7499 | .It Ar SSL Client CA | ||
7500 | The extended key usage extension must be absent or include the | ||
7501 | "web client authentication" OID. | ||
7502 | Netscape certificate type must be absent or it must have the SSL CA | ||
7503 | bit set: this is used as a work around if the | ||
7504 | .Em basicConstraints | ||
7505 | extension is absent. | ||
7506 | .It Ar SSL Server | ||
7507 | The extended key usage extension must be absent or include the | ||
7508 | "web server authentication" and/or one of the SGC OIDs. | ||
7509 | .Em keyUsage | ||
7510 | must be absent or it must have the | ||
7511 | .Em digitalSignature | ||
7512 | set, the | ||
7513 | .Em keyEncipherment | ||
7514 | set, or both bits set. | ||
7515 | Netscape certificate type must be absent or have the SSL server bit set. | ||
7516 | .It Ar SSL Server CA | ||
7517 | The extended key usage extension must be absent or include the | ||
7518 | "web server authentication" and/or one of the SGC OIDs. | ||
7519 | Netscape certificate type must be absent or the SSL CA | ||
7520 | bit must be set: this is used as a work around if the | ||
7521 | .Em basicConstraints | ||
7522 | extension is absent. | ||
7523 | .It Ar Netscape SSL Server | ||
7524 | For Netscape SSL clients to connect to an SSL server; it must have the | ||
7525 | .Em keyEncipherment | ||
7526 | bit set if the | ||
7527 | .Em keyUsage | ||
7528 | extension is present. | ||
7529 | This isn't always valid because some cipher suites use the key for | ||
7530 | digital signing. | ||
7531 | Otherwise it is the same as a normal SSL server. | ||
7532 | .It Ar Common S/MIME Client Tests | ||
7533 | The extended key usage extension must be absent or include the | ||
7534 | "email protection" OID. | ||
7535 | Netscape certificate type must be absent or should have the | ||
7536 | .Em S/MIME | ||
7537 | bit set. | ||
7538 | If the | ||
7539 | .Em S/MIME | ||
7540 | bit is not set in netscape certificate type, then the SSL | ||
7541 | client bit is tolerated as an alternative but a warning is shown: | ||
7542 | this is because some Verisign certificates don't set the | ||
7543 | .Em S/MIME | ||
7544 | bit. | ||
7545 | .It Ar S/MIME Signing | ||
7546 | In addition to the common | ||
7547 | .Em S/MIME | ||
7548 | client tests, the | ||
7549 | .Em digitalSignature | ||
7550 | bit must be set if the | ||
7551 | .Em keyUsage | ||
7552 | extension is present. | ||
7553 | .It Ar S/MIME Encryption | ||
7554 | In addition to the common | ||
7555 | .Em S/MIME | ||
7556 | tests, the | ||
7557 | .Em keyEncipherment | ||
7558 | bit must be set if the | ||
7559 | .Em keyUsage | ||
7560 | extension is present. | ||
7561 | .It Ar S/MIME CA | ||
7562 | The extended key usage extension must be absent or include the | ||
7563 | "email protection" OID. | ||
7564 | Netscape certificate type must be absent or must have the | ||
7565 | .Em S/MIME CA | ||
7566 | bit set: this is used as a work around if the | ||
7567 | .Em basicConstraints | ||
7568 | extension is absent. | ||
7569 | .It Ar CRL Signing | ||
7570 | The | ||
7571 | .Em keyUsage | ||
7572 | extension must be absent or it must have the | ||
7573 | .Em CRL | ||
7574 | signing bit set. | ||
7575 | .It Ar CRL Signing CA | ||
7576 | The normal CA tests apply. | ||
7577 | Except in this case the | ||
7578 | .Em basicConstraints | ||
7579 | extension must be present. | ||
7580 | .Sh X509 BUGS | ||
7581 | Extensions in certificates are not transferred to certificate requests and | ||
7582 | vice versa. | ||
7583 | .Pp | ||
7584 | It is possible to produce invalid certificates or requests by specifying the | ||
7585 | wrong private key or using inconsistent options in some cases: these should | ||
7586 | be checked. | ||
7587 | .Pp | ||
7588 | There should be options to explicitly set such things as start and end dates, | ||
7589 | rather than an offset from the current time. | ||
7590 | .Pp | ||
7591 | The code to implement the verify behaviour described in the | ||
7592 | .Sx X509 TRUST SETTINGS | ||
7593 | is currently being developed. | ||
7594 | It thus describes the intended behaviour rather than the current behaviour. | ||
7595 | It is hoped that it will represent reality in | ||
7596 | .Nm OpenSSL | ||
7597 | 0.9.5 and later. | ||
7598 | .\" | ||
7599 | .\" OPENSSL HISTORY | ||
7600 | .\" | ||
7601 | .Sh "HISTORY" | ||
7602 | The | ||
7603 | .Xr openssl 1 | ||
7604 | document appeared in | ||
7605 | .Nm OpenSSL | ||
7606 | 0.9.2. | ||
7607 | The | ||
7608 | .Cm list- Ns Ar XXX Ns Cm -commands | ||
7609 | pseudo-commands were added in | ||
7610 | .Nm OpenSSL | ||
7611 | 0.9.3; | ||
7612 | the | ||
7613 | .Cm no- Ns Ar XXX | ||
7614 | pseudo-commands were added in | ||
7615 | .Nm OpenSSL | ||
7616 | 0.9.5a. | ||