| Home | Libraries | People | FAQ | More

##### ssl::context::set_verify_callback (1 of 2 overloads)

Set the callback used to verify peer certificates.

    template<
        typename VerifyCallback>
    void set_verify_callback(
        VerifyCallback callback);

This function is used to specify a callback function that will be called by the implementation when it needs to verify a peer certificate.

###### Parameters

callback

  The function object to be used for verifying a certificate. The function signature of the handler must be:

      bool verify_callback(
        bool preverified, // True if the certificate passed pre-verification.
        verify_context& ctx // The peer certificate and other context.
      );

  The return value of the callback is true if the certificate has passed verification, false otherwise.

###### Exceptions

boost::system::system_error

  Thrown on failure.

###### Remarks

Calls `SSL_CTX_set_verify`.