x509v3_config.pod 16 KB

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