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 func‐
16 tion for ctx. SSL objects that are created from ctx inherit the setting
17 valid at the time when SSL_new(3) is called.
18
20 Whenever a certificate is verified during a SSL/TLS handshake, a veri‐
21 fication 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 return‐
36 ing 1) the verification result must be set in any case using the error
37 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 func‐
41 tion 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 pur‐
49 pose 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 behav‐
51 iour using the verify_callback function.
52
55 SSL_CTX_set_cert_verify_callback() does not provide diagnostic informa‐
56 tion.
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 SSL_CTX_set_cert_ver‐
64 ify_callback was ignored, and callback was called simply as
65 int (*callback)(X509_STORE_CTX *) To compile software written for pre‐
66 vious versions of OpenSSL, a dummy argument will have to be added to
67 callback.
68
69
70
710.9.8b 2002-02-28SSL_CTX_set_cert_verify_callback(3)