I am using Delphi 10.2 Tokyo, trying to download some information from a web server.
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};
That gives the following error:
Error connecting with SSL. error:1409442E:SSL routines:ssl3_read_bytes:tlsv1 alert protocol version
I have tried installing the latest DLLs for OpenSSL in the same directory as the exe, but that didn't solve it.
Any ideas?
SSLOptions.SSLVersionsproperty. By default, only TLS v1.0 is enabled. - Remy LebeauIdSSL.SSLOptions.SSLVersionsto either[sslvTLSv1, sslvTLSv1_1, sslvTLSv1_2]or[sslvTLSv1_2]works, the connection succeeds and I get an HTTP200 OKresponse. The trick issslvTLSv1_2must be enabled, it won't work withsslvTLSv1orsslvTLSv1_1, so clearly the server does not allow TLS versions prior to 1.2. - Remy LebeauIdSSL.SSLOptions.SSLVersions := IdSSL.SSLOptions.SSLVersions + [sslvTLSv1_1, sslvTLSv1_2];by your advice and goterror:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version'.. Well, one step forward, but still no connection. You were able to connect with which configuration? - Victoria