]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - secure/lib/libcrypto/man/x509.1
This commit was generated by cvs2svn to compensate for changes in r102644,
[FreeBSD/FreeBSD.git] / secure / lib / libcrypto / man / x509.1
1 .\" Automatically generated by Pod::Man version 1.15
2 .\" Tue Jul 30 09:21:00 2002
3 .\"
4 .\" Standard preamble:
5 .\" ======================================================================
6 .de Sh \" Subsection heading
7 .br
8 .if t .Sp
9 .ne 5
10 .PP
11 \fB\\$1\fR
12 .PP
13 ..
14 .de Sp \" Vertical space (when we can't use .PP)
15 .if t .sp .5v
16 .if n .sp
17 ..
18 .de Ip \" List item
19 .br
20 .ie \\n(.$>=3 .ne \\$3
21 .el .ne 3
22 .IP "\\$1" \\$2
23 ..
24 .de Vb \" Begin verbatim text
25 .ft CW
26 .nf
27 .ne \\$1
28 ..
29 .de Ve \" End verbatim text
30 .ft R
31
32 .fi
33 ..
34 .\" Set up some character translations and predefined strings.  \*(-- will
35 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
36 .\" double quote, and \*(R" will give a right double quote.  | will give a
37 .\" real vertical bar.  \*(C+ will give a nicer C++.  Capital omega is used
38 .\" to do unbreakable dashes and therefore won't be available.  \*(C` and
39 .\" \*(C' expand to `' in nroff, nothing in troff, for use with C<>
40 .tr \(*W-|\(bv\*(Tr
41 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
42 .ie n \{\
43 .    ds -- \(*W-
44 .    ds PI pi
45 .    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
46 .    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
47 .    ds L" ""
48 .    ds R" ""
49 .    ds C` ""
50 .    ds C' ""
51 'br\}
52 .el\{\
53 .    ds -- \|\(em\|
54 .    ds PI \(*p
55 .    ds L" ``
56 .    ds R" ''
57 'br\}
58 .\"
59 .\" If the F register is turned on, we'll generate index entries on stderr
60 .\" for titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and
61 .\" index entries marked with X<> in POD.  Of course, you'll have to process
62 .\" the output yourself in some meaningful fashion.
63 .if \nF \{\
64 .    de IX
65 .    tm Index:\\$1\t\\n%\t"\\$2"
66 ..
67 .    nr % 0
68 .    rr F
69 .\}
70 .\"
71 .\" For nroff, turn off justification.  Always turn off hyphenation; it
72 .\" makes way too many mistakes in technical documents.
73 .hy 0
74 .if n .na
75 .\"
76 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
77 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
78 .bd B 3
79 .    \" fudge factors for nroff and troff
80 .if n \{\
81 .    ds #H 0
82 .    ds #V .8m
83 .    ds #F .3m
84 .    ds #[ \f1
85 .    ds #] \fP
86 .\}
87 .if t \{\
88 .    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
89 .    ds #V .6m
90 .    ds #F 0
91 .    ds #[ \&
92 .    ds #] \&
93 .\}
94 .    \" simple accents for nroff and troff
95 .if n \{\
96 .    ds ' \&
97 .    ds ` \&
98 .    ds ^ \&
99 .    ds , \&
100 .    ds ~ ~
101 .    ds /
102 .\}
103 .if t \{\
104 .    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
105 .    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
106 .    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
107 .    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
108 .    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
109 .    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
110 .\}
111 .    \" troff and (daisy-wheel) nroff accents
112 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
113 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
114 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
115 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
116 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
117 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
118 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
119 .ds ae a\h'-(\w'a'u*4/10)'e
120 .ds Ae A\h'-(\w'A'u*4/10)'E
121 .    \" corrections for vroff
122 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
123 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
124 .    \" for low resolution devices (crt and lpr)
125 .if \n(.H>23 .if \n(.V>19 \
126 \{\
127 .    ds : e
128 .    ds 8 ss
129 .    ds o a
130 .    ds d- d\h'-1'\(ga
131 .    ds D- D\h'-1'\(hy
132 .    ds th \o'bp'
133 .    ds Th \o'LP'
134 .    ds ae ae
135 .    ds Ae AE
136 .\}
137 .rm #[ #] #H #V #F C
138 .\" ======================================================================
139 .\"
140 .IX Title "X509 1"
141 .TH X509 1 "0.9.6e" "2000-11-12" "OpenSSL"
142 .UC
143 .SH "NAME"
144 x509 \- Certificate display and signing utility
145 .SH "SYNOPSIS"
146 .IX Header "SYNOPSIS"
147 \&\fBopenssl\fR \fBx509\fR
148 [\fB\-inform DER|PEM|NET\fR]
149 [\fB\-outform DER|PEM|NET\fR]
150 [\fB\-keyform DER|PEM\fR]
151 [\fB\-CAform DER|PEM\fR]
152 [\fB\-CAkeyform DER|PEM\fR]
153 [\fB\-in filename\fR]
154 [\fB\-out filename\fR]
155 [\fB\-serial\fR]
156 [\fB\-hash\fR]
157 [\fB\-subject\fR]
158 [\fB\-issuer\fR]
159 [\fB\-nameopt option\fR]
160 [\fB\-email\fR]
161 [\fB\-startdate\fR]
162 [\fB\-enddate\fR]
163 [\fB\-purpose\fR]
164 [\fB\-dates\fR]
165 [\fB\-modulus\fR]
166 [\fB\-fingerprint\fR]
167 [\fB\-alias\fR]
168 [\fB\-noout\fR]
169 [\fB\-trustout\fR]
170 [\fB\-clrtrust\fR]
171 [\fB\-clrreject\fR]
172 [\fB\-addtrust arg\fR]
173 [\fB\-addreject arg\fR]
174 [\fB\-setalias arg\fR]
175 [\fB\-days arg\fR]
176 [\fB\-signkey filename\fR]
177 [\fB\-x509toreq\fR]
178 [\fB\-req\fR]
179 [\fB\-CA filename\fR]
180 [\fB\-CAkey filename\fR]
181 [\fB\-CAcreateserial\fR]
182 [\fB\-CAserial filename\fR]
183 [\fB\-text\fR]
184 [\fB\-C\fR]
185 [\fB\-md2|\-md5|\-sha1|\-mdc2\fR]
186 [\fB\-clrext\fR]
187 [\fB\-extfile filename\fR]
188 [\fB\-extensions section\fR]
189 .SH "DESCRIPTION"
190 .IX Header "DESCRIPTION"
191 The \fBx509\fR command is a multi purpose certificate utility. It can be
192 used to display certificate information, convert certificates to
193 various forms, sign certificate requests like a \*(L"mini \s-1CA\s0\*(R" or edit
194 certificate trust settings.
195 .PP
196 Since there are a large number of options they will split up into
197 various sections.
198 .SH "INPUT, OUTPUT AND GENERAL PURPOSE OPTIONS"
199 .IX Header "INPUT, OUTPUT AND GENERAL PURPOSE OPTIONS"
200 .Ip "\fB\-inform DER|PEM|NET\fR" 4
201 .IX Item "-inform DER|PEM|NET"
202 This specifies the input format normally the command will expect an X509
203 certificate but this can change if other options such as \fB\-req\fR are
204 present. The \s-1DER\s0 format is the \s-1DER\s0 encoding of the certificate and \s-1PEM\s0
205 is the base64 encoding of the \s-1DER\s0 encoding with header and footer lines
206 added. The \s-1NET\s0 option is an obscure Netscape server format that is now
207 obsolete.
208 .Ip "\fB\-outform DER|PEM|NET\fR" 4
209 .IX Item "-outform DER|PEM|NET"
210 This specifies the output format, the options have the same meaning as the 
211 \&\fB\-inform\fR option.
212 .Ip "\fB\-in filename\fR" 4
213 .IX Item "-in filename"
214 This specifies the input filename to read a certificate from or standard input
215 if this option is not specified.
216 .Ip "\fB\-out filename\fR" 4
217 .IX Item "-out filename"
218 This specifies the output filename to write to or standard output by
219 default.
220 .Ip "\fB\-md2|\-md5|\-sha1|\-mdc2\fR" 4
221 .IX Item "-md2|-md5|-sha1|-mdc2"
222 the digest to use. This affects any signing or display option that uses a message
223 digest, such as the \fB\-fingerprint\fR, \fB\-signkey\fR and \fB\-CA\fR options. If not
224 specified then \s-1MD5\s0 is used. If the key being used to sign with is a \s-1DSA\s0 key then
225 this option has no effect: \s-1SHA1\s0 is always used with \s-1DSA\s0 keys.
226 .SH "DISPLAY OPTIONS"
227 .IX Header "DISPLAY OPTIONS"
228 Note: the \fB\-alias\fR and \fB\-purpose\fR options are also display options
229 but are described in the \fB\s-1TRUST\s0 \s-1OPTIONS\s0\fR section.
230 .Ip "\fB\-text\fR" 4
231 .IX Item "-text"
232 prints out the certificate in text form. Full details are output including the
233 public key, signature algorithms, issuer and subject names, serial number
234 any extensions present and any trust settings.
235 .Ip "\fB\-noout\fR" 4
236 .IX Item "-noout"
237 this option prevents output of the encoded version of the request.
238 .Ip "\fB\-modulus\fR" 4
239 .IX Item "-modulus"
240 this option prints out the value of the modulus of the public key
241 contained in the certificate.
242 .Ip "\fB\-serial\fR" 4
243 .IX Item "-serial"
244 outputs the certificate serial number.
245 .Ip "\fB\-hash\fR" 4
246 .IX Item "-hash"
247 outputs the \*(L"hash\*(R" of the certificate subject name. This is used in OpenSSL to
248 form an index to allow certificates in a directory to be looked up by subject
249 name.
250 .Ip "\fB\-subject\fR" 4
251 .IX Item "-subject"
252 outputs the subject name.
253 .Ip "\fB\-issuer\fR" 4
254 .IX Item "-issuer"
255 outputs the issuer name.
256 .Ip "\fB\-nameopt option\fR" 4
257 .IX Item "-nameopt option"
258 option which determine how the subject or issuer names are displayed. This
259 option may be used more than once to set multiple options. See the \fB\s-1NAME\s0
260 \&\s-1OPTIONS\s0\fR section for more information.
261 .Ip "\fB\-email\fR" 4
262 .IX Item "-email"
263 outputs the email address(es) if any.
264 .Ip "\fB\-startdate\fR" 4
265 .IX Item "-startdate"
266 prints out the start date of the certificate, that is the notBefore date.
267 .Ip "\fB\-enddate\fR" 4
268 .IX Item "-enddate"
269 prints out the expiry date of the certificate, that is the notAfter date.
270 .Ip "\fB\-dates\fR" 4
271 .IX Item "-dates"
272 prints out the start and expiry dates of a certificate.
273 .Ip "\fB\-fingerprint\fR" 4
274 .IX Item "-fingerprint"
275 prints out the digest of the \s-1DER\s0 encoded version of the whole certificate.
276 .Ip "\fB\-C\fR" 4
277 .IX Item "-C"
278 this outputs the certificate in the form of a C source file.
279 .SH "TRUST SETTINGS"
280 .IX Header "TRUST SETTINGS"
281 Please note these options are currently experimental and may well change.
282 .PP
283 A \fBtrusted certificate\fR is an ordinary certificate which has several
284 additional pieces of information attached to it such as the permitted
285 and prohibited uses of the certificate and an \*(L"alias\*(R".
286 .PP
287 Normally when a certificate is being verified at least one certificate
288 must be \*(L"trusted\*(R". By default a trusted certificate must be stored
289 locally and must be a root \s-1CA:\s0 any certificate chain ending in this \s-1CA\s0
290 is then usable for any purpose.
291 .PP
292 Trust settings currently are only used with a root \s-1CA\s0. They allow a finer
293 control over the purposes the root \s-1CA\s0 can be used for. For example a \s-1CA\s0
294 may be trusted for \s-1SSL\s0 client but not \s-1SSL\s0 server use.
295 .PP
296 See the description of the \fBverify\fR utility for more information on the
297 meaning of trust settings.
298 .PP
299 Future versions of OpenSSL will recognize trust settings on any
300 certificate: not just root CAs.
301 .Ip "\fB\-trustout\fR" 4
302 .IX Item "-trustout"
303 this causes \fBx509\fR to output a \fBtrusted\fR certificate. An ordinary
304 or trusted certificate can be input but by default an ordinary
305 certificate is output and any trust settings are discarded. With the
306 \&\fB\-trustout\fR option a trusted certificate is output. A trusted
307 certificate is automatically output if any trust settings are modified.
308 .Ip "\fB\-setalias arg\fR" 4
309 .IX Item "-setalias arg"
310 sets the alias of the certificate. This will allow the certificate
311 to be referred to using a nickname for example \*(L"Steve's Certificate\*(R".
312 .Ip "\fB\-alias\fR" 4
313 .IX Item "-alias"
314 outputs the certificate alias, if any.
315 .Ip "\fB\-clrtrust\fR" 4
316 .IX Item "-clrtrust"
317 clears all the permitted or trusted uses of the certificate.
318 .Ip "\fB\-clrreject\fR" 4
319 .IX Item "-clrreject"
320 clears all the prohibited or rejected uses of the certificate.
321 .Ip "\fB\-addtrust arg\fR" 4
322 .IX Item "-addtrust arg"
323 adds a trusted certificate use. Any object name can be used here
324 but currently only \fBclientAuth\fR (\s-1SSL\s0 client use), \fBserverAuth\fR
325 (\s-1SSL\s0 server use) and \fBemailProtection\fR (S/MIME email) are used.
326 Other OpenSSL applications may define additional uses.
327 .Ip "\fB\-addreject arg\fR" 4
328 .IX Item "-addreject arg"
329 adds a prohibited use. It accepts the same values as the \fB\-addtrust\fR
330 option.
331 .Ip "\fB\-purpose\fR" 4
332 .IX Item "-purpose"
333 this option performs tests on the certificate extensions and outputs
334 the results. For a more complete description see the \fB\s-1CERTIFICATE\s0
335 \&\s-1EXTENSIONS\s0\fR section.
336 .SH "SIGNING OPTIONS"
337 .IX Header "SIGNING OPTIONS"
338 The \fBx509\fR utility can be used to sign certificates and requests: it
339 can thus behave like a \*(L"mini \s-1CA\s0\*(R".
340 .Ip "\fB\-signkey filename\fR" 4
341 .IX Item "-signkey filename"
342 this option causes the input file to be self signed using the supplied
343 private key. 
344 .Sp
345 If the input file is a certificate it sets the issuer name to the
346 subject name (i.e.  makes it self signed) changes the public key to the
347 supplied value and changes the start and end dates. The start date is
348 set to the current time and the end date is set to a value determined
349 by the \fB\-days\fR option. Any certificate extensions are retained unless
350 the \fB\-clrext\fR option is supplied.
351 .Sp
352 If the input is a certificate request then a self signed certificate
353 is created using the supplied private key using the subject name in
354 the request.
355 .Ip "\fB\-clrext\fR" 4
356 .IX Item "-clrext"
357 delete any extensions from a certificate. This option is used when a
358 certificate is being created from another certificate (for example with
359 the \fB\-signkey\fR or the \fB\-CA\fR options). Normally all extensions are
360 retained.
361 .Ip "\fB\-keyform PEM|DER\fR" 4
362 .IX Item "-keyform PEM|DER"
363 specifies the format (\s-1DER\s0 or \s-1PEM\s0) of the private key file used in the
364 \&\fB\-signkey\fR option.
365 .Ip "\fB\-days arg\fR" 4
366 .IX Item "-days arg"
367 specifies the number of days to make a certificate valid for. The default
368 is 30 days.
369 .Ip "\fB\-x509toreq\fR" 4
370 .IX Item "-x509toreq"
371 converts a certificate into a certificate request. The \fB\-signkey\fR option
372 is used to pass the required private key.
373 .Ip "\fB\-req\fR" 4
374 .IX Item "-req"
375 by default a certificate is expected on input. With this option a
376 certificate request is expected instead.
377 .Ip "\fB\-CA filename\fR" 4
378 .IX Item "-CA filename"
379 specifies the \s-1CA\s0 certificate to be used for signing. When this option is
380 present \fBx509\fR behaves like a \*(L"mini \s-1CA\s0\*(R". The input file is signed by this
381 \&\s-1CA\s0 using this option: that is its issuer name is set to the subject name
382 of the \s-1CA\s0 and it is digitally signed using the CAs private key.
383 .Sp
384 This option is normally combined with the \fB\-req\fR option. Without the
385 \&\fB\-req\fR option the input is a certificate which must be self signed.
386 .Ip "\fB\-CAkey filename\fR" 4
387 .IX Item "-CAkey filename"
388 sets the \s-1CA\s0 private key to sign a certificate with. If this option is
389 not specified then it is assumed that the \s-1CA\s0 private key is present in
390 the \s-1CA\s0 certificate file.
391 .Ip "\fB\-CAserial filename\fR" 4
392 .IX Item "-CAserial filename"
393 sets the \s-1CA\s0 serial number file to use.
394 .Sp
395 When the \fB\-CA\fR option is used to sign a certificate it uses a serial
396 number specified in a file. This file consist of one line containing
397 an even number of hex digits with the serial number to use. After each
398 use the serial number is incremented and written out to the file again.
399 .Sp
400 The default filename consists of the \s-1CA\s0 certificate file base name with
401 \&\*(L".srl\*(R" appended. For example if the \s-1CA\s0 certificate file is called 
402 \&\*(L"mycacert.pem\*(R" it expects to find a serial number file called \*(L"mycacert.srl\*(R".
403 .Ip "\fB\-CAcreateserial filename\fR" 4
404 .IX Item "-CAcreateserial filename"
405 with this option the \s-1CA\s0 serial number file is created if it does not exist:
406 it will contain the serial number \*(L"02\*(R" and the certificate being signed will
407 have the 1 as its serial number. Normally if the \fB\-CA\fR option is specified
408 and the serial number file does not exist it is an error.
409 .Ip "\fB\-extfile filename\fR" 4
410 .IX Item "-extfile filename"
411 file containing certificate extensions to use. If not specified then
412 no extensions are added to the certificate.
413 .Ip "\fB\-extensions section\fR" 4
414 .IX Item "-extensions section"
415 the section to add certificate extensions from. If this option is not
416 specified then the extensions should either be contained in the unnamed
417 (default) section or the default section should contain a variable called
418 \&\*(L"extensions\*(R" which contains the section to use.
419 .SH "NAME OPTIONS"
420 .IX Header "NAME OPTIONS"
421 The \fBnameopt\fR command line switch determines how the subject and issuer
422 names are displayed. If no \fBnameopt\fR switch is present the default \*(L"oneline\*(R"
423 format is used which is compatible with previous versions of OpenSSL.
424 Each option is described in detail below, all options can be preceded by
425 a \fB-\fR to turn the option off. Only the first four will normally be used.
426 .Ip "\fBcompat\fR" 4
427 .IX Item "compat"
428 use the old format. This is equivalent to specifying no name options at all.
429 .Ip "\fB\s-1RFC2253\s0\fR" 4
430 .IX Item "RFC2253"
431 displays names compatible with \s-1RFC2253\s0 equivalent to \fBesc_2253\fR, \fBesc_ctrl\fR,
432 \&\fBesc_msb\fR, \fButf8\fR, \fBdump_nostr\fR, \fBdump_unknown\fR, \fBdump_der\fR,
433 \&\fBsep_comma_plus\fR, \fBdn_rev\fR and \fBsname\fR.
434 .Ip "\fBoneline\fR" 4
435 .IX Item "oneline"
436 a oneline format which is more readable than \s-1RFC2253\s0. It is equivalent to
437 specifying the  \fBesc_2253\fR, \fBesc_ctrl\fR, \fBesc_msb\fR, \fButf8\fR, \fBdump_nostr\fR,
438 \&\fBdump_der\fR, \fBuse_quote\fR, \fBsep_comma_plus_spc\fR, \fBspc_eq\fR and \fBsname\fR
439 options.
440 .Ip "\fBmultiline\fR" 4
441 .IX Item "multiline"
442 a multiline format. It is equivalent \fBesc_ctrl\fR, \fBesc_msb\fR, \fBsep_multiline\fR,
443 \&\fBspc_eq\fR and \fBlname\fR.
444 .Ip "\fBesc_2253\fR" 4
445 .IX Item "esc_2253"
446 escape the \*(L"special\*(R" characters required by \s-1RFC2253\s0 in a field That is
447 \&\fB,+"<>;\fR. Additionally \fB#\fR is escaped at the beginnging of a string
448 and a space character at the beginning or end of a string.
449 .Ip "\fBesc_ctrl\fR" 4
450 .IX Item "esc_ctrl"
451 escape control characters. That is those with \s-1ASCII\s0 values less than
452 0x20 (space) and the delete (0x7f) character. They are escaped using the
453 \&\s-1RFC2253\s0 \eXX notation (where \s-1XX\s0 are two hex digits representing the
454 character value).
455 .Ip "\fBesc_msb\fR" 4
456 .IX Item "esc_msb"
457 escape characters with the \s-1MSB\s0 set, that is with \s-1ASCII\s0 values larger than
458 127.
459 .Ip "\fBuse_quote\fR" 4
460 .IX Item "use_quote"
461 escapes some characters by surrounding the whole string with \fB"\fR characters,
462 without the option all escaping is done with the \fB\e\fR character.
463 .Ip "\fButf8\fR" 4
464 .IX Item "utf8"
465 convert all strings to \s-1UTF8\s0 format first. This is required by \s-1RFC2253\s0. If
466 you are lucky enough to have a \s-1UTF8\s0 compatible terminal then the use
467 of this option (and \fBnot\fR setting \fBesc_msb\fR) may result in the correct
468 display of multibyte (international) characters. Is this option is not
469 present then multibyte characters larger than 0xff will be represented
470 using the format \eUXXXX for 16 bits and \eWXXXXXXXX for 32 bits.
471 Also if this option is off any UTF8Strings will be converted to their
472 character form first.
473 .Ip "\fBno_type\fR" 4
474 .IX Item "no_type"
475 this option does not attempt to interpret multibyte characters in any
476 way. That is their content octets are merely dumped as though one octet
477 represents each character. This is useful for diagnostic purposes but
478 will result in rather odd looking output.
479 .Ip "\fBshow_type\fR" 4
480 .IX Item "show_type"
481 show the type of the \s-1ASN1\s0 character string. The type precedes the
482 field contents. For example \*(L"\s-1BMPSTRING:\s0 Hello World\*(R".
483 .Ip "\fBdump_der\fR" 4
484 .IX Item "dump_der"
485 when this option is set any fields that need to be hexdumped will
486 be dumped using the \s-1DER\s0 encoding of the field. Otherwise just the
487 content octets will be displayed. Both options use the \s-1RFC2253\s0
488 \&\fB#XXXX...\fR format.
489 .Ip "\fBdump_nostr\fR" 4
490 .IX Item "dump_nostr"
491 dump non character string types (for example \s-1OCTET\s0 \s-1STRING\s0) if this
492 option is not set then non character string types will be displayed
493 as though each content octet repesents a single character.
494 .Ip "\fBdump_all\fR" 4
495 .IX Item "dump_all"
496 dump all fields. This option when used with \fBdump_der\fR allows the
497 \&\s-1DER\s0 encoding of the structure to be unambiguously determined.
498 .Ip "\fBdump_unknown\fR" 4
499 .IX Item "dump_unknown"
500 dump any field whose \s-1OID\s0 is not recognised by OpenSSL.
501 .Ip "\fBsep_comma_plus\fR, \fBsep_comma_plus_space\fR, \fBsep_semi_plus_space\fR, \fBsep_multiline\fR" 4
502 .IX Item "sep_comma_plus, sep_comma_plus_space, sep_semi_plus_space, sep_multiline"
503 these options determine the field separators. The first character is
504 between RDNs and the second between multiple AVAs (multiple AVAs are
505 very rare and their use is discouraged). The options ending in
506 \&\*(L"space\*(R" additionally place a space after the separator to make it
507 more readable. The \fBsep_multiline\fR uses a linefeed character for
508 the \s-1RDN\s0 separator and a spaced \fB+\fR for the \s-1AVA\s0 separator. It also
509 indents the fields by four characters.
510 .Ip "\fBdn_rev\fR" 4
511 .IX Item "dn_rev"
512 reverse the fields of the \s-1DN\s0. This is required by \s-1RFC2253\s0. As a side
513 effect this also reverses the order of multiple AVAs but this is
514 permissible.
515 .Ip "\fBnofname\fR, \fBsname\fR, \fBlname\fR, \fBoid\fR" 4
516 .IX Item "nofname, sname, lname, oid"
517 these options alter how the field name is displayed. \fBnofname\fR does
518 not display the field at all. \fBsname\fR uses the \*(L"short name\*(R" form
519 (\s-1CN\s0 for commonName for example). \fBlname\fR uses the long form.
520 \&\fBoid\fR represents the \s-1OID\s0 in numerical form and is useful for
521 diagnostic purpose.
522 .Ip "\fBspc_eq\fR" 4
523 .IX Item "spc_eq"
524 places spaces round the \fB=\fR character which follows the field
525 name.
526 .SH "EXAMPLES"
527 .IX Header "EXAMPLES"
528 Note: in these examples the '\e' means the example should be all on one
529 line.
530 .PP
531 Display the contents of a certificate:
532 .PP
533 .Vb 1
534 \& openssl x509 -in cert.pem -noout -text
535 .Ve
536 Display the certificate serial number:
537 .PP
538 .Vb 1
539 \& openssl x509 -in cert.pem -noout -serial
540 .Ve
541 Display the certificate subject name:
542 .PP
543 .Vb 1
544 \& openssl x509 -in cert.pem -noout -subject
545 .Ve
546 Display the certificate subject name in \s-1RFC2253\s0 form:
547 .PP
548 .Vb 1
549 \& openssl x509 -in cert.pem -noout -subject -nameopt RFC2253
550 .Ve
551 Display the certificate subject name in oneline form on a terminal
552 supporting \s-1UTF8:\s0
553 .PP
554 .Vb 1
555 \& openssl x509 -in cert.pem -noout -subject -nameopt oneline -nameopt -escmsb
556 .Ve
557 Display the certificate \s-1MD5\s0 fingerprint:
558 .PP
559 .Vb 1
560 \& openssl x509 -in cert.pem -noout -fingerprint
561 .Ve
562 Display the certificate \s-1SHA1\s0 fingerprint:
563 .PP
564 .Vb 1
565 \& openssl x509 -sha1 -in cert.pem -noout -fingerprint
566 .Ve
567 Convert a certificate from \s-1PEM\s0 to \s-1DER\s0 format:
568 .PP
569 .Vb 1
570 \& openssl x509 -in cert.pem -inform PEM -out cert.der -outform DER
571 .Ve
572 Convert a certificate to a certificate request:
573 .PP
574 .Vb 1
575 \& openssl x509 -x509toreq -in cert.pem -out req.pem -signkey key.pem
576 .Ve
577 Convert a certificate request into a self signed certificate using
578 extensions for a \s-1CA:\s0
579 .PP
580 .Vb 2
581 \& openssl x509 -req -in careq.pem -extfile openssl.cnf -extensions v3_ca \e
582 \&        -signkey key.pem -out cacert.pem
583 .Ve
584 Sign a certificate request using the \s-1CA\s0 certificate above and add user
585 certificate extensions:
586 .PP
587 .Vb 2
588 \& openssl x509 -req -in req.pem -extfile openssl.cnf -extensions v3_usr \e
589 \&        -CA cacert.pem -CAkey key.pem -CAcreateserial
590 .Ve
591 Set a certificate to be trusted for \s-1SSL\s0 client use and change set its alias to
592 \&\*(L"Steve's Class 1 \s-1CA\s0\*(R"
593 .PP
594 .Vb 2
595 \& openssl x509 -in cert.pem -addtrust sslclient \e
596 \&        -alias "Steve's Class 1 CA" -out trust.pem
597 .Ve
598 .SH "NOTES"
599 .IX Header "NOTES"
600 The \s-1PEM\s0 format uses the header and footer lines:
601 .PP
602 .Vb 2
603 \& -----BEGIN CERTIFICATE----
604 \& -----END CERTIFICATE----
605 .Ve
606 it will also handle files containing:
607 .PP
608 .Vb 2
609 \& -----BEGIN X509 CERTIFICATE----
610 \& -----END X509 CERTIFICATE----
611 .Ve
612 Trusted certificates have the lines
613 .PP
614 .Vb 2
615 \& -----BEGIN TRUSTED CERTIFICATE----
616 \& -----END TRUSTED CERTIFICATE----
617 .Ve
618 The conversion to \s-1UTF8\s0 format used with the name options assumes that
619 T61Strings use the \s-1ISO8859\-1\s0 character set. This is wrong but Netscape
620 and \s-1MSIE\s0 do this as do many certificates. So although this is incorrect
621 it is more likely to display the majority of certificates correctly.
622 .PP
623 The \fB\-fingerprint\fR option takes the digest of the \s-1DER\s0 encoded certificate.
624 This is commonly called a \*(L"fingerprint\*(R". Because of the nature of message
625 digests the fingerprint of a certificate is unique to that certificate and
626 two certificates with the same fingerprint can be considered to be the same.
627 .PP
628 The Netscape fingerprint uses \s-1MD5\s0 whereas \s-1MSIE\s0 uses \s-1SHA1\s0.
629 .PP
630 The \fB\-email\fR option searches the subject name and the subject alternative
631 name extension. Only unique email addresses will be printed out: it will
632 not print the same address more than once.
633 .SH "CERTIFICATE EXTENSIONS"
634 .IX Header "CERTIFICATE EXTENSIONS"
635 The \fB\-purpose\fR option checks the certificate extensions and determines
636 what the certificate can be used for. The actual checks done are rather
637 complex and include various hacks and workarounds to handle broken
638 certificates and software.
639 .PP
640 The same code is used when verifying untrusted certificates in chains
641 so this section is useful if a chain is rejected by the verify code.
642 .PP
643 The basicConstraints extension \s-1CA\s0 flag is used to determine whether the
644 certificate can be used as a \s-1CA\s0. If the \s-1CA\s0 flag is true then it is a \s-1CA\s0,
645 if the \s-1CA\s0 flag is false then it is not a \s-1CA\s0. \fBAll\fR CAs should have the
646 \&\s-1CA\s0 flag set to true.
647 .PP
648 If the basicConstraints extension is absent then the certificate is
649 considered to be a \*(L"possible \s-1CA\s0\*(R" other extensions are checked according
650 to the intended use of the certificate. A warning is given in this case
651 because the certificate should really not be regarded as a \s-1CA:\s0 however
652 it is allowed to be a \s-1CA\s0 to work around some broken software.
653 .PP
654 If the certificate is a V1 certificate (and thus has no extensions) and
655 it is self signed it is also assumed to be a \s-1CA\s0 but a warning is again
656 given: this is to work around the problem of Verisign roots which are V1
657 self signed certificates.
658 .PP
659 If the keyUsage extension is present then additional restraints are
660 made on the uses of the certificate. A \s-1CA\s0 certificate \fBmust\fR have the
661 keyCertSign bit set if the keyUsage extension is present.
662 .PP
663 The extended key usage extension places additional restrictions on the
664 certificate uses. If this extension is present (whether critical or not)
665 the key can only be used for the purposes specified.
666 .PP
667 A complete description of each test is given below. The comments about
668 basicConstraints and keyUsage and V1 certificates above apply to \fBall\fR
669 \&\s-1CA\s0 certificates.
670 .Ip "\fB\s-1SSL\s0 Client\fR" 4
671 .IX Item "SSL Client"
672 The extended key usage extension must be absent or include the \*(L"web client
673 authentication\*(R" \s-1OID\s0.  keyUsage must be absent or it must have the
674 digitalSignature bit set. Netscape certificate type must be absent or it must
675 have the \s-1SSL\s0 client bit set.
676 .Ip "\fB\s-1SSL\s0 Client \s-1CA\s0\fR" 4
677 .IX Item "SSL Client CA"
678 The extended key usage extension must be absent or include the \*(L"web client
679 authentication\*(R" \s-1OID\s0. Netscape certificate type must be absent or it must have
680 the \s-1SSL\s0 \s-1CA\s0 bit set: this is used as a work around if the basicConstraints
681 extension is absent.
682 .Ip "\fB\s-1SSL\s0 Server\fR" 4
683 .IX Item "SSL Server"
684 The extended key usage extension must be absent or include the \*(L"web server
685 authentication\*(R" and/or one of the \s-1SGC\s0 OIDs.  keyUsage must be absent or it
686 must have the digitalSignature, the keyEncipherment set or both bits set.
687 Netscape certificate type must be absent or have the \s-1SSL\s0 server bit set.
688 .Ip "\fB\s-1SSL\s0 Server \s-1CA\s0\fR" 4
689 .IX Item "SSL Server CA"
690 The extended key usage extension must be absent or include the \*(L"web server
691 authentication\*(R" and/or one of the \s-1SGC\s0 OIDs.  Netscape certificate type must
692 be absent or the \s-1SSL\s0 \s-1CA\s0 bit must be set: this is used as a work around if the
693 basicConstraints extension is absent.
694 .Ip "\fBNetscape \s-1SSL\s0 Server\fR" 4
695 .IX Item "Netscape SSL Server"
696 For Netscape \s-1SSL\s0 clients to connect to an \s-1SSL\s0 server it must have the
697 keyEncipherment bit set if the keyUsage extension is present. This isn't
698 always valid because some cipher suites use the key for digital signing.
699 Otherwise it is the same as a normal \s-1SSL\s0 server.
700 .Ip "\fBCommon S/MIME Client Tests\fR" 4
701 .IX Item "Common S/MIME Client Tests"
702 The extended key usage extension must be absent or include the \*(L"email
703 protection\*(R" \s-1OID\s0. Netscape certificate type must be absent or should have the
704 S/MIME bit set. If the S/MIME bit is not set in netscape certificate type
705 then the \s-1SSL\s0 client bit is tolerated as an alternative but a warning is shown:
706 this is because some Verisign certificates don't set the S/MIME bit.
707 .Ip "\fBS/MIME Signing\fR" 4
708 .IX Item "S/MIME Signing"
709 In addition to the common S/MIME client tests the digitalSignature bit must
710 be set if the keyUsage extension is present.
711 .Ip "\fBS/MIME Encryption\fR" 4
712 .IX Item "S/MIME Encryption"
713 In addition to the common S/MIME tests the keyEncipherment bit must be set
714 if the keyUsage extension is present.
715 .Ip "\fBS/MIME \s-1CA\s0\fR" 4
716 .IX Item "S/MIME CA"
717 The extended key usage extension must be absent or include the \*(L"email
718 protection\*(R" \s-1OID\s0. Netscape certificate type must be absent or must have the
719 S/MIME \s-1CA\s0 bit set: this is used as a work around if the basicConstraints
720 extension is absent. 
721 .Ip "\fB\s-1CRL\s0 Signing\fR" 4
722 .IX Item "CRL Signing"
723 The keyUsage extension must be absent or it must have the \s-1CRL\s0 signing bit
724 set.
725 .Ip "\fB\s-1CRL\s0 Signing \s-1CA\s0\fR" 4
726 .IX Item "CRL Signing CA"
727 The normal \s-1CA\s0 tests apply. Except in this case the basicConstraints extension
728 must be present.
729 .SH "BUGS"
730 .IX Header "BUGS"
731 Extensions in certificates are not transferred to certificate requests and
732 vice versa.
733 .PP
734 It is possible to produce invalid certificates or requests by specifying the
735 wrong private key or using inconsistent options in some cases: these should
736 be checked.
737 .PP
738 There should be options to explicitly set such things as start and end
739 dates rather than an offset from the current time.
740 .PP
741 The code to implement the verify behaviour described in the \fB\s-1TRUST\s0 \s-1SETTINGS\s0\fR
742 is currently being developed. It thus describes the intended behaviour rather
743 than the current behaviour. It is hoped that it will represent reality in
744 OpenSSL 0.9.5 and later.
745 .SH "SEE ALSO"
746 .IX Header "SEE ALSO"
747 req(1), ca(1), genrsa(1),
748 gendsa(1), verify(1)