By default, the server does not verify peer certificates. To configure the server to verify client certificates, implement the following steps:
Handle the event OnSSLVerifyPeer and implement the following code to be notified every time a client connects with a certificate.
function OnSSLVerifyPeerEvent(Sender: TObject; Certificate:
TIdX509; AOk: Boolean; ADepth, AError: Integer; var Accept: Boolean);
begin
// ... validate the certificate
if Certificate_OK then
Accept := True
else
Accept := False;
end;
Note that the event OnSSLVerifyPeer is only called if the client provides a certificate, if a client doesn't provide a certificate, the event is not fired.
You can configure the server to only allow SSL connections that use a certificate. To do this, set the following property:
If the client doesn't provide a certificate, the connection will be closed in the SSL Handshake.