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