我们如何与网站建立联系?获取 SSL 错误 1409442E [英] How can we connect with a website? Getting SSL error 1409442E

查看:12
本文介绍了我们如何与网站建立联系?获取 SSL 错误 1409442E的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Delphi 10.2 Tokyo,试图从网络服务器下载一些信息.

I am using Delphi 10.2 Tokyo, trying to download some information from a web server.

我使用 Indy 10.6.2.5366 通过此函数传递命令 URL https://poloniex.com/public?command=returnCurrencies(如果我将其粘贴到浏览器中,则该命令有效):

I pass the command URL https://poloniex.com/public?command=returnCurrencies through this function using Indy 10.6.2.5366 (the command works if I paste it in a browser):

function ReadHTTPS(const url: string): string;
var
  IdHTTP: TIdHTTP;
  IdSSL: TIdSSLIOHandlerSocketOpenSSL;
begin
  IdHTTP := TIdHTTP.Create;
  try
    IdSSL := TIdSSLIOHandlerSocketOpenSSL.Create(IdHTTP);
    IdHTTP.IOHandler := IdSSL;
    result := IdHTTP.Get(url);
    if IdHTTP.ResponseText <> '' then
      OutputDebugString(PWideChar('ReadHTTPS: ' + IdHTTP.ResponseText));
  finally
    IdHTTP.Free;
  end;
end{ ReadHTTPS};

出现以下错误:

使用 SSL 连接时出错.错误:1409442E:SSL 例程:ssl3_read_bytes:tlsv1 警报协议版本

Error connecting with SSL. error:1409442E:SSL routines:ssl3_read_bytes:tlsv1 alert protocol version

我已尝试在与 exe 相同的目录中为 OpenSSL 安装最新的 DLL,但这并没有解决问题.

I have tried installing the latest DLLs for OpenSSL in the same directory as the exe, but that didn't solve it.

有什么想法吗?

推荐答案

确保您使用的是 up- 支持 TLS v1.2 的 OpenSSL DLL 的最新版本(Indy 当前支持的最新版本是 1.0.2u),然后您需要启用 SSLIOHandler 的 SSLOptions.SSLVersions 属性中的 sslvTLSv1_2 标志:

Make sure you are using an up-to-date version of the OpenSSL DLLs that support TLS v1.2 (the latest version that Indy currently supports is 1.0.2u), and then you need to enable the sslvTLSv1_2 flag in the SSLIOHandler's SSLOptions.SSLVersions property:

IdSSL.SSLOptions.SSLVersions := [sslvTLSv1, sslvTLSv1_1, sslvTLSv1_2];

或者:

IdSSL.SSLOptions.SSLVersions := [sslvTLSv1_2];

Indy 默认仅启用 TLS v1.0,显然 https://poloniex.com 不允许使用 TLS v1.2 之前的 TLS 版本.

Indy enables only TLS v1.0 by default, and apparently https://poloniex.com does not allow TLS versions prior to TLS v1.2.

这篇关于我们如何与网站建立联系?获取 SSL 错误 1409442E的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆