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