最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

web services - Is there any way to force TLS 1.2 on Delphi 10.2.3 THTTPRIO component? - Stack Overflow

programmeradmin3浏览0评论

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 badge
Add a comment  | 

2 Answers 2

Reset to default 1

You 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;
发布评论

评论列表(0)

  1. 暂无评论