Merge from vendor branch OPENSSL:
[dragonfly.git] / secure / lib / libssl / man / SSL_CTX_load_verify_locations.3
1 .\" Automatically generated by Pod::Man version 1.15
2 .\" Wed Feb 19 16:47:38 2003
3 .\"
4 .\" Standard preamble:
5 .\" ======================================================================
6 .de Sh \" Subsection heading
7 .br
8 .if t .Sp
9 .ne 5
10 .PP
11 \fB\\$1\fR
12 .PP
13 ..
14 .de Sp \" Vertical space (when we can't use .PP)
15 .if t .sp .5v
16 .if n .sp
17 ..
18 .de Ip \" List item
19 .br
20 .ie \\n(.$>=3 .ne \\$3
21 .el .ne 3
22 .IP "\\$1" \\$2
23 ..
24 .de Vb \" Begin verbatim text
25 .ft CW
26 .nf
27 .ne \\$1
28 ..
29 .de Ve \" End verbatim text
30 .ft R
31
32 .fi
33 ..
34 .\" Set up some character translations and predefined strings.  \*(-- will
35 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
36 .\" double quote, and \*(R" will give a right double quote.  | will give a
37 .\" real vertical bar.  \*(C+ will give a nicer C++.  Capital omega is used
38 .\" to do unbreakable dashes and therefore won't be available.  \*(C` and
39 .\" \*(C' expand to `' in nroff, nothing in troff, for use with C<>
40 .tr \(*W-|\(bv\*(Tr
41 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
42 .ie n \{\
43 .    ds -- \(*W-
44 .    ds PI pi
45 .    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
46 .    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
47 .    ds L" ""
48 .    ds R" ""
49 .    ds C` ""
50 .    ds C' ""
51 'br\}
52 .el\{\
53 .    ds -- \|\(em\|
54 .    ds PI \(*p
55 .    ds L" ``
56 .    ds R" ''
57 'br\}
58 .\"
59 .\" If the F register is turned on, we'll generate index entries on stderr
60 .\" for titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and
61 .\" index entries marked with X<> in POD.  Of course, you'll have to process
62 .\" the output yourself in some meaningful fashion.
63 .if \nF \{\
64 .    de IX
65 .    tm Index:\\$1\t\\n%\t"\\$2"
66 ..
67 .    nr % 0
68 .    rr F
69 .\}
70 .\"
71 .\" For nroff, turn off justification.  Always turn off hyphenation; it
72 .\" makes way too many mistakes in technical documents.
73 .hy 0
74 .if n .na
75 .\"
76 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
77 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
78 .bd B 3
79 .    \" fudge factors for nroff and troff
80 .if n \{\
81 .    ds #H 0
82 .    ds #V .8m
83 .    ds #F .3m
84 .    ds #[ \f1
85 .    ds #] \fP
86 .\}
87 .if t \{\
88 .    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
89 .    ds #V .6m
90 .    ds #F 0
91 .    ds #[ \&
92 .    ds #] \&
93 .\}
94 .    \" simple accents for nroff and troff
95 .if n \{\
96 .    ds ' \&
97 .    ds ` \&
98 .    ds ^ \&
99 .    ds , \&
100 .    ds ~ ~
101 .    ds /
102 .\}
103 .if t \{\
104 .    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
105 .    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
106 .    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
107 .    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
108 .    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
109 .    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
110 .\}
111 .    \" troff and (daisy-wheel) nroff accents
112 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
113 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
114 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
115 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
116 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
117 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
118 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
119 .ds ae a\h'-(\w'a'u*4/10)'e
120 .ds Ae A\h'-(\w'A'u*4/10)'E
121 .    \" corrections for vroff
122 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
123 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
124 .    \" for low resolution devices (crt and lpr)
125 .if \n(.H>23 .if \n(.V>19 \
126 \{\
127 .    ds : e
128 .    ds 8 ss
129 .    ds o a
130 .    ds d- d\h'-1'\(ga
131 .    ds D- D\h'-1'\(hy
132 .    ds th \o'bp'
133 .    ds Th \o'LP'
134 .    ds ae ae
135 .    ds Ae AE
136 .\}
137 .rm #[ #] #H #V #F C
138 .\" ======================================================================
139 .\"
140 .IX Title "SSL_CTX_load_verify_locations 3"
141 .TH SSL_CTX_load_verify_locations 3 "0.9.7a" "2003-02-19" "OpenSSL"
142 .UC
143 .SH "NAME"
144 SSL_CTX_load_verify_locations \- set default locations for trusted \s-1CA\s0
145 certificates
146 .SH "SYNOPSIS"
147 .IX Header "SYNOPSIS"
148 .Vb 1
149 \& #include <openssl/ssl.h>
150 .Ve
151 .Vb 2
152 \& int SSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *CAfile,
153 \&                                   const char *CApath);
154 .Ve
155 .SH "DESCRIPTION"
156 .IX Header "DESCRIPTION"
157 \&\fISSL_CTX_load_verify_locations()\fR specifies the locations for \fBctx\fR, at
158 which \s-1CA\s0 certificates for verification purposes are located. The certificates
159 available via \fBCAfile\fR and \fBCApath\fR are trusted.
160 .SH "NOTES"
161 .IX Header "NOTES"
162 If \fBCAfile\fR is not \s-1NULL\s0, it points to a file of \s-1CA\s0 certificates in \s-1PEM\s0
163 format. The file can contain several \s-1CA\s0 certificates identified by
164 .PP
165 .Vb 3
166 \& -----BEGIN CERTIFICATE-----
167 \& ... (CA certificate in base64 encoding) ...
168 \& -----END CERTIFICATE-----
169 .Ve
170 sequences. Before, between, and after the certificates text is allowed
171 which can be used e.g. for descriptions of the certificates.
172 .PP
173 The \fBCAfile\fR is processed on execution of the \fISSL_CTX_load_verify_locations()\fR
174 function.
175 .PP
176 If \fBCApath\fR is not \s-1NULL\s0, it points to a directory containing \s-1CA\s0 certificates
177 in \s-1PEM\s0 format. The files each contain one \s-1CA\s0 certificate. The files are
178 looked up by the \s-1CA\s0 subject name hash value, which must hence be available.
179 If more than one \s-1CA\s0 certificate with the same name hash value exist, the
180 extension must be different (e.g. 9d66eef0.0, 9d66eef0.1 etc). The search
181 is performed in the ordering of the extension number, regardless of other
182 properties of the certificates.
183 Use the \fBc_rehash\fR utility to create the necessary links.
184 .PP
185 The certificates in \fBCApath\fR are only looked up when required, e.g. when
186 building the certificate chain or when actually performing the verification
187 of a peer certificate.
188 .PP
189 When looking up \s-1CA\s0 certificates, the OpenSSL library will first search the
190 certificates in \fBCAfile\fR, then those in \fBCApath\fR. Certificate matching
191 is done based on the subject name, the key identifier (if present), and the
192 serial number as taken from the certificate to be verified. If these data
193 do not match, the next certificate will be tried. If a first certificate
194 matching the parameters is found, the verification process will be performed;
195 no other certificates for the same parameters will be searched in case of
196 failure.
197 .PP
198 In server mode, when requesting a client certificate, the server must send
199 the list of CAs of which it will accept client certificates. This list
200 is not influenced by the contents of \fBCAfile\fR or \fBCApath\fR and must
201 explicitly be set using the
202 SSL_CTX_set_client_CA_list(3)
203 family of functions.
204 .PP
205 When building its own certificate chain, an OpenSSL client/server will
206 try to fill in missing certificates from \fBCAfile\fR/\fBCApath\fR, if the
207 certificate chain was not explicitly specified (see
208 SSL_CTX_add_extra_chain_cert(3),
209 SSL_CTX_use_certificate(3).
210 .SH "WARNINGS"
211 .IX Header "WARNINGS"
212 If several \s-1CA\s0 certificates matching the name, key identifier, and serial
213 number condition are available, only the first one will be examined. This
214 may lead to unexpected results if the same \s-1CA\s0 certificate is available
215 with different expiration dates. If a \*(L"certificate expired\*(R" verification
216 error occurs, no other certificate will be searched. Make sure to not
217 have expired certificates mixed with valid ones.
218 .SH "EXAMPLES"
219 .IX Header "EXAMPLES"
220 Generate a \s-1CA\s0 certificate file with descriptive text from the \s-1CA\s0 certificates
221 ca1.pem ca2.pem ca3.pem:
222 .PP
223 .Vb 5
224 \& #!/bin/sh
225 \& rm CAfile.pem
226 \& for i in ca1.pem ca2.pem ca3.pem ; do
227 \&   openssl x509 -in $i -text >> CAfile.pem
228 \& done
229 .Ve
230 Prepare the directory /some/where/certs containing several \s-1CA\s0 certificates
231 for use as \fBCApath\fR:
232 .PP
233 .Vb 2
234 \& cd /some/where/certs
235 \& c_rehash .
236 .Ve
237 .SH "RETURN VALUES"
238 .IX Header "RETURN VALUES"
239 The following return values can occur:
240 .Ip "0" 4
241 The operation failed because \fBCAfile\fR and \fBCApath\fR are \s-1NULL\s0 or the
242 processing at one of the locations specified failed. Check the error
243 stack to find out the reason.
244 .Ip "1" 4
245 .IX Item "1"
246 The operation succeeded.
247 .SH "SEE ALSO"
248 .IX Header "SEE ALSO"
249 ssl(3),
250 SSL_CTX_set_client_CA_list(3),
251 SSL_get_client_CA_list(3),
252 SSL_CTX_use_certificate(3),
253 SSL_CTX_add_extra_chain_cert(3),
254 SSL_CTX_set_cert_store(3)