简体   繁体   English

Indy TIdhttp.Get未加载正确版本的SSL

[英]Indy TIdhttp.Get is not loading proper version of SSL

I am trying to make an interface to FreshDesk API 我正在尝试建立与FreshDesk API的接口

Here is my source code for the call: 这是我的通话源代码:

procedure TForm1.Button1Click(Sender: TObject);
var
  IdSSLIOHandlerSocket1: TIdSSLIOHandlerSocketOpenSSL;
  idhttp:  TIdHttp;
begin
  idhttp := TIdHttp.Create(self);
  idhttp.Request.ContentType := 'application/json';
  IdHTTP.Request.BasicAuthentication:= True;
  IdHTTP.Request.Username := 'marks@mytestcompany.com';
  IdHTTP.Request.Password := 'XYZ';
  idhttp.Request.Connection:='keep-alive';
  IdSSLIOHandlerSocket1 := TIdSSLIOHandlerSocketOpenSSL.create(nil);
  with IdSSLIOHandlerSocket1 do begin
    SSLOptions.Method := sslvTLSv1_2;
    SSLOptions.SSLVersions := [sslvTLSv1_2];
    SSLOptions.VerifyMode := [];
    SSLOptions.VerifyDepth := 2;
  end;
  idhttp.IOHandler := IdSSLIOHandlerSocket1;
  idhttp.Request.Accept := '*/*';

  idhttp.HandleRedirects := True;
  if usefiddler.checked then begin
    idhttp.ProxyParams.ProxyServer := '127.0.0.1';
    idhttp.ProxyParams.ProxyPort := 8888 ;
  end;
  showMessage(idhttp.get('https://mytestcompany.freshdesk.com/api/v2/contacts'));
end;

When I run using Fiddler it shows it is using Version: 3.1 (TLS/1.0) : 当我使用Fiddler运行时,表明它正在使用版本:3.1(TLS / 1.0)

在此处输入图片说明

Here is successful curl call (it seems to be using Version: 3.3 (TLS/1.2) : 这是成功的curl调用(它似乎正在使用版本:3.3(TLS / 1.2)

curl -v -u marks@mytestcompnay:XYZ -H "Content-Type: application/json" -X GET "https://mytestcompany.freshdesk.com/api/v2/contacts"

Here is Fiddler results when using curl: 这是使用curl时的Fiddler结果:

在此处输入图片说明

Is my problem that I am using the wrong version of TLS? 我使用的是错误版本的TLS是我的问题吗?

You are using an outdated version of OpenSSL. 您正在使用过时的OpenSSL版本。

Per comments, you say that you are using OpenSSL 1.0.0q. 根据评论,您说您正在使用OpenSSL 1.0.0q。 That version is several years old and does not support TLS v1.2 (which was added to OpenSSL in 1.0.1, which is still an old version). 该版本已有数年历史,并且不支持TLS v1.2(在1.0.1中已添加到OpenSSL,该版本仍然是旧版本)。 Indy silently falls back to TLS v1.0 when it cannot use TLS v1.1 or v1.2. 当Indy无法使用TLS v1.1或v1.2时,它会默默地退回到TLS v1.0。

You need to update your OpenSSL. 您需要更新您的OpenSSL。 The latest version of OpenSSL that Indy currently supports is 1.0.2. Indy当前支持的最新版本的OpenSSL是1.0.2。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM