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