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