SSL_CTX_set_cert_verify_callback.pod 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. =pod
  2. =head1 NAME
  3. SSL_CTX_set_cert_verify_callback - set peer certificate verification procedure
  4. =head1 SYNOPSIS
  5. #include <openssl/ssl.h>
  6. void SSL_CTX_set_cert_verify_callback(SSL_CTX *ctx, int (*callback)(),
  7. char *arg);
  8. int (*callback)();
  9. =head1 DESCRIPTION
  10. SSL_CTX_set_cert_verify_callback() sets the verification callback function for
  11. B<ctx>. SSL objects, that are created from B<ctx> inherit the setting valid at
  12. the time, L<SSL_new(3)|SSL_new(3)> is called. B<arg> is currently ignored.
  13. =head1 NOTES
  14. Whenever a certificate is verified during a SSL/TLS handshake, a verification
  15. function is called. If the application does not explicitly specify a
  16. verification callback function, the built-in verification function is used.
  17. If a verification callback B<callback> is specified via
  18. SSL_CTX_set_cert_verify_callback(), the supplied callback function is called
  19. instead. By setting B<callback> to NULL, the default behaviour is restored.
  20. When the verification must be performed, B<callback> will be called with
  21. the argument callback(X509_STORE_CTX *x509_store_ctx). The arguments B<arg>
  22. that can be specified when setting B<callback> are currently ignored.
  23. B<callback> should return 1 to indicate verification success and 0 to
  24. indicate verification failure. If SSL_VERIFY_PEER is set and B<callback>
  25. returns 0, the handshake will fail. As the verification procedure may
  26. allow to continue the connection in case of failure (by always returning 1)
  27. the verification result must be set in any case using the B<error>
  28. member of B<x509_store_ctx>, so that the calling application will be informed
  29. about the detailed result of the verification procedure!
  30. Within B<x509_store_ctx>, B<callback> has access to the B<verify_callback>
  31. function set using L<SSL_CTX_set_verify(3)|SSL_CTX_set_verify(3)>.
  32. =head1 WARNINGS
  33. Do not mix the verification callback described in this function with the
  34. B<verify_callback> function called during the verification process. The
  35. latter is set using the L<SSL_CTX_set_verify(3)|SSL_CTX_set_verify(3)>
  36. family of functions.
  37. Providing a complete verification procedure including certificate purpose
  38. settings etc is a complex task. The built-in procedure is quite powerful
  39. and in most cases it should be sufficient to modify its behaviour using
  40. the B<verify_callback> function.
  41. =head1 BUGS
  42. It is possible to specify arguments to be passed to the verification callback.
  43. Currently they are however not passed but ignored.
  44. The B<callback> function is not specified via a prototype, so that no
  45. type checking takes place.
  46. =head1 RETURN VALUES
  47. SSL_CTX_set_cert_verify_callback() does not provide diagnostic information.
  48. =head1 SEE ALSO
  49. L<ssl(3)|ssl(3)>, L<SSL_CTX_set_verify(3)|SSL_CTX_set_verify(3)>,
  50. L<SSL_get_verify_result(3)|SSL_get_verify_result(3)>,
  51. L<SSL_CTX_load_verify_locations(3)|SSL_CTX_load_verify_locations(3)>
  52. =cut