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