Do I have to always call Accept or Reject in the certificate handler?

0 votes
asked Oct 2 by Uwe Keim (760 points)
edited Oct 2 by Uwe Keim

When it comes to Custom certificate validation, I see all the examples that either call Accept or Recect in all execution branches.

My question is, whether this code is valid, too:

private void ftp_ValidatingCertificate(
    object sender, 
    SslCertificateValidationEventArgs e)
{
    if (IgnoreCertificateErrors)
    {
        e.Accept();
    }
}

I.e. I only call Accept under certain cases, but sometimes I do call neither Accept nor Reject.

Is this allowed?

Applies to: Rebex FTP/SSL

1 Answer

+1 vote
answered Oct 2 by stepantalalayev (2,640 points)
edited Oct 2 by Lukas Pokorny
 
Best answer

Hello,

After a little research on your question I have found that program will continue working without any exception thrown. If none of the events calls either Accept or Reject, the library will behave as if there were no ValidatingCertificate at all (it will use the built-in certificate validator).

commented Oct 2 by Uwe Keim (760 points)
Thanks a lot! That is exactly the behaviour I would have expected and was looking for.
...