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