1SSL_CTX_load_verify_locations(3)    OpenSSL   SSL_CTX_load_verify_locations(3)
2
3
4

NAME

6       SSL_CTX_load_verify_locations - set default locations for trusted CA
7       certificates
8

SYNOPSIS

10        #include <openssl/ssl.h>
11
12        int SSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *CAfile,
13                                          const char *CApath);
14

DESCRIPTION

16       SSL_CTX_load_verify_locations() specifies the locations for ctx, at
17       which CA certificates for verification purposes are located. The
18       certificates available via CAfile and CApath are trusted.
19

NOTES

21       If CAfile is not NULL, it points to a file of CA certificates in PEM
22       format. The file can contain several CA certificates identified by
23
24        -----BEGIN CERTIFICATE-----
25        ... (CA certificate in base64 encoding) ...
26        -----END CERTIFICATE-----
27
28       sequences. Before, between, and after the certificates text is allowed
29       which can be used e.g. for descriptions of the certificates.
30
31       The CAfile is processed on execution of the
32       SSL_CTX_load_verify_locations() function.
33
34       If CApath is not NULL, it points to a directory containing CA
35       certificates in PEM format. The files each contain one CA certificate.
36       The files are looked up by the CA subject name hash value, which must
37       hence be available.  If more than one CA certificate with the same name
38       hash value exist, the extension must be different (e.g. 9d66eef0.0,
39       9d66eef0.1 etc). The search is performed in the ordering of the
40       extension number, regardless of other properties of the certificates.
41       Use the c_rehash utility to create the necessary links.
42
43       The certificates in CApath are only looked up when required, e.g. when
44       building the certificate chain or when actually performing the
45       verification of a peer certificate.
46
47       When looking up CA certificates, the OpenSSL library will first search
48       the certificates in CAfile, then those in CApath. Certificate matching
49       is done based on the subject name, the key identifier (if present), and
50       the serial number as taken from the certificate to be verified. If
51       these data do not match, the next certificate will be tried. If a first
52       certificate matching the parameters is found, the verification process
53       will be performed; no other certificates for the same parameters will
54       be searched in case of failure.
55
56       In server mode, when requesting a client certificate, the server must
57       send the list of CAs of which it will accept client certificates. This
58       list is not influenced by the contents of CAfile or CApath and must
59       explicitly be set using the SSL_CTX_set_client_CA_list(3) family of
60       functions.
61
62       When building its own certificate chain, an OpenSSL client/server will
63       try to fill in missing certificates from CAfile/CApath, if the
64       certificate chain was not explicitly specified (see
65       SSL_CTX_add_extra_chain_cert(3), SSL_CTX_use_certificate(3).
66

WARNINGS

68       If several CA certificates matching the name, key identifier, and
69       serial number condition are available, only the first one will be
70       examined. This may lead to unexpected results if the same CA
71       certificate is available with different expiration dates. If a
72       "certificate expired" verification error occurs, no other certificate
73       will be searched. Make sure to not have expired certificates mixed with
74       valid ones.
75

EXAMPLES

77       Generate a CA certificate file with descriptive text from the CA
78       certificates ca1.pem ca2.pem ca3.pem:
79
80        #!/bin/sh
81        rm CAfile.pem
82        for i in ca1.pem ca2.pem ca3.pem ; do
83          openssl x509 -in $i -text >> CAfile.pem
84        done
85
86       Prepare the directory /some/where/certs containing several CA
87       certificates for use as CApath:
88
89        cd /some/where/certs
90        c_rehash .
91

RETURN VALUES

93       The following return values can occur:
94
95       0   The operation failed because CAfile and CApath are NULL or the
96           processing at one of the locations specified failed. Check the
97           error stack to find out the reason.
98
99       1   The operation succeeded.
100

SEE ALSO

102       ssl(3), SSL_CTX_set_client_CA_list(3), SSL_get_client_CA_list(3),
103       SSL_CTX_use_certificate(3), SSL_CTX_add_extra_chain_cert(3),
104       SSL_CTX_set_cert_store(3)
105
106
107
1081.0.2o                            2020-08-01  SSL_CTX_load_verify_locations(3)
Impressum