x509v3_config.pod 16 KB

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