1=pod
2
3=head1 NAME
4
5SSL_CTX_set_cert_store, SSL_CTX_set1_cert_store, SSL_CTX_get_cert_store - manipulate X509 certificate verification storage
6
7=head1 SYNOPSIS
8
9 #include <openssl/ssl.h>
10
11 void SSL_CTX_set_cert_store(SSL_CTX *ctx, X509_STORE *store);
12 void SSL_CTX_set1_cert_store(SSL_CTX *ctx, X509_STORE *store);
13 X509_STORE *SSL_CTX_get_cert_store(const SSL_CTX *ctx);
14
15=head1 DESCRIPTION
16
17SSL_CTX_set_cert_store() sets/replaces the certificate verification storage
18of B<ctx> to/with B<store>. If another X509_STORE object is currently
19set in B<ctx>, it will be X509_STORE_free()ed.
20
21SSL_CTX_set1_cert_store() sets/replaces the certificate verification storage
22of B<ctx> to/with B<store>. The B<store>'s reference count is incremented.
23If another X509_STORE object is currently set in B<ctx>, it will be X509_STORE_free()ed.
24
25SSL_CTX_get_cert_store() returns a pointer to the current certificate
26verification storage.
27
28=head1 NOTES
29
30In order to verify the certificates presented by the peer, trusted CA
31certificates must be accessed. These CA certificates are made available
32via lookup methods, handled inside the X509_STORE. From the X509_STORE
33the X509_STORE_CTX used when verifying certificates is created.
34
35Typically the trusted certificate store is handled indirectly via using
36L<SSL_CTX_load_verify_locations(3)>.
37Using the SSL_CTX_set_cert_store() and SSL_CTX_get_cert_store() functions
38it is possible to manipulate the X509_STORE object beyond the
39L<SSL_CTX_load_verify_locations(3)>
40call.
41
42Currently no detailed documentation on how to use the X509_STORE
43object is available. Not all members of the X509_STORE are used when
44the verification takes place. So will e.g. the verify_callback() be
45overridden with the verify_callback() set via the
46L<SSL_CTX_set_verify(3)> family of functions.
47This document must therefore be updated when documentation about the
48X509_STORE object and its handling becomes available.
49
50SSL_CTX_set_cert_store() does not increment the B<store>'s reference
51count, so it should not be used to assign an X509_STORE that is owned
52by another SSL_CTX.
53
54To share X509_STOREs between two SSL_CTXs, use SSL_CTX_get_cert_store()
55to get the X509_STORE from the first SSL_CTX, and then use
56SSL_CTX_set1_cert_store() to assign to the second SSL_CTX and
57increment the reference count of the X509_STORE.
58
59=head1 RESTRICTIONS
60
61The X509_STORE structure used by an SSL_CTX is used for verifying peer
62certificates and building certificate chains, it is also shared by
63every child SSL structure. Applications wanting finer control can use
64functions such as SSL_CTX_set1_verify_cert_store() instead.
65
66=head1 RETURN VALUES
67
68SSL_CTX_set_cert_store() does not return diagnostic output.
69
70SSL_CTX_set1_cert_store() does not return diagnostic output.
71
72SSL_CTX_get_cert_store() returns the current setting.
73
74=head1 SEE ALSO
75
76L<ssl(7)>,
77L<SSL_CTX_load_verify_locations(3)>,
78L<SSL_CTX_set_verify(3)>
79
80=head1 COPYRIGHT
81
82Copyright 2001-2016 The OpenSSL Project Authors. All Rights Reserved.
83
84Licensed under the Apache License 2.0 (the "License").  You may not use
85this file except in compliance with the License.  You can obtain a copy
86in the file LICENSE in the source distribution or at
87L<https://www.openssl.org/source/license.html>.
88
89=cut
90