Indy 9 | Content | Index | Reference

OnVerifyPeer
Event type for peer X.509 certificate verification.
Description
OnVerifyPeer is an event that can be used for peer checking. The events passes the TIdX509 structure (certificate ) that embeds the values of peer's certificate. You can read certificate time restrictions, issuer name, subject name.

The result value signals if you are pleased with peer's info. If you return False then the connection will be dropped, elsewhere you will keep the connection.

      function TForm1.IdServerInterceptOpenSSL1VerifyPeer(
        Certificate: TIdX509): Boolean;

      begin
        ShowMessage(DateTimeToStr(Certificate.notBefore));
        ShowMessage(Certificate.Issuer.OneLine);
        ShowMessage(Certificate.Subject.OneLine);
        Result := True;
      end;

Created with Doc-O-Matic 2 donated to Project JEDI. Commercial license available from the Doc-O-Matic site.