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