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