summaryrefslogtreecommitdiff
path: root/src/lib/libssl/doc/SSL_CTX_load_verify_locations.3
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libssl/doc/SSL_CTX_load_verify_locations.3')
-rw-r--r--src/lib/libssl/doc/SSL_CTX_load_verify_locations.3158
1 files changed, 158 insertions, 0 deletions
diff --git a/src/lib/libssl/doc/SSL_CTX_load_verify_locations.3 b/src/lib/libssl/doc/SSL_CTX_load_verify_locations.3
new file mode 100644
index 0000000000..1e494032f4
--- /dev/null
+++ b/src/lib/libssl/doc/SSL_CTX_load_verify_locations.3
@@ -0,0 +1,158 @@
1.Dd $Mdocdate: October 12 2014 $
2.Dt SSL_CTX_LOAD_VERIFY_LOCATIONS 3
3.Os
4.Sh NAME
5.Nm SSL_CTX_load_verify_locations
6.Nd set default locations for trusted CA certificates
7.Sh SYNOPSIS
8.In openssl/ssl.h
9.Ft int
10.Fo SSL_CTX_load_verify_locations
11.Fa "SSL_CTX *ctx" "const char *CAfile" "const char *CApath"
12.Fc
13.Sh DESCRIPTION
14.Fn SSL_CTX_load_verify_locations
15specifies the locations for
16.Fa ctx ,
17at which CA certificates for verification purposes are located.
18The certificates available via
19.Fa CAfile
20and
21.Fa CApath
22are trusted.
23.Sh NOTES
24If
25.Fa CAfile
26is not
27.Dv NULL ,
28it points to a file of CA certificates in PEM format.
29The file can contain several CA certificates identified by sequences of:
30.Bd -literal
31 -----BEGIN CERTIFICATE-----
32 ... (CA certificate in base64 encoding) ...
33 -----END CERTIFICATE-----
34.Ed
35Before, between, and after the certificates arbitrary text is allowed which can
36be used, e.g., for descriptions of the certificates.
37.Pp
38The
39.Fa CAfile
40is processed on execution of the
41.Fn SSL_CTX_load_verify_locations
42function.
43.Pp
44If
45.Fa CApath
46is not NULL, it points to a directory containing CA certificates in PEM format.
47The files each contain one CA certificate.
48The files are looked up by the CA subject name hash value,
49which must hence be available.
50If more than one CA certificate with the same name hash value exist,
51the extension must be different (e.g.,
52.Pa 9d66eef0.0 ,
53.Pa 9d66eef0.1 ,
54etc.).
55The search is performed in the ordering of the extension number,
56regardless of other properties of the certificates.
57.Pp
58The certificates in
59.Fa CApath
60are only looked up when required, e.g., when building the certificate chain or
61when actually performing the verification of a peer certificate.
62.Pp
63When looking up CA certificates, the OpenSSL library will first search the
64certificates in
65.Fa CAfile ,
66then those in
67.Fa CApath .
68Certificate matching is done based on the subject name, the key identifier (if
69present), and the serial number as taken from the certificate to be verified.
70If these data do not match, the next certificate will be tried.
71If a first certificate matching the parameters is found,
72the verification process will be performed;
73no other certificates for the same parameters will be searched in case of
74failure.
75.Pp
76In server mode, when requesting a client certificate, the server must send
77the list of CAs of which it will accept client certificates.
78This list is not influenced by the contents of
79.Fa CAfile
80or
81.Fa CApath
82and must explicitly be set using the
83.Xr SSL_CTX_set_client_CA_list 3
84family of functions.
85.Pp
86When building its own certificate chain, an OpenSSL client/server will try to
87fill in missing certificates from
88.Fa CAfile Ns / Fa CApath ,
89if the
90certificate chain was not explicitly specified (see
91.Xr SSL_CTX_add_extra_chain_cert 3
92and
93.Xr SSL_CTX_use_certificate 3 ) .
94.Sh WARNINGS
95If several CA certificates matching the name, key identifier, and serial
96number condition are available, only the first one will be examined.
97This may lead to unexpected results if the same CA certificate is available
98with different expiration dates.
99If a
100.Dq certificate expired
101verification error occurs, no other certificate will be searched.
102Make sure to not have expired certificates mixed with valid ones.
103.Sh RETURN VALUES
104The following return values can occur:
105.Bl -tag -width Ds
106.It 0
107The operation failed because
108.Fa CAfile
109and
110.Fa CApath
111are
112.Dv NULL
113or the processing at one of the locations specified failed.
114Check the error stack to find out the reason.
115.It 1
116The operation succeeded.
117.El
118.Sh EXAMPLES
119Generate a CA certificate file with descriptive text from the CA certificates
120.Pa ca1.pem
121.Pa ca2.pem
122.Pa ca3.pem :
123.Bd -literal
124#!/bin/sh
125rm CAfile.pem
126for i in ca1.pem ca2.pem ca3.pem; do
127 openssl x509 -in $i -text >> CAfile.pem
128done
129.Ed
130.Pp
131Prepare the directory /some/where/certs containing several CA certificates
132for use as
133.Fa CApath :
134.Bd -literal
135$ cd /some/where/certs
136$ rm -f *.[0-9]* *.r[0-9]*
137$ for c in *.pem; do
138> [ "$c" = "*.pem" ] && continue
139> hash=$(openssl x509 -noout -hash -in "$c")
140> if egrep -q -- '-BEGIN( X509 | TRUSTED | )CERTIFICATE-' "$c"; then
141> suf=0
142> while [ -e $hash.$suf ]; do suf=$(( $suf + 1 )); done
143> ln -s "$c" $hash.$suf
144> fi
145> if egrep -q -- '-BEGIN X509 CRL-' "$c"; then
146> suf=0
147> while [ -e $hash.r$suf ]; do suf=$(( $suf + 1 )); done
148> ln -s "$c" $hash.r$suf
149> fi
150> done
151.Ed
152.Sh SEE ALSO
153.Xr ssl 3 ,
154.Xr SSL_CTX_add_extra_chain_cert 3 ,
155.Xr SSL_CTX_set_cert_store 3 ,
156.Xr SSL_CTX_set_client_CA_list 3 ,
157.Xr SSL_CTX_use_certificate 3 ,
158.Xr SSL_get_client_CA_list 3