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