5 x509v3_config - X509 V3 certificate extension configuration format
9 Several OpenSSL commands can add extensions to a certificate or
10 certificate request based on the contents of a configuration file
11 and CLI options such as B<-addext>.
12 The syntax of configuration files is described in L<config(5)>.
13 The commands typically have an option to specify the name of the configuration
14 file, and a section within that file; see the documentation of the
15 individual command for details.
17 This page uses B<extensions> as the name of the section, when needed
20 Each entry in the extension section takes the form:
22 name = [critical, ]value(s)
24 If B<critical> is present then the extension will be marked as critical.
26 If multiple entries are processed for the same extension name,
27 later entries override earlier ones with the same name.
29 The format of B<values> depends on the value of B<name>, many have a
30 type-value pairing where the type and value are separated by a colon.
31 There are four main types of extension:
38 Each is described in the following paragraphs.
40 String extensions simply have a string which contains either the value itself
41 or how it is obtained.
43 Multi-valued extensions have a short form and a long form. The short form
44 is a comma-separated list of names and values:
46 basicConstraints = critical, CA:true, pathlen:1
48 The long form allows the values to be placed in a separate section:
51 basicConstraints = critical, @basic_constraints
57 Both forms are equivalent.
59 If an extension is multi-value and a field value must contain a comma the long
60 form must be used otherwise the comma would be misinterpreted as a field
61 separator. For example:
63 subjectAltName = URI:ldap://somehost.com/CN=foo,OU=bar
65 will produce an error but the equivalent form:
68 subjectAltName = @subject_alt_section
71 subjectAltName = URI:ldap://somehost.com/CN=foo,OU=bar
75 OpenSSL does not support multiple occurrences of the same field within a
76 section. In this example:
79 subjectAltName = @alt_section
82 email = steve@example.com
83 email = steve@example.org
85 will only recognize the last value. To specify multiple values append a
86 numeric identifier, as shown here:
89 subjectAltName = @alt_section
92 email.1 = steve@example.com
93 email.2 = steve@example.org
95 The syntax of raw extensions is defined by the source code that parses
96 the extension but should be documened.
97 See L</Certificate Policies> for an example of a raw extension.
99 If an extension type is unsupported, then the I<arbitrary> extension syntax
100 must be used, see the L</ARBITRARY EXTENSIONS> section for more details.
102 =head1 STANDARD EXTENSIONS
104 The following sections describe the syntax of each supported extension.
105 They do not define the semantics of the extension.
107 =head2 Basic Constraints
109 This is a multi-valued extension which indicates whether a certificate is
110 a CA certificate. The first value is B<CA> followed by B<TRUE> or
111 B<FALSE>. If B<CA> is B<TRUE> then an optional B<pathlen> name followed by a
112 nonnegative value can be included.
116 basicConstraints = CA:TRUE
118 basicConstraints = CA:FALSE
120 basicConstraints = critical, CA:TRUE, pathlen:1
122 A CA certificate I<must> include the B<basicConstraints> name with the B<CA>
123 parameter set to B<TRUE>. An end-user certificate must either have B<CA:FALSE>
124 or omit the extension entirely.
125 The B<pathlen> parameter specifies the maximum number of CAs that can appear
126 below this one in a chain. A B<pathlen> of zero means the CA cannot sign
127 any sub-CA's, and can only sign end-entity certificates.
131 Key usage is a multi-valued extension consisting of a list of names of
132 the permitted key usages. The defined values are: C<digitalSignature>,
133 C<nonRepudiation>, C<keyEncipherment>, C<dataEncipherment>, C<keyAgreement>,
134 C<keyCertSign>, C<cRLSign>, C<encipherOnly>, and C<decipherOnly>.
138 keyUsage = digitalSignature, nonRepudiation
140 keyUsage = critical, keyCertSign
142 =head2 Extended Key Usage
144 This extension consists of a list of values indicating purposes for which
145 the certificate public key can be used.
146 Each value can be either a short text name or an OID.
147 The following text names, and their intended meaning, are known:
149 Value Meaning according to RFC 5280 etc.
150 ----- ----------------------------------
151 serverAuth SSL/TLS WWW Server Authentication
152 clientAuth SSL/TLS WWW Client Authentication
153 codeSigning Code Signing
154 emailProtection E-mail Protection (S/MIME)
155 timeStamping Trusted Timestamping
156 OCSPSigning OCSP Signing
157 ipsecIKE ipsec Internet Key Exchange
158 msCodeInd Microsoft Individual Code Signing (authenticode)
159 msCodeCom Microsoft Commercial Code Signing (authenticode)
160 msCTLSign Microsoft Trust List Signing
161 msEFS Microsoft Encrypted File System
163 While IETF RFC 5280 says that B<id-kp-serverAuth> and B<id-kp-clientAuth>
164 are only for WWW use, in practice they are used for all kinds of TLS clients
165 and servers, and this is what OpenSSL assumes as well.
169 extendedKeyUsage = critical, codeSigning, 1.2.3.4
171 extendedKeyUsage = serverAuth, clientAuth
173 =head2 Subject Key Identifier
175 The SKID extension specification has a value with three choices.
176 If the value is the word B<none> then no SKID extension will be included.
177 If the value is the word B<hash>, or by default for the B<x509>, B<req>, and
178 B<ca> apps, the process specified in RFC 5280 section 4.2.1.2. (1) is followed:
179 The keyIdentifier is composed of the 160-bit SHA-1 hash of the value of the BIT
180 STRING subjectPublicKey (excluding the tag, length, and number of unused bits).
182 Otherwise, the value must be a hex string (possibly with C<:> separating bytes)
183 to output directly, however, this is strongly discouraged.
187 subjectKeyIdentifier = hash
189 =head2 Authority Key Identifier
191 The AKID extension specification may have the value B<none>
192 indicating that no AKID shall be included.
193 Otherwise it may have the value B<keyid> or B<issuer>
194 or both of them, separated by C<,>.
195 Either or both can have the option B<always>,
196 indicated by putting a colon C<:> between the value and this option.
197 By default the B<x509>, B<req>, and B<ca> apps behave as if
198 "none" was given for self-signed certificates and "keyid, issuer" otherwise.
200 If B<keyid> is present, an attempt is made to compute the hash of the public key
201 corresponding to the signing key in case the certificate is self-signed,
202 or else to copy the subject key identifier (SKID) from the issuer certificate.
203 If this fails and the option B<always> is present, an error is returned.
205 If B<issuer> is present, and in addition it has the option B<always> specified
206 or B<keyid> is not present,
207 then the issuer DN and serial number are copied from the issuer certificate.
211 authorityKeyIdentifier = keyid, issuer
213 authorityKeyIdentifier = keyid, issuer:always
215 =head2 Subject Alternative Name
217 This is a multi-valued extension that supports several types of name
218 identifier, including
219 B<email> (an email address),
220 B<URI> (a uniform resource indicator),
221 B<DNS> (a DNS domain name),
222 B<RID> (a registered ID: OBJECT IDENTIFIER),
223 B<IP> (an IP address),
224 B<dirName> (a distinguished name),
226 The syntax of each is described in the following paragraphs.
228 The B<email> option has a special C<copy> value, which will automatically
229 include any email addresses contained in the certificate subject name in
232 The IP address used in the B<IP> option can be in either IPv4 or IPv6 format.
234 The value of B<dirName> is specifies the configuration section containing
235 the distinguished name to use, as a set of name-value pairs.
236 Multi-valued AVAs can be formed by prefacing the name with a B<+> character.
238 The value of B<otherName> can include arbitrary data associated with an OID;
239 the value should be the OID followed by a semicolon and the content in specified
240 using the syntax in L<ASN1_generate_nconf(3)>.
244 subjectAltName = email:copy, email:my@example.com, URI:http://my.example.com/
246 subjectAltName = IP:192.168.7.1
248 subjectAltName = IP:13::17
250 subjectAltName = email:my@example.com, RID:1.2.3.4
252 subjectAltName = otherName:1.2.3.4;UTF8:some other identifier
255 subjectAltName = dirName:dir_sect
263 Non-ASCII Email Address conforming the syntax defined in Section 3.3 of RFC 6531
264 are provided as otherName.SmtpUTF8Mailbox. According to RFC 8398, the email
265 address should be provided as UTF8String. To enforce the valid representation in
266 the certificate, the SmtpUTF8Mailbox should be provided as follows
270 otherName = 1.3.6.1.5.5.7.8.9;FORMAT:UTF8,UTF8String:nonasciiname.example.com
272 =head2 Issuer Alternative Name
274 This extension supports most of the options of subject alternative name;
275 it does not support B<email:copy>.
276 It also adds B<issuer:copy> as an allowed value, which copies any subject
277 alternative names from the issuer certificate, if possible.
281 issuerAltName = issuer:copy
283 =head2 Authority Info Access
285 This extension gives details about how to retrieve information that
286 related to the certificate that the CA makes available. The syntax is
287 B<access_id;location>, where B<access_id> is an object identifier
288 (although only a few values are well-known) and B<location> has the same
289 syntax as subject alternative name (except that B<email:copy> is not supported).
291 Possible values for access_id include B<OCSP> (OCSP responder),
292 B<caIssuers> (CA Issuers),
293 B<ad_timestamping> (AD Time Stamping),
294 B<AD_DVCS> (ad dvcs),
295 B<caRepository> (CA Repository).
299 authorityInfoAccess = OCSP;URI:http://ocsp.example.com/,caIssuers;URI:http://myca.example.com/ca.cer
301 authorityInfoAccess = OCSP;URI:http://ocsp.example.com/
303 =head2 CRL distribution points
305 This is a multi-valued extension whose values can be either a name-value
306 pair using the same form as subject alternative name or a single value
307 specifying the section name containing all the distribution point values.
309 When a name-value pair is used, a DistributionPoint extension will
310 be set with the given value as the fullName field as the distributionPoint
311 value, and the reasons and cRLIssuer fields will be omitted.
313 When a single option is used, the value specifies the section, and that
314 section can have the following items:
320 The full name of the distribution point, in the same format as the subject
325 The value is taken as a distinguished name fragment that is set as the
326 value of the nameRelativeToCRLIssuer field.
330 The value must in the same format as the subject alternative name.
334 A multi-value field that contains the reasons for revocation. The recognized
335 values are: C<keyCompromise>, C<CACompromise>, C<affiliationChanged>,
336 C<superseded>, C<cessationOfOperation>, C<certificateHold>,
337 C<privilegeWithdrawn>, and C<AACompromise>.
341 Only one of B<fullname> or B<relativename> should be specified.
345 crlDistributionPoints = URI:http://example.com/myca.crl
347 crlDistributionPoints = URI:http://example.com/myca.crl, URI:http://example.org/my.crl
349 Full distribution point example:
352 crlDistributionPoints = crldp1_section
355 fullname = URI:http://example.com/myca.crl
356 CRLissuer = dirName:issuer_sect
357 reasons = keyCompromise, CACompromise
364 =head2 Issuing Distribution Point
366 This extension should only appear in CRLs. It is a multi-valued extension
367 whose syntax is similar to the "section" pointed to by the CRL distribution
368 points extension. The following names have meaning:
374 The full name of the distribution point, in the same format as the subject
379 The value is taken as a distinguished name fragment that is set as the
380 value of the nameRelativeToCRLIssuer field.
382 =item onlysomereasons
384 A multi-value field that contains the reasons for revocation. The recognized
385 values are: C<keyCompromise>, C<CACompromise>, C<affiliationChanged>,
386 C<superseded>, C<cessationOfOperation>, C<certificateHold>,
387 C<privilegeWithdrawn>, and C<AACompromise>.
389 =item onlyuser, onlyCA, onlyAA, indirectCRL
391 The value for each of these names is a boolean.
398 issuingDistributionPoint = critical, @idp_section
401 fullname = URI:http://example.com/myca.crl
403 onlysomereasons = keyCompromise, CACompromise
405 =head2 Certificate Policies
407 This is a I<raw> extension that supports all of the defined fields of the
408 certificate extension.
410 Policies without qualifiers are specified by giving the OID.
411 Multiple policies are comma-separated. For example:
413 certificatePolicies = 1.2.4.5, 1.1.3.4
415 To include policy qualifiers, use the "@section" syntax to point to a
416 section that specifies all the information.
418 The section referred to must include the policy OID using the name
419 B<policyIdentifier>. cPSuri qualifiers can be included using the syntax:
423 where C<nnn> is a number.
425 userNotice qualifiers can be set using the syntax:
427 userNotice.nnn = @notice
429 The value of the userNotice qualifier is specified in the relevant section.
430 This section can include B<explicitText>, B<organization>, and B<noticeNumbers>
431 options. explicitText and organization are text strings, noticeNumbers is a
432 comma separated list of numbers. The organization and noticeNumbers options
433 (if included) must BOTH be present. Some software might require
434 the B<ia5org> option at the top level; this changes the encoding from
435 Displaytext to IA5String.
440 certificatePolicies = ia5org, 1.2.3.4, 1.5.6.7.8, @polsect
443 policyIdentifier = 1.3.5.8
444 CPS.1 = "http://my.host.example.com/"
445 CPS.2 = "http://my.your.example.com/"
446 userNotice.1 = @notice
449 explicitText = "Explicit Text Here"
450 organization = "Organisation Name"
451 noticeNumbers = 1, 2, 3, 4
453 The character encoding of explicitText can be specified by prefixing the
454 value with B<UTF8>, B<BMP>, or B<VISIBLE> followed by colon. For example:
457 explicitText = "UTF8:Explicit Text Here"
459 =head2 Policy Constraints
461 This is a multi-valued extension which consisting of the names
462 B<requireExplicitPolicy> or B<inhibitPolicyMapping> and a non negative integer
463 value. At least one component must be present.
467 policyConstraints = requireExplicitPolicy:3
469 =head2 Inhibit Any Policy
471 This is a string extension whose value must be a non negative integer.
477 =head2 Name Constraints
479 This is a multi-valued extension. The name should
480 begin with the word B<permitted> or B<excluded> followed by a B<;>. The rest of
481 the name and the value follows the syntax of subjectAltName except
483 is not supported and the B<IP> form should consist of an IP addresses and
484 subnet mask separated by a B</>.
488 nameConstraints = permitted;IP:192.168.0.0/255.255.0.0
490 nameConstraints = permitted;email:.example.com
492 nameConstraints = excluded;email:.com
496 This is a string extension. It is parsed, but ignored.
502 =head2 TLS Feature (aka Must Staple)
504 This is a multi-valued extension consisting of a list of TLS extension
505 identifiers. Each identifier may be a number (0..65535) or a supported name.
506 When a TLS client sends a listed extension, the TLS server is expected to
507 include that extension in its reply.
509 The supported names are: B<status_request> and B<status_request_v2>.
513 tlsfeature = status_request
515 =head1 DEPRECATED EXTENSIONS
517 The following extensions are non standard, Netscape specific and largely
518 obsolete. Their use in new applications is discouraged.
520 =head2 Netscape String extensions
522 Netscape Comment (B<nsComment>) is a string extension containing a comment
523 which will be displayed when the certificate is viewed in some browsers.
524 Other extensions of this type are: B<nsBaseUrl>,
525 B<nsRevocationUrl>, B<nsCaRevocationUrl>, B<nsRenewalUrl>, B<nsCaPolicyUrl>
526 and B<nsSslServerName>.
528 =head2 Netscape Certificate Type
530 This is a multi-valued extensions which consists of a list of flags to be
531 included. It was used to indicate the purposes for which a certificate could
532 be used. The basicConstraints, keyUsage and extended key usage extensions are
535 Acceptable values for nsCertType are: B<client>, B<server>, B<email>,
536 B<objsign>, B<reserved>, B<sslCA>, B<emailCA>, B<objCA>.
538 =head1 ARBITRARY EXTENSIONS
540 If an extension is not supported by the OpenSSL code then it must be encoded
541 using the arbitrary extension format. It is also possible to use the arbitrary
542 format for supported extensions. Extreme care should be taken to ensure that
543 the data is formatted correctly for the given extension type.
545 There are two ways to encode arbitrary extensions.
547 The first way is to use the word ASN1 followed by the extension content
548 using the same syntax as L<ASN1_generate_nconf(3)>.
552 1.2.3.4 = critical, ASN1:UTF8String:Some random data
553 1.2.3.4.1 = ASN1:SEQUENCE:seq_sect
559 It is also possible to use the word DER to include the raw encoded data in any
562 1.2.3.4 = critical, DER:01:02:03:04
563 1.2.3.4.1 = DER:01020304
565 The value following DER is a hex dump of the DER encoding of the extension
566 Any extension can be placed in this form to override the default behaviour.
569 basicConstraints = critical, DER:00:01:02:03
573 There is no guarantee that a specific implementation will process a given
574 extension. It may therefore be sometimes possible to use certificates for
575 purposes prohibited by their extensions because a specific application does
576 not recognize or honour the values of the relevant extensions.
578 The DER and ASN1 options should be used with caution. It is possible to create
579 invalid extensions if they are not used carefully.
583 L<openssl-req(1)>, L<openssl-ca(1)>, L<openssl-x509(1)>,
584 L<ASN1_generate_nconf(3)>
588 Copyright 2004-2021 The OpenSSL Project Authors. All Rights Reserved.
590 Licensed under the Apache License 2.0 (the "License"). You may not use
591 this file except in compliance with the License. You can obtain a copy
592 in the file LICENSE in the source distribution or at
593 L<https://www.openssl.org/source/license.html>.