我们如何与网站联系?出现SSL错误1409442E [英] How can we connect with a website? Getting SSL error 1409442E
问题描述
我正在使用Delphi 10.2 Tokyo,试图从Web服务器下载一些信息.
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.
有什么想法吗?
推荐答案
确保您使用的是最新版本最新版本的支持TLS v1.2的OpenSSL DLLs (Indy当前支持的最新版本为 1.0.2n ),然后您需要在其中启用sslvTLSv1_2
标志SSLIOHandler的SSLOptions.SSLVersions
属性:
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.2n), 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屋!