Hi there,
I'm not sure if it is a bug, but it seems that way. When I try to include any visual function (changeing a textbox, showing a message) within OnServerCertValidate it will hang endless.
I wanted to ask the user for accepting the certificate from the server, but all tries failed. Just include such a line into the event to reproduce:
ShowMessage(ServerCertificate.Subject)
Any help is welcome.
best regards,
icecoke
MySSLIOHandler bug
Dimon,
I would love to do that, but it seems this event is blocking the main thread. I tried with messages (don't like timers) and the main thread is just dead and not able to do any work nor able to get the message.
The message is processed right after this blocking event is finished.
So, how should the main thread show any messagebox or something like this, even if I place a timer?
Any advice is welcome.
I would love to do that, but it seems this event is blocking the main thread. I tried with messages (don't like timers) and the main thread is just dead and not able to do any work nor able to get the message.
The message is processed right after this blocking event is finished.
So, how should the main thread show any messagebox or something like this, even if I place a timer?
Any advice is welcome.
Really the main thread is blocked until the OnServerCertValidate event is not finished and you can't use VCL components in this event handler.
In order to solve this problem, you can use trusted certificate list and find ServerCertificate in this list. If the certificate is not found then set Accept to False. In main thread you can ask the user to accept the certificate, and if the certificate is accepted, then perform reconnect.
You can use for this the following code:
In order to solve this problem, you can use trusted certificate list and find ServerCertificate in this list. If the certificate is not found then set Accept to False. In main thread you can ask the user to accept the certificate, and if the certificate is accepted, then perform reconnect.
You can use for this the following code:
Code: Select all
try
MyConnection.Connect;
except
on e: EScError do begin
if e.Message = SCertificateNotVerified then begin
// Check certificate
...
MyConnection.Connect;
end;
end;
Hmm - that seems to be impossible, cause the connection is down, so no certificate to check anymore... Do you really expect I have to save this in a different component to recheck it in this exception? I'm sorry, but did noone else had this problems? I'm a little confused - securebridge seems not to be that transparent as I expected it...Dimon wrote:Code: Select all
on e: EScError do begin if e.Message = SCertificateNotVerified then begin // Check certificate ...
Anyway, I will try it - but I would love to have this more inline.