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