OnHostCertificate event problems - WeOnlyDo Discussion board

OnHostCertificate event problems (General questions)

by Paul Draper, Thursday, September 29, 2005, 12:48 (6994 days ago)

Hi,

I have a HttpDlx client component that I am running in secure mode.

I have created an OnHostCertificate event:
[code]wodHttpHostCertificate(TObject *Sender,
ICertificate *Cert,
long ErrorCode,
BSTR ErrorText,
VARIANT_BOOL *Accept)[/code]

which is fired when the client receives a certificate from the web server.

My problem is that if I try to access the Accept parameter I get an Access Violation because it is a NULL pointer.

Is this similar to a problem that my colleague (Dave Lucus) encountered in the SSH HostFingerPrint event?

Thanks
Paul

Re: OnHostCertificate event problems

by wodSupport, Thursday, September 29, 2005, 12:50 (6994 days ago) @ Paul Draper

Paul,

I think this is problem with Delphi that cannot deal with [in/out] argument in event. We can solve this with workaround - we can create hidden property 'Accept' that you would call from inside this event instead of setting the argument.

Would that help?

Re: OnHostCertificate event problems

by Paul Draper, Friday, September 30, 2005, 12:37 (6993 days ago) @ wodSupport

Hi,

I've actually used a similar solution to the one you suggested to Dave Lucas for the SSH.

If I detect an problem with the certificate (or ErrorCode is set) then I set a flag on my class that contains the HttpDlx telling it to make no more requests to that server.

So, I don't think there is any need (at the moment) to implement the hidden Accept property.

Thanks for the quick response.

Paul.