I'm using a THTTPRIO
component in Delphi 10.2.3 Tokyo to consume a webservice. I must have Internet Options settings configured for TLS 1.2/1.3 so that I can do the connection.
Is it possible to force TLS 1.2/1.3 on the connection?
I know that THTTPRIO
relies on WinInet. Can it be used any other way to accomplish TLS?
I'd try to declare the USE_INDY
directive in Soap.SOAPHTTPTrans.pas
, but I can't get to load the certificate. It says the certificate isn't ok.
Any other ideas?
I'm using a THTTPRIO
component in Delphi 10.2.3 Tokyo to consume a webservice. I must have Internet Options settings configured for TLS 1.2/1.3 so that I can do the connection.
Is it possible to force TLS 1.2/1.3 on the connection?
I know that THTTPRIO
relies on WinInet. Can it be used any other way to accomplish TLS?
I'd try to declare the USE_INDY
directive in Soap.SOAPHTTPTrans.pas
, but I can't get to load the certificate. It says the certificate isn't ok.
Any other ideas?
Share Improve this question edited Jan 18 at 16:51 Remy Lebeau 598k36 gold badges503 silver badges848 bronze badges asked Jan 18 at 13:20 Carlos MatosCarlos Matos 311 silver badge1 bronze badge2 Answers
Reset to default 1You can enable or disable specific security options of THTTPRIO
by changing the SecureProtocols
property of THHPWebNode
that is part of THTTPRIO
component.
I suggest you to use Indy components.
Look at the following example:
uses
IdHTTP, IdSSLOpenSSL, IdSSL, IdIOHandler, IdIOHandlerSocket, IdIOHandlerStack;
procedure IndyTLSExample;
var
IdHTTP : TIdHTTP;
SSLIOHandler : TIdSSLIOHandlerSocketOpenSSL;
begin
IdHTTP := TIdHTTP.Create(nil);
SSLIOHandler := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
try
SSLIOHandler.SSLOptions.Method := sslvTLSv1_2;
SSLIOHandler.SSLOptions.SSLVersions := [sslvTLSv1_2, sslvTLSv1_3];
IdHTTP.IOHandler := SSLIOHandler;
try
ShowMessage(IdHTTP.Get('https://example'));
except
on E: Exception do
ShowMessage(E.Message);
end;
finally
IdHTTP.Free;
SSLIOHandler.Free;
end;
end;