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, int (*callback)(X509_STORE_CTX *,void *), void *arg);
13
15 SSL_CTX_set_cert_verify_callback() sets the verification callback
16 function for ctx. SSL objects that are created from ctx inherit the
17 setting valid at the time when SSL_new(3) is called.
18
20 Whenever a certificate is verified during a SSL/TLS handshake, a
21 verification function is called. If the application does not explicitly
22 specify a verification callback function, the built-in verification
23 function is used. If a verification callback callback is specified via
24 SSL_CTX_set_cert_verify_callback(), the supplied callback function is
25 called instead. By setting callback to NULL, the default behaviour is
26 restored.
27
28 When the verification must be performed, callback will be called with
29 the arguments callback(X509_STORE_CTX *x509_store_ctx, void *arg). The
30 argument arg is specified by the application when setting callback.
31
32 callback should return 1 to indicate verification success and 0 to
33 indicate verification failure. If SSL_VERIFY_PEER is set and callback
34 returns 0, the handshake will fail. As the verification procedure may
35 allow to continue the connection in case of failure (by always
36 returning 1) the verification result must be set in any case using the
37 error member of x509_store_ctx so that the calling application will be
38 informed about the detailed result of the verification procedure!
39
40 Within x509_store_ctx, callback has access to the verify_callback
41 function set using SSL_CTX_set_verify(3).
42
44 Do not mix the verification callback described in this function with
45 the verify_callback function called during the verification process.
46 The latter is set using the SSL_CTX_set_verify(3) family of functions.
47
48 Providing a complete verification procedure including certificate
49 purpose settings etc is a complex task. The built-in procedure is quite
50 powerful and in most cases it should be sufficient to modify its
51 behaviour using the verify_callback function.
52
55 SSL_CTX_set_cert_verify_callback() does not provide diagnostic
56 information.
57
59 ssl(3), SSL_CTX_set_verify(3), SSL_get_verify_result(3),
60 SSL_CTX_load_verify_locations(3)
61
63 Previous to OpenSSL 0.9.7, the arg argument to
64 SSL_CTX_set_cert_verify_callback was ignored, and callback was called
65 simply as
66 int (*callback)(X509_STORE_CTX *) To compile software written for
67 previous versions of OpenSSL, a dummy argument will have to be added to
68 callback.
69
70
71
721.0.2o 2020-08-01SSL_CTX_set_cert_verify_callback(3)