I'm dealing with a protocol that needs to start TLS after connected and handshaked, something like this:
procedure TForm1.Button1Click(Sender: TObject);
var
SSL: TIdSSLIOHandlerSocketOpenSSL;
begin
SSL:= TIdSSLIOHandlerSocketOpenSSL.Create;
SSL.SSLOptions.Method:= sslvTLSv1_2;
IdTCPClient1.Connect;
if IdTCPClient1.Connected then
begin
//plain-text operations
HandShake;
CheckAnswer;
//finish plain-text start TLS
IdTCPClient1.IOHandler:= SSL;
SendTLSSecureBytes;
end;
end;
Once I get inside SendTLSSecureBytes procedure, and send something over the connection, I get the exception: "Connection closed gracefully"
Something missing to do this work?