]> git.ipfire.org Git - thirdparty/openssl.git/blame - doc/openssl.txt
Suppport for CRL distribution points extension. Also document some of
[thirdparty/openssl.git] / doc / openssl.txt
CommitLineData
f5904406
RE
1
2This is some preliminary documentation for OpenSSL.
3
4==============================================================================
5 BUFFER Library
6==============================================================================
7
8[Note: I wrote this when I saw a Malloc version of strdup() in there which
9 I'd written myself anyway. I was so annoyed at not noticing this I decided to
10 document it :-) Steve.]
11
12The buffer library handles simple character arrays. Buffers are used for various
13purposes in the library, most notably memory BIOs.
14
15The library uses the BUF_MEM structure defined in buffer.h:
16
17typedef struct buf_mem_st
18 {
19 int length; /* current number of bytes */
20 char *data;
21 int max; /* size of buffer */
22 } BUF_MEM;
23
24'length' is the current size of the buffer in bytes, 'max' is the amount of
25memory allocated to the buffer. There are three functions which handle these
26and one "miscelanous" function.
27
28BUF_MEM *BUF_MEM_new()
29
30This allocates a new buffer of zero size. Returns the buffer or NULL on error.
31
32void BUF_MEM_free(BUF_MEM *a)
33
34This frees up an already existing buffer. The data is zeroed before freeing
35up in case the buffer contains sensitive data.
36
37int BUF_MEM_grow(BUF_MEM *str, int len)
38
39This changes the size of an already existing buffer. It returns zero on error
40or the new size (i.e. 'len'). Any data already in the buffer is preserved if
41it increases in size.
42
43char * BUF_strdup(char *str)
44
45This is the previously mentioned strdup function: like the standard library
46strdup() it copies a null terminated string into a block of allocated memory
47and returns a pointer to the allocated block.
48
49Unlike the standard C library strdup() this function uses Malloc() and so
50should be used in preference to the standard library strdup() because it can
51be used for memory leak checking or replacing the malloc() function.
52
53The memory allocated from BUF_strdup() should be freed up using the Free()
54function.
55
56==============================================================================
57 OpenSSL X509V3 extension configuration
58==============================================================================
59
deff75b6
DSH
60OpenSSL X509V3 extension configuration: preliminary documentation.
61
62INTRODUCTION.
63
64For OpenSSL 0.9.2 the extension code has be considerably enhanced. It is now
65possible to add and print out common X509 V3 certificate and CRL extensions.
66
67For more information about the meaning of extensions see:
68
69http://www.imc.org/ietf-pkix/
70http://home.netscape.com/eng/security/certs.html
71
72PRINTING EXTENSIONS.
73
74Extension values are automatically printed out for supported extensions.
75
1756d405
DSH
76openssl x509 -in cert.pem -text
77openssl crl -in crl.pem -text
deff75b6
DSH
78
79will give information in the extension printout, for example:
80
81
82 X509v3 extensions:
83 X509v3 Basic Constraints:
84 CA:TRUE
85 X509v3 Subject Key Identifier:
86 73:FE:F7:59:A7:E1:26:84:44:D6:44:36:EE:79:1A:95:7C:B1:4B:15
87 X509v3 Authority Key Identifier:
88 keyid:73:FE:F7:59:A7:E1:26:84:44:D6:44:36:EE:79:1A:95:7C:B1:4B:15, DirName:/C=AU/ST=Some-State/O=Internet Widgits Pty Ltd/Email=email@1.address/Email=email@2.address, serial:00
89 X509v3 Key Usage:
90 Certificate Sign, CRL Sign
91 X509v3 Subject Alternative Name:
92 email:email@1.address, email:email@2.address
93
94CONFIGURATION FILES.
95
96The OpenSSL utilities 'ca' and 'req' can now have extension sections listing
97which certificate extensions to include. In each case a line:
98
99x509_extensions = extension_section
100
101indicates which section contains the extensions. In the case of 'req' the
102extension section is used when the -x509 option is present to create a
103self signed root certificate.
104
1756d405
DSH
105You can also add extensions to CRLs: a line
106
107crl_extensions = crl_extension_section
108
109will include extensions when the -gencrl option is used with the 'ca' utility.
110You can add any extension to a CRL but of the supported extensions only
111issuerAltName and authorityKeyIdentifier make any real sense. Note: these are
112CRL extensions NOT CRL *entry* extensions which cannot currently be generated.
113CRL entry extensions can be displayed.
114
deff75b6
DSH
115EXTENSION SYNTAX.
116
117Extensions have the basic form:
118
119extension_name=[critical,] extension_options
120
121the use of the critical option makes the extension critical. Extreme caution
122should be made when using the critical flag. If an extension is marked
123as critical then any client that does not understand the extension should
124reject it as invalid. Some broken software will reject certificates which
125have *any* critical extensions (these violates PKIX but we have to live
126with it).
127
128There are three main types of extension, string extensions, multi valued
129extensions, and raw extensions.
130
131String extensions simply have a string which defines the value of the or how
132it is obtained.
133
134For example:
135
136nsComment="This is a Comment"
137
138Multi valued extensions have a short form and a long form. The short form
139is a list of names and values:
140
141basicConstraints=critical,CA:true,pathlen:1
142
143The long form allows the values to be placed in a separate section:
144
145basicConstraints=critical,@bs_section
146
147[bs_section]
148
149CA=true
150pathlen=1
151
152Both forms are equivalent. However it should be noted that in some cases the
153same name can appear multiple times, for example,
154
155subjectAltName=email:steve@here,email:steve@there
156
157in this case an equivalent long form is:
158
159subjectAltName=@alt_section
160
161[alt_section]
162
163email.1=steve@here
164email.2=steve@there
165
166This is because the configuration file code cannot handle the same name
167occurring twice in the same extension.
168
169Raw extensions allow arbitrary data to be placed in an extension. For
170example
171
1721.2.3.4=critical,RAW:01:02:03:04
1731.2.3.4=RAW:01020304
174
175The value following RAW is a hex dump of the extension contents. Any extension
176can be placed in this form to override the default behaviour. For example:
177
178basicConstraints=critical,RAW:00:01:02:03
179
180WARNING: raw extensions should be used with caution. It is possible to create
181totally invalid extensions unless care is taken.
182
183CURRENTLY SUPPORTED EXTENSIONS.
184
185Literal String extensions.
186
187In each case the 'value' of the extension is placed directly in the extension.
188Currently supported extensions in this category are: nsBaseUrl, nsRevocationUrl
189nsCaRevocationUrl, nsRenewalUrl, nsCaPolicyUrl, nsSslServerName and
190nsComment.
191
192For example:
193
194nsComment="This is a test comment"
195
196Bit Strings.
197
198Bit string extensions just consist of a list of suppported bits, currently
199two extensions are in this category: PKIX keyUsage and the Netscape specific
200nsCertType.
201
202nsCertType (netscape certificate type) takes the flags: client, server, email,
203objsign, reserved, sslCA, emailCA, objCA.
204
205keyUsage (PKIX key usage) takes the flags: digitalSignature, nonRepudiation,
94c95d04 206keyEncipherment, dataEncipherment, keyAgreement, keyCertSign, cRLSign,
deff75b6
DSH
207encipherOnly, decipherOnly.
208
209For example:
210
211nsCertType=server
212
213keyUsage=critical, digitalSignature, nonRepudiation
214
215
216Basic Constraints.
217
218Basic constraints is a multi valued extension that supports a CA and an
219optional pathlen option. The CA option takes the values true and false and
220pathlen takes an integer. Note if the CA option is false the pathlen option
221should be omitted.
222
223Examples:
224
225basicConstraints=CA:TRUE
226basicConstraints=critical,CA:TRUE, pathlen:10
227
228NOTE: for a CA to be considered valid it must have the CA option set to
229TRUE. An end user certificate MUST NOT have the CA value set to true.
230According to PKIX recommendations it should exclude the extension entirely
231however some software may require CA set to FALSE for end entity certificates.
232
233Subject Key Identifier.
234
235This is really a string extension and can take two possible values. Either
236a hex string giving details of the extension value to include or the word
237'hash' which then automatically follow PKIX guidelines in selecting and
238appropriate key identifier. The use of the hex string is strongly discouraged.
239
240Example: subjectKeyIdentifier=hash
241
242Authority Key Identifier.
243
244The authority key identifier extension permits two options. keyid and issuer:
245both can take the optional value "always".
246
247If the keyid option is present an attempt is made to copy the subject key
248identifier from the parent certificate. If the value "always" is present
249then an error is returned if the option fails.
250
251The issuer option copies the issuer and serial number from the issuer
252certificate. Normally this will only be done if the keyid option fails or
253is not included: the "always" flag will always include the value.
254
255Subject Alternative Name.
256
257The subject alternative name extension allows various literal values to be
258included in the configuration file. These include "email" (an email address)
259"URI" a uniform resource indicator, "DNS" (a DNS domain name), RID (a
260registered ID: OBJECT IDENTIFIER) and IP (and IP address).
261
262Also the email option include a special 'copy' value. This will automatically
263include and email addresses contained in the certificate subject name in
264the extension.
265
266Examples:
267
268subjectAltName=email:copy,email:my@other.address,URL:http://my.url.here/
269subjectAltName=email:my@other.address,RID:1.2.3.4
270
271Issuer Alternative Name.
272
273The issuer alternative name option supports all the literal options of
274subject alternative name. It does *not* support the email:copy option because
d943e372 275that would not make sense. It does support an additional issuer:copy option
deff75b6
DSH
276that will copy all the subject alternative name values from the issuer
277certificate (if possible).
278
d943e372
DSH
279CRL distribution points.
280
281This is a multivalued extension that supports all the literal options of
282subject alternative name. Of the few software packages that currently interpret
283this extension most only interpret the URI option.
284
285Currently each option will set a new DistributionPoint with the fullName
286field set to the given value.
287
288Other fields like cRLissuer and reasons cannot currently be set or displayed:
289at this time no examples were available that used these fields.
290
291If you see this extension with <UNSUPPORTED> when you attempt to print it out
292or it doesn't appear to display correctly then let me know, including the
293certificate (mail me at steve@openssl.org) .
294
295Examples:
296
297crlDistributionPoints=URI:http://www.myhost.com/myca.crl
298crlDistributionPoints=URI:http://www.my.com/my.crl,URI:http://www.oth.com/my.crl
299
300Certificate Policies.
301
302This is a RAW extension. It attempts to display the contents of this extension:
303unfortuntately this extension is often improperly encoded.
304
305The certificate policies extension will rarely be used in practice: few
306software packages interpret it correctly or at all.
307
308All the fields of this extension can be set by using the appropriate syntax.
309
310If you follow the PKIX recommendations of not including any qualifiers and just
311using only one OID then you just include the value of that OID. Multiple OIDs
312can be set separated by commas, for example:
313
314certificatePolicies= 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
323CPS.nnn=value
324
325userNotice qualifiers can be set using the syntax:
326
327userNotice.nnn=@notice
328
329The value of the userNotice qualifier is specified in the relevant section. This
330section can include explicitText, organization and noticeNumbers options.
331explicitText and organization are text strings, noticeNumbers is a comma
332separated list of numbers. The organization and noticeNumbers options (if
333included) must BOTH be present.
334
335Example:
336
337certificatePolicies=1.2.3.4,1.5.6.7.8,@polsect
338
339[polsect]
340
341policyIdentifier = 1.3.5.8
342CPS.1="http://my.host.name/"
343CPS.2="http://my.your.name/"
344userNotice.1=@notice
345
346[notice]
347
348explicitText="Explicit Text Here"
349organization="Organisation Name"
350noticeNumbers=1,2,3,4
351
deff75b6
DSH
352Display only extensions.
353
354Some extensions are only partially supported and currently are only displayed
355but cannot be set. These include private key usage period, CRL number, and
356CRL reason.
f5904406 357