]> git.ipfire.org Git - thirdparty/openssl.git/blame - doc/apps/x509v3_config.pod
Fix nits in pod files.
[thirdparty/openssl.git] / doc / apps / x509v3_config.pod
CommitLineData
19f39703
DSH
1=pod
2
401ee37a
DSH
3=for comment openssl_manual_section:5
4
19f39703
DSH
5=head1 NAME
6
7x509v3_config - X509 V3 certificate extension configuration format
8
9=head1 DESCRIPTION
10
11Several of the OpenSSL utilities can add extensions to a certificate or
12certificate request based on the contents of a configuration file.
13
14Typically the application will contain an option to point to an extension
15section. Each line of the extension section takes the form:
16
17 extension_name=[critical,] extension_options
18
19If B<critical> is present then the extension will be critical.
20
21The format of B<extension_options> depends on the value of B<extension_name>.
22
23There are four main types of extension: I<string> extensions, I<multi-valued>
24extensions, I<raw> and I<arbitrary> extensions.
25
26String extensions simply have a string which contains either the value itself
27or how it is obtained.
28
29For example:
30
31 nsComment="This is a Comment"
32
33Multi-valued extensions have a short form and a long form. The short form
34is a list of names and values:
35
36 basicConstraints=critical,CA:true,pathlen:1
37
38The long form allows the values to be placed in a separate section:
39
40 basicConstraints=critical,@bs_section
41
42 [bs_section]
43
44 CA=true
45 pathlen=1
46
47Both forms are equivalent.
48
49The syntax of raw extensions is governed by the extension code: it can
50for example contain data in multiple sections. The correct syntax to
51use is defined by the extension code itself: check out the certificate
52policies extension for an example.
53
54If an extension type is unsupported then the I<arbitrary> extension syntax
2932ad56 55must be used, see the L<ARBITRARY EXTENSIONS|/"ARBITRARY EXTENSIONS"> section for more details.
19f39703
DSH
56
57=head1 STANDARD EXTENSIONS
58
59The following sections describe each supported extension in detail.
60
61=head2 Basic Constraints.
62
63This is a multi valued extension which indicates whether a certificate is
64a CA certificate. The first (mandatory) name is B<CA> followed by B<TRUE> or
65B<FALSE>. If B<CA> is B<TRUE> then an optional B<pathlen> name followed by an
66non-negative value can be included.
67
68For example:
69
70 basicConstraints=CA:TRUE
71
72 basicConstraints=CA:FALSE
73
74 basicConstraints=critical,CA:TRUE, pathlen:0
75
76A CA certificate B<must> include the basicConstraints value with the CA field
77set to TRUE. An end user certificate must either set CA to FALSE or exclude the
78extension entirely. Some software may require the inclusion of basicConstraints
79with CA set to FALSE for end entity certificates.
80
81The pathlen parameter indicates the maximum number of CAs that can appear
82below this one in a chain. So if you have a CA with a pathlen of zero it can
83only be used to sign end user certificates and not further CAs.
84
85
86=head2 Key Usage.
87
88Key usage is a multi valued extension consisting of a list of names of the
89permitted key usages.
90
4c583c36 91The supported names are: digitalSignature, nonRepudiation, keyEncipherment,
19f39703
DSH
92dataEncipherment, keyAgreement, keyCertSign, cRLSign, encipherOnly
93and decipherOnly.
94
95Examples:
96
97 keyUsage=digitalSignature, nonRepudiation
98
99 keyUsage=critical, keyCertSign
100
101
102=head2 Extended Key Usage.
103
104This extensions consists of a list of usages indicating purposes for which
105the certificate public key can be used for,
106
981b5bb8 107These can either be object short names or the dotted numerical form of OIDs.
19f39703
DSH
108While any OID can be used only certain values make sense. In particular the
109following PKIX, NS and MS values are meaningful:
110
1bc74519
RS
111 Value Meaning
112 ----- -------
113 serverAuth SSL/TLS Web Server Authentication.
114 clientAuth SSL/TLS Web Client Authentication.
115 codeSigning Code signing.
116 emailProtection E-mail Protection (S/MIME).
117 timeStamping Trusted Timestamping
118 OCSPSigning OCSP Signing
119 ipsecIKE ipsec Internet Key Exchnage
120 msCodeInd Microsoft Individual Code Signing (authenticode)
121 msCodeCom Microsoft Commercial Code Signing (authenticode)
122 msCTLSign Microsoft Trust List Signing
123 msEFS Microsoft Encrypted File System
19f39703
DSH
124
125Examples:
126
127 extendedKeyUsage=critical,codeSigning,1.2.3.4
0bc2f365 128 extendedKeyUsage=serverAuth,clientAuth
19f39703
DSH
129
130
131=head2 Subject Key Identifier.
132
133This is really a string extension and can take two possible values. Either
134the word B<hash> which will automatically follow the guidelines in RFC3280
135or a hex string giving the extension value to include. The use of the hex
136string is strongly discouraged.
137
138Example:
139
140 subjectKeyIdentifier=hash
141
142
143=head2 Authority Key Identifier.
144
145The authority key identifier extension permits two options. keyid and issuer:
146both can take the optional value "always".
147
148If the keyid option is present an attempt is made to copy the subject key
149identifier from the parent certificate. If the value "always" is present
150then an error is returned if the option fails.
151
152The issuer option copies the issuer and serial number from the issuer
5dd87981
DSH
153certificate. This will only be done if the keyid option fails or
154is not included unless the "always" flag will always include the value.
155
156Example:
157
158 authorityKeyIdentifier=keyid,issuer
19f39703
DSH
159
160
161=head2 Subject Alternative Name.
162
163The subject alternative name extension allows various literal values to be
164included in the configuration file. These include B<email> (an email address)
165B<URI> a uniform resource indicator, B<DNS> (a DNS domain name), B<RID> (a
166registered ID: OBJECT IDENTIFIER), B<IP> (an IP address), B<dirName>
167(a distinguished name) and otherName.
168
169The email option include a special 'copy' value. This will automatically
170include and email addresses contained in the certificate subject name in
171the extension.
172
37dccd8f
DSH
173The IP address used in the B<IP> options can be in either IPv4 or IPv6 format.
174
19f39703
DSH
175The value of B<dirName> should point to a section containing the distinguished
176name to use as a set of name value pairs. Multi values AVAs can be formed by
fc1d88f0 177prefacing the name with a B<+> character.
19f39703
DSH
178
179otherName can include arbitrary data associated with an OID: the value
180should be the OID followed by a semicolon and the content in standard
9b86974e 181L<ASN1_generate_nconf(3)> format.
19f39703
DSH
182
183Examples:
184
185 subjectAltName=email:copy,email:my@other.address,URI:http://my.url.here/
37dccd8f
DSH
186 subjectAltName=IP:192.168.7.1
187 subjectAltName=IP:13::17
19f39703
DSH
188 subjectAltName=email:my@other.address,RID:1.2.3.4
189 subjectAltName=otherName:1.2.3.4;UTF8:some other identifier
190
191 subjectAltName=dirName:dir_sect
192
193 [dir_sect]
194 C=UK
195 O=My Organization
196 OU=My Unit
197 CN=My Name
198
199
200=head2 Issuer Alternative Name.
201
202The issuer alternative name option supports all the literal options of
203subject alternative name. It does B<not> support the email:copy option because
204that would not make sense. It does support an additional issuer:copy option
4c583c36 205that will copy all the subject alternative name values from the issuer
19f39703
DSH
206certificate (if possible).
207
208Example:
209
210 issuserAltName = issuer:copy
211
212
213=head2 Authority Info Access.
214
215The authority information access extension gives details about how to access
216certain information relating to the CA. Its syntax is accessOID;location
217where I<location> has the same syntax as subject alternative name (except
218that email:copy is not supported). accessOID can be any valid OID but only
219certain values are meaningful, for example OCSP and caIssuers.
220
221Example:
222
223 authorityInfoAccess = OCSP;URI:http://ocsp.my.host/
224 authorityInfoAccess = caIssuers;URI:http://my.ca/ca.html
225
226
227=head2 CRL distribution points.
228
83357f04
DSH
229This is a multi-valued extension whose options can be either in name:value pair
230using the same form as subject alternative name or a single value representing
231a section name containing all the distribution point fields.
19f39703 232
83357f04
DSH
233For a name:value pair a new DistributionPoint with the fullName field set to
234the given value both the cRLissuer and reasons fields are omitted in this case.
19f39703 235
83357f04
DSH
236In the single option case the section indicated contains values for each
237field. In this section:
19f39703 238
83357f04
DSH
239If the name is "fullname" the value field should contain the full name
240of the distribution point in the same format as subject alternative name.
241
242If the name is "relativename" then the value field should contain a section
243name whose contents represent a DN fragment to be placed in this field.
244
245The name "CRLIssuer" if present should contain a value for this field in
246subject alternative name format.
247
248If the name is "reasons" the value field should consist of a comma
249separated field containing the reasons. Valid reasons are: "keyCompromise",
250"CACompromise", "affiliationChanged", "superseded", "cessationOfOperation",
251"certificateHold", "privilegeWithdrawn" and "AACompromise".
252
253
254Simple examples:
19f39703
DSH
255
256 crlDistributionPoints=URI:http://myhost.com/myca.crl
257 crlDistributionPoints=URI:http://my.com/my.crl,URI:http://oth.com/my.crl
258
83357f04
DSH
259Full distribution point example:
260
261 crlDistributionPoints=crldp1_section
262
263 [crldp1_section]
264
265 fullname=URI:http://myhost.com/myca.crl
266 CRLissuer=dirName:issuer_sect
267 reasons=keyCompromise, CACompromise
268
269 [issuer_sect]
270 C=UK
271 O=Organisation
272 CN=Some Name
273
274=head2 Issuing Distribution Point
275
276This extension should only appear in CRLs. It is a multi valued extension
277whose syntax is similar to the "section" pointed to by the CRL distribution
278points extension with a few differences.
279
280The names "reasons" and "CRLissuer" are not recognized.
281
282The name "onlysomereasons" is accepted which sets this field. The value is
283in the same format as the CRL distribution point "reasons" field.
284
285The names "onlyuser", "onlyCA", "onlyAA" and "indirectCRL" are also accepted
286the values should be a boolean value (TRUE or FALSE) to indicate the value of
287the corresponding field.
288
289Example:
290
291 issuingDistributionPoint=critical, @idp_section
292
293 [idp_section]
294
295 fullname=URI:http://myhost.com/myca.crl
296 indirectCRL=TRUE
297 onlysomereasons=keyCompromise, CACompromise
298
299 [issuer_sect]
300 C=UK
301 O=Organisation
302 CN=Some Name
303
085ccc54 304
19f39703
DSH
305=head2 Certificate Policies.
306
5dd87981 307This is a I<raw> extension. All the fields of this extension can be set by
19f39703
DSH
308using the appropriate syntax.
309
310If you follow the PKIX recommendations and just using one OID then you just
311include the value of that OID. Multiple OIDs can be set separated by commas,
312for example:
313
314 certificatePolicies= 1.2.4.5, 1.1.3.4
315
316If you wish to include qualifiers then the policy OID and qualifiers need to
317be specified in a separate section: this is done by using the @section syntax
318instead of a literal OID value.
319
320The section referred to must include the policy OID using the name
321policyIdentifier, cPSuri qualifiers can be included using the syntax:
322
323 CPS.nnn=value
324
325userNotice qualifiers can be set using the syntax:
326
327 userNotice.nnn=@notice
328
329The value of the userNotice qualifier is specified in the relevant section.
330This section can include explicitText, organization and noticeNumbers
331options. explicitText and organization are text strings, noticeNumbers is a
332comma separated list of numbers. The organization and noticeNumbers options
333(if included) must BOTH be present. If you use the userNotice option with IE5
334then you need the 'ia5org' option at the top level to modify the encoding:
335otherwise it will not be interpreted properly.
336
337Example:
338
339 certificatePolicies=ia5org,1.2.3.4,1.5.6.7.8,@polsect
340
341 [polsect]
342
343 policyIdentifier = 1.3.5.8
344 CPS.1="http://my.host.name/"
345 CPS.2="http://my.your.name/"
346 userNotice.1=@notice
347
348 [notice]
349
350 explicitText="Explicit Text Here"
351 organization="Organisation Name"
352 noticeNumbers=1,2,3,4
353
354The B<ia5org> option changes the type of the I<organization> field. In RFC2459
355it can only be of type DisplayText. In RFC3280 IA5Strring is also permissible.
356Some software (for example some versions of MSIE) may require ia5org.
357
37dccd8f
DSH
358=head2 Policy Constraints
359
360This is a multi-valued extension which consisting of the names
4c583c36 361B<requireExplicitPolicy> or B<inhibitPolicyMapping> and a non negative integer
37dccd8f
DSH
362value. At least one component must be present.
363
364Example:
365
366 policyConstraints = requireExplicitPolicy:3
367
368
369=head2 Inhibit Any Policy
370
371This is a string extension whose value must be a non negative integer.
372
373Example:
374
375 inhibitAnyPolicy = 2
376
19f39703 377
5dd87981
DSH
378=head2 Name Constraints
379
380The name constraints extension is a multi-valued extension. The name should
381begin with the word B<permitted> or B<excluded> followed by a B<;>. The rest of
382the name and the value follows the syntax of subjectAltName except email:copy
4c583c36 383is not supported and the B<IP> form should consist of an IP addresses and
5dd87981
DSH
384subnet mask separated by a B</>.
385
386Examples:
387
388 nameConstraints=permitted;IP:192.168.0.0/255.255.0.0
389
390 nameConstraints=permitted;email:.somedomain.com
391
392 nameConstraints=excluded;email:.com
085ccc54 393
83357f04 394
137de5b1
DSH
395=head2 OCSP No Check
396
397The OCSP No Check extension is a string extension but its value is ignored.
398
399Example:
400
401 noCheck = ignored
402
5dd87981 403
ba67253d
RS
404=head2 TLS Feature (aka Must Staple)
405
406This is a multi-valued extension consisting of a list of TLS extension
407identifiers. Each identifier may be a number (0..65535) or a supported name.
408When a TLS client sends a listed extension, the TLS server is expected to
409include that extension in its reply.
410
411The supported names are: B<status_request> and B<status_request_v2>.
412
413Example:
414
415 tlsfeature = status_request
416
417
19f39703
DSH
418=head1 DEPRECATED EXTENSIONS
419
5dd87981
DSH
420The following extensions are non standard, Netscape specific and largely
421obsolete. Their use in new applications is discouraged.
19f39703
DSH
422
423=head2 Netscape String extensions.
424
425Netscape Comment (B<nsComment>) is a string extension containing a comment
426which will be displayed when the certificate is viewed in some browsers.
427
428Example:
429
430 nsComment = "Some Random Comment"
431
432Other supported extensions in this category are: B<nsBaseUrl>,
433B<nsRevocationUrl>, B<nsCaRevocationUrl>, B<nsRenewalUrl>, B<nsCaPolicyUrl>
434and B<nsSslServerName>.
435
436
437=head2 Netscape Certificate Type
438
439This is a multi-valued extensions which consists of a list of flags to be
440included. It was used to indicate the purposes for which a certificate could
441be used. The basicConstraints, keyUsage and extended key usage extensions are
442now used instead.
443
444Acceptable values for nsCertType are: B<client>, B<server>, B<email>,
445B<objsign>, B<reserved>, B<sslCA>, B<emailCA>, B<objCA>.
446
447
448=head1 ARBITRARY EXTENSIONS
449
450If an extension is not supported by the OpenSSL code then it must be encoded
451using the arbitrary extension format. It is also possible to use the arbitrary
452format for supported extensions. Extreme care should be taken to ensure that
453the data is formatted correctly for the given extension type.
454
455There are two ways to encode arbitrary extensions.
456
457The first way is to use the word ASN1 followed by the extension content
9b86974e 458using the same syntax as L<ASN1_generate_nconf(3)>.
51cc37b6 459For example:
19f39703
DSH
460
461 1.2.3.4=critical,ASN1:UTF8String:Some random data
462
463 1.2.3.4=ASN1:SEQUENCE:seq_sect
464
465 [seq_sect]
466
467 field1 = UTF8:field1
468 field2 = UTF8:field2
469
470It is also possible to use the word DER to include the raw encoded data in any
471extension.
472
473 1.2.3.4=critical,DER:01:02:03:04
474 1.2.3.4=DER:01020304
475
476The value following DER is a hex dump of the DER encoding of the extension
477Any extension can be placed in this form to override the default behaviour.
478For example:
479
480 basicConstraints=critical,DER:00:01:02:03
481
482=head1 WARNING
483
484There is no guarantee that a specific implementation will process a given
485extension. It may therefore be sometimes possible to use certificates for
486purposes prohibited by their extensions because a specific application does
487not recognize or honour the values of the relevant extensions.
488
489The DER and ASN1 options should be used with caution. It is possible to create
490totally invalid extensions if they are not used carefully.
491
492
493=head1 NOTES
494
495If an extension is multi-value and a field value must contain a comma the long
496form must be used otherwise the comma would be misinterpreted as a field
497separator. For example:
498
499 subjectAltName=URI:ldap://somehost.com/CN=foo,OU=bar
500
501will produce an error but the equivalent form:
502
503 subjectAltName=@subject_alt_section
504
505 [subject_alt_section]
506 subjectAltName=URI:ldap://somehost.com/CN=foo,OU=bar
507
4c583c36 508is valid.
19f39703
DSH
509
510Due to the behaviour of the OpenSSL B<conf> library the same field name
511can only occur once in a section. This means that:
512
513 subjectAltName=@alt_section
514
515 [alt_section]
516
517 email=steve@here
518 email=steve@there
519
520will only recognize the last value. This can be worked around by using the form:
521
522 [alt_section]
523
524 email.1=steve@here
525 email.2=steve@there
5dd87981 526
5dd87981
DSH
527=head1 SEE ALSO
528
9b86974e
RS
529L<req(1)>, L<ca(1)>, L<x509(1)>,
530L<ASN1_generate_nconf(3)>
5dd87981
DSH
531
532
e2f92610
RS
533=cut
534
535=head1 COPYRIGHT
536
537Copyright 2004-2016 The OpenSSL Project Authors. All Rights Reserved.
538
539Licensed under the OpenSSL license (the "License"). You may not use
540this file except in compliance with the License. You can obtain a copy
541in the file LICENSE in the source distribution or at
542L<https://www.openssl.org/source/license.html>.
543
5dd87981 544=cut