1SSL_CTX_SET_CERT_VERIFY_CALLBACK(3) OpenSSLSSL_CTX_SET_CERT_VERIFY_CALLBACK(3)
2
3
4
6 SSL_CTX_set_cert_verify_callback - set peer certificate verification
7 procedure
8
10 #include <openssl/ssl.h>
11
12 void SSL_CTX_set_cert_verify_callback(SSL_CTX *ctx,
13 int (*callback)(X509_STORE_CTX *, void *),
14 void *arg);
15
17 SSL_CTX_set_cert_verify_callback() sets the verification callback
18 function for ctx. SSL objects that are created from ctx inherit the
19 setting valid at the time when SSL_new(3) is called.
20
22 Whenever a certificate is verified during a SSL/TLS handshake, a
23 verification function is called. If the application does not explicitly
24 specify a verification callback function, the built-in verification
25 function is used. If a verification callback callback is specified via
26 SSL_CTX_set_cert_verify_callback(), the supplied callback function is
27 called instead. By setting callback to NULL, the default behaviour is
28 restored.
29
30 When the verification must be performed, callback will be called with
31 the arguments callback(X509_STORE_CTX *x509_store_ctx, void *arg). The
32 argument arg is specified by the application when setting callback.
33
34 callback should return 1 to indicate verification success and 0 to
35 indicate verification failure. If SSL_VERIFY_PEER is set and callback
36 returns 0, the handshake will fail. As the verification procedure may
37 allow the connection to continue in the case of failure (by always
38 returning 1) the verification result must be set in any case using the
39 error member of x509_store_ctx so that the calling application will be
40 informed about the detailed result of the verification procedure!
41
42 Within x509_store_ctx, callback has access to the verify_callback
43 function set using SSL_CTX_set_verify(3).
44
46 SSL_CTX_set_cert_verify_callback() does not return a value.
47
49 Do not mix the verification callback described in this function with
50 the verify_callback function called during the verification process.
51 The latter is set using the SSL_CTX_set_verify(3) family of functions.
52
53 Providing a complete verification procedure including certificate
54 purpose settings etc is a complex task. The built-in procedure is quite
55 powerful and in most cases it should be sufficient to modify its
56 behaviour using the verify_callback function.
57
59 SSL_CTX_set_cert_verify_callback() does not provide diagnostic
60 information.
61
63 ssl(7), SSL_CTX_set_verify(3), SSL_get_verify_result(3),
64 SSL_CTX_load_verify_locations(3)
65
67 Copyright 2001-2018 The OpenSSL Project Authors. All Rights Reserved.
68
69 Licensed under the OpenSSL license (the "License"). You may not use
70 this file except in compliance with the License. You can obtain a copy
71 in the file LICENSE in the source distribution or at
72 <https://www.openssl.org/source/license.html>.
73
74
75
761.1.1q 2022-07-21SSL_CTX_SET_CERT_VERIFY_CALLBACK(3)