NAME
SSLCTXsetcertverifycallback - set peer certificate verification
procedureSYNOPSIS
#include
void SSLCTXsetcertverifycallback(SSLCTX *ctx, int (*callback)(X509STORECTX *,void *), void *arg);DESCRIPTION
SSLCTXsetcertverifycallback() sets the verification callback function for ctx. SSL objects that are created from ctx inherit the setting valid at the time when SSLnew(3) is called. NNOOTTEESS Whenever a certificate is verified during a SSL/TLS handshake, a verification function is called. If the application does not explicitlyspecify a verification callback function, the built-in verification
function is used. If a verification callback callback is specified via SSLCTXsetcertverifycallback(), the supplied callback function is called instead. By setting callback to NULL, the default behaviour is restored. When the verification must be performed, callback will be called with the arguments callback(X509STORECTX *x509storectx, void *arg). The argument arg is specified by the application when setting callback. callback should return 1 to indicate verification success and 0 to indicate verification failure. If SSLVERIFYPEER is set and callback returns 0, the handshake will fail. As the verification procedure may allow to continue the connection in case of failure (by always returning 1) the verification result must be set in any case using the eerrrroorr member of x509storectx so that the calling application will be informed about the detailed result of the verification procedure! Within x509storectx, callback has access to the verifycallback function set using SSLCTXsetverify(3). WWAARRNNIINNGGSS Do not mix the verification callback described in this function with the vveerriiffyyccaallllbbaacckk function called during the verification process. The latter is set using the SSLCTXsetverify(3) family of functions. Providing a complete verification procedure including certificatepurpose settings etc is a complex task. The built-in procedure is quite
powerful and in most cases it should be sufficient to modify its behaviour using the vveerriiffyyccaallllbbaacckk function.BUGS
RETURN VALUES
SSLCTXsetcertverifycallback() does not provide diagnostic information.SEE ALSO
ssl(3), SSLCTXsetverify(3), SSLgetverifyresult(3), SSLCTXloadverifylocations(3) HISTORY Previous to OpenSSL 0.9.7, the arg argument to SSSSLLCCTTXXsseettcceerrttvveerriiffyyccaallllbbaacckk was ignored, and callback was called simply as int (*callback)(X509STORECTX *) To compile software written for previous versions of OpenSSL, a dummy argument will have to be added to callback.0.9.7l 2002-02-28SSLCTXsetcertverifycallback(3)