304fe532c828c458c16f6c1714f93a6635144343
[openssl.git] / doc / apps / x509v3_config.pod
1 =pod
2
3 =head1 NAME
4
5 x509v3_config - X509 V3 certificate extension configuration format
6
7 =head1 DESCRIPTION
8
9 Several of the OpenSSL utilities can add extensions to a certificate or
10 certificate request based on the contents of a configuration file.
11
12 Typically the application will contain an option to point to an extension
13 section. Each line of the extension section takes the form:
14
15  extension_name=[critical,] extension_options
16
17 If B<critical> is present then the extension will be critical.
18
19 The format of B<extension_options> depends on the value of B<extension_name>.
20
21 There are four main types of extension: I<string> extensions, I<multi-valued>
22 extensions, I<raw> and I<arbitrary> extensions.
23
24 String extensions simply have a string which contains either the value itself
25 or how it is obtained.
26
27 For example:
28
29  nsComment="This is a Comment"
30
31 Multi-valued extensions have a short form and a long form. The short form
32 is a list of names and values:
33
34  basicConstraints=critical,CA:true,pathlen:1
35
36 The long form allows the values to be placed in a separate section:
37
38  basicConstraints=critical,@bs_section
39
40  [bs_section]
41
42  CA=true
43  pathlen=1
44
45 Both forms are equivalent.
46
47 The syntax of raw extensions is governed by the extension code: it can
48 for example contain data in multiple sections. The correct syntax to
49 use is defined by the extension code itself: check out the certificate
50 policies extension for an example.
51
52 If an extension type is unsupported then the I<arbitrary> extension syntax
53 must be used, see the ARBITRARY EXTENSION section for more details.
54
55 =head1 STANDARD EXTENSIONS
56
57 The following sections describe each supported extension in detail.
58
59 =head2 Basic Constraints.
60
61 This is a multi valued extension which indicates whether a certificate is
62 a CA certificate. The first (mandatory) name is B<CA> followed by B<TRUE> or
63 B<FALSE>. If B<CA> is B<TRUE> then an optional B<pathlen> name followed by an
64 non-negative value can be included.
65
66 For example:
67
68  basicConstraints=CA:TRUE
69
70  basicConstraints=CA:FALSE
71
72  basicConstraints=critical,CA:TRUE, pathlen:0
73
74 A CA certificate B<must> include the basicConstraints value with the CA field
75 set to TRUE. An end user certificate must either set CA to FALSE or exclude the
76 extension entirely. Some software may require the inclusion of basicConstraints
77 with CA set to FALSE for end entity certificates.
78
79 The pathlen parameter indicates the maximum number of CAs that can appear
80 below this one in a chain. So if you have a CA with a pathlen of zero it can
81 only be used to sign end user certificates and not further CAs.
82
83
84 =head2 Key Usage.
85
86 Key usage is a multi valued extension consisting of a list of names of the
87 permitted key usages.
88
89 The supporte names are: digitalSignature, nonRepudiation, keyEncipherment,
90 dataEncipherment, keyAgreement, keyCertSign, cRLSign, encipherOnly
91 and decipherOnly.
92
93 Examples:
94
95  keyUsage=digitalSignature, nonRepudiation
96
97  keyUsage=critical, keyCertSign
98
99
100 =head2 Extended Key Usage.
101
102 This extensions consists of a list of usages indicating purposes for which
103 the certificate public key can be used for,
104
105 These can either be object short names of the dotted numerical form of OIDs.
106 While any OID can be used only certain values make sense. In particular the
107 following PKIX, NS and MS values are meaningful:
108
109  Value                  Meaning
110  -----                  -------
111  serverAuth             SSL/TLS Web Server Authentication.
112  clientAuth             SSL/TLS Web Client Authentication.
113  codeSigning            Code signing.
114  emailProtection        E-mail Protection (S/MIME).
115  timeStamping           Trusted Timestamping
116  msCodeInd              Microsoft Individual Code Signing (authenticode)
117  msCodeCom              Microsoft Commercial Code Signing (authenticode)
118  msCTLSign              Microsoft Trust List Signing
119  msSGC                  Microsoft Server Gated Crypto
120  msEFS                  Microsoft Encrypted File System
121  nsSGC                  Netscape Server Gated Crypto
122
123 Examples:
124
125  extendedKeyUsage=critical,codeSigning,1.2.3.4
126  extendedKeyUsage=nsSGC,msSGC
127
128
129 =head2 Subject Key Identifier.
130
131 This is really a string extension and can take two possible values. Either
132 the word B<hash> which will automatically follow the guidelines in RFC3280
133 or a hex string giving the extension value to include. The use of the hex
134 string is strongly discouraged.
135
136 Example:
137
138  subjectKeyIdentifier=hash
139
140
141 =head2 Authority Key Identifier.
142
143 The authority key identifier extension permits two options. keyid and issuer:
144 both can take the optional value "always".
145
146 If the keyid option is present an attempt is made to copy the subject key
147 identifier from the parent certificate. If the value "always" is present
148 then an error is returned if the option fails.
149
150 The issuer option copies the issuer and serial number from the issuer
151 certificate. Normally this will only be done if the keyid option fails or
152 is not included: the "always" flag will always include the value.
153
154
155 =head2 Subject Alternative Name.
156
157 The subject alternative name extension allows various literal values to be
158 included in the configuration file. These include B<email> (an email address)
159 B<URI> a uniform resource indicator, B<DNS> (a DNS domain name), B<RID> (a
160 registered ID: OBJECT IDENTIFIER), B<IP> (an IP address), B<dirName>
161 (a distinguished name) and otherName.
162
163 The email option include a special 'copy' value. This will automatically
164 include and email addresses contained in the certificate subject name in
165 the extension.
166
167 The IP address used in the B<IP> options can be in either IPv4 or IPv6 format.
168
169 The value of B<dirName> should point to a section containing the distinguished
170 name to use as a set of name value pairs. Multi values AVAs can be formed by
171 preceeding the name with a B<+> character.
172
173 otherName can include arbitrary data associated with an OID: the value
174 should be the OID followed by a semicolon and the content in standard
175 ASN1_generate_nconf() format.
176
177 Examples:
178
179  subjectAltName=email:copy,email:my@other.address,URI:http://my.url.here/
180  subjectAltName=IP:192.168.7.1
181  subjectAltName=IP:13::17
182  subjectAltName=email:my@other.address,RID:1.2.3.4
183  subjectAltName=otherName:1.2.3.4;UTF8:some other identifier
184
185  subjectAltName=dirName:dir_sect
186
187  [dir_sect]
188  C=UK
189  O=My Organization
190  OU=My Unit
191  CN=My Name
192
193
194 =head2 Issuer Alternative Name.
195
196 The issuer alternative name option supports all the literal options of
197 subject alternative name. It does B<not> support the email:copy option because
198 that would not make sense. It does support an additional issuer:copy option
199 that will copy all the subject alternative name values from the issuer 
200 certificate (if possible).
201
202 Example:
203
204  issuserAltName = issuer:copy
205
206
207 =head2 Authority Info Access.
208
209 The authority information access extension gives details about how to access
210 certain information relating to the CA. Its syntax is accessOID;location
211 where I<location> has the same syntax as subject alternative name (except
212 that email:copy is not supported). accessOID can be any valid OID but only
213 certain values are meaningful, for example OCSP and caIssuers.
214
215 Example:
216
217  authorityInfoAccess = OCSP;URI:http://ocsp.my.host/
218  authorityInfoAccess = caIssuers;URI:http://my.ca/ca.html
219
220
221 =head2 CRL distribution points.
222
223 This is a multi-valued extension that supports all the literal options of
224 subject alternative name. Of the few software packages that currently interpret
225 this extension most only interpret the URI option.
226
227 Currently each option will set a new DistributionPoint with the fullName
228 field set to the given value.
229
230 Other fields like cRLissuer and reasons cannot currently be set or displayed:
231 at this time no examples were available that used these fields.
232
233 Examples:
234
235  crlDistributionPoints=URI:http://myhost.com/myca.crl
236  crlDistributionPoints=URI:http://my.com/my.crl,URI:http://oth.com/my.crl
237
238 =head2 Certificate Policies.
239
240 This is a B<raw> extension. All the fields of this extension can be set by
241 using the appropriate syntax.
242
243 If you follow the PKIX recommendations and just using one OID then you just
244 include the value of that OID. Multiple OIDs can be set separated by commas,
245 for example:
246
247  certificatePolicies= 1.2.4.5, 1.1.3.4
248
249 If you wish to include qualifiers then the policy OID and qualifiers need to
250 be specified in a separate section: this is done by using the @section syntax
251 instead of a literal OID value.
252
253 The section referred to must include the policy OID using the name
254 policyIdentifier, cPSuri qualifiers can be included using the syntax:
255
256  CPS.nnn=value
257
258 userNotice qualifiers can be set using the syntax:
259
260  userNotice.nnn=@notice
261
262 The value of the userNotice qualifier is specified in the relevant section.
263 This section can include explicitText, organization and noticeNumbers
264 options. explicitText and organization are text strings, noticeNumbers is a
265 comma separated list of numbers. The organization and noticeNumbers options
266 (if included) must BOTH be present. If you use the userNotice option with IE5
267 then you need the 'ia5org' option at the top level to modify the encoding:
268 otherwise it will not be interpreted properly.
269
270 Example:
271
272  certificatePolicies=ia5org,1.2.3.4,1.5.6.7.8,@polsect
273
274  [polsect]
275
276  policyIdentifier = 1.3.5.8
277  CPS.1="http://my.host.name/"
278  CPS.2="http://my.your.name/"
279  userNotice.1=@notice
280
281  [notice]
282
283  explicitText="Explicit Text Here"
284  organization="Organisation Name"
285  noticeNumbers=1,2,3,4
286
287 The B<ia5org> option changes the type of the I<organization> field. In RFC2459
288 it can only be of type DisplayText. In RFC3280 IA5Strring is also permissible.
289 Some software (for example some versions of MSIE) may require ia5org.
290
291 =head2 Policy Constraints
292
293 This is a multi-valued extension which consisting of the names
294 B<requireExplicitPolicy> or B<inhibitPolicyMapping> and a non negative intger
295 value. At least one component must be present.
296
297 Example:
298
299  policyConstraints = requireExplicitPolicy:3
300
301
302 =head2 Inhibit Any Policy
303
304 This is a string extension whose value must be a non negative integer.
305
306 Example:
307
308  inhibitAnyPolicy = 2
309
310
311 =head1 DEPRECATED EXTENSIONS
312
313 The following extensions are considered non standard, Netscape specific and
314 largely obsolete. Their use in new applications is discouraged.
315
316 =head2 Netscape String extensions.
317
318 Netscape Comment (B<nsComment>) is a string extension containing a comment
319 which will be displayed when the certificate is viewed in some browsers.
320
321 Example:
322
323  nsComment = "Some Random Comment"
324
325 Other supported extensions in this category are: B<nsBaseUrl>,
326 B<nsRevocationUrl>, B<nsCaRevocationUrl>, B<nsRenewalUrl>, B<nsCaPolicyUrl>
327 and B<nsSslServerName>.
328
329
330 =head2 Netscape Certificate Type
331
332 This is a multi-valued extensions which consists of a list of flags to be
333 included. It was used to indicate the purposes for which a certificate could
334 be used. The basicConstraints, keyUsage and extended key usage extensions are
335 now used instead.
336
337 Acceptable values for nsCertType are: B<client>, B<server>, B<email>,
338 B<objsign>, B<reserved>, B<sslCA>, B<emailCA>, B<objCA>.
339
340
341 =head1 ARBITRARY EXTENSIONS
342
343 If an extension is not supported by the OpenSSL code then it must be encoded
344 using the arbitrary extension format. It is also possible to use the arbitrary
345 format for supported extensions. Extreme care should be taken to ensure that
346 the data is formatted correctly for the given extension type.
347
348 There are two ways to encode arbitrary extensions.
349
350 The first way is to use the word ASN1 followed by the extension content
351 using the same syntax as ASN1_generate_nconf(). For example:
352
353  1.2.3.4=critical,ASN1:UTF8String:Some random data
354
355  1.2.3.4=ASN1:SEQUENCE:seq_sect
356
357  [seq_sect]
358
359  field1 = UTF8:field1
360  field2 = UTF8:field2
361
362 It is also possible to use the word DER to include the raw encoded data in any
363 extension.
364
365  1.2.3.4=critical,DER:01:02:03:04
366  1.2.3.4=DER:01020304
367
368 The value following DER is a hex dump of the DER encoding of the extension
369 Any extension can be placed in this form to override the default behaviour.
370 For example:
371
372  basicConstraints=critical,DER:00:01:02:03
373
374 =head1 WARNING
375
376 There is no guarantee that a specific implementation will process a given
377 extension. It may therefore be sometimes possible to use certificates for
378 purposes prohibited by their extensions because a specific application does
379 not recognize or honour the values of the relevant extensions.
380
381 The DER and ASN1 options should be used with caution. It is possible to create
382 totally invalid extensions if they are not used carefully.
383
384
385 =head1 NOTES
386
387 If an extension is multi-value and a field value must contain a comma the long
388 form must be used otherwise the comma would be misinterpreted as a field
389 separator. For example:
390
391  subjectAltName=URI:ldap://somehost.com/CN=foo,OU=bar
392
393 will produce an error but the equivalent form:
394
395  subjectAltName=@subject_alt_section
396
397  [subject_alt_section]
398  subjectAltName=URI:ldap://somehost.com/CN=foo,OU=bar
399
400 is valid. 
401
402 Due to the behaviour of the OpenSSL B<conf> library the same field name
403 can only occur once in a section. This means that:
404
405  subjectAltName=@alt_section
406
407  [alt_section]
408
409  email=steve@here
410  email=steve@there
411
412 will only recognize the last value. This can be worked around by using the form:
413
414  [alt_section]
415
416  email.1=steve@here
417  email.2=steve@there