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