crono81
crono81

Reputation: 55

Error connecting with SSL

I'm trying to connecto to this url, just using a get request. Goberment page But always get the error EIdOSSLConnectError "Error connecting with SSL"

The code I use, is this, it works with other pages, but not this one

IdHTTP1.HandleRedirects := true;
IdHTTP1.AllowCookies := true;
IdHTTP1.IOHandler := TIdSSLIOHandlerSocket.Create(IdHTTP1);
IdHTTP1.CookieManager := TIdCookieManager.Create(IdHTTP1);
with TIdSSLIOHandlerSocket(IdHTTP1.IOHandler) do begin
  SSLOptions.Method := sslvTLSv1;
  SSLOptions.Mode := sslmUnassigned;
  SSLOptions.VerifyMode := [];
  SSLOptions.VerifyDepth := 0;
  PassThrough := True;
end;
IdHttp1.Request.UserAgent := 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:52.0) Gecko/20100101 Firefox/52.0';
IdHTTP1.RedirectMaximum := 30;
sHtml := IdHTTP1.Get('https://loginc.mat.sat.gob.mx/nidp/app/login?id=XACCertiSAT&sid=0&option=credential&sid=0');//<----Error here

Delphi 7, Indy 9.00.10

Thanks for any advice

Upvotes: 3

Views: 10781

Answers (1)

Bob3411
Bob3411

Reputation: 46

It seems that site wants TLS v1.2, since that is what gets negotiated when I go there with a browser.

Also, if in my PaleMoon browser I next go to about:config and set the pref named security.tls.version.max to 1, I revisit your url then wit TLS v1.0 and I get: Secure Connection Failed An error occurred during a connection to loginc.mat.sat.gob.mx. Cannot communicate securely with peer: no common encryption algorithm(s). (Error code: ssl_error_no_cypher_overlap)

However, other sites I tried (such as banks) still work okay with TLS v1 set that way. It seems your target site is finicky, so I'd try adjusting your line: SSLOptions.Method := sslvTLSv1;

Upvotes: 1

Related Questions