Delphi 11.1 – NetHttpClient Security Error (12175) on old Windows System
Error occurred when releasing apps developed with Delphi 11.1 on older windows operating systems: Windows 7, Windows 2008 srv and Windows 2012 Server.
Simply invoking a simple “get” call with the netHttpClient class I would get the “Security Error (12175)” error.
To solve the problem, it was sufficient to exclude the “THTTPSecureProtocol.SSL2” protocol from the list of supported security protocols.
So the initialization of my httpClient became:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
httpCli := TNetHTTPClient.Create(nil); // httpCli.OnReceiveData := nil; if (basicAuthUser <> '') and (basicAuthPw <> '') then begin var LCredentials := TCredentialsStorage.TCredential.Create (TAuthTargetType.Server, '', url, '', ''); LCredentials.Username := basicAuthUser; LCredentials.Password := basicAuthPw; httpCli.CredentialsStorage.AddCredential(LCredentials); httpCli.UseDefaultCredentials := false; end; httpCli.SendTimeout := sendTimeout; httpCli.ResponseTimeout := readTimeout; httpCli.ConnectionTimeout := connTimeOut; httpCli.ContentType := ContentType; httpCli.AcceptCharSet := AcceptCharSet; httpCli.Accept := 'application/json'; {$IFNDEF ANDROID} // httpCli.SecureProtocols := // [THTTPSecureProtocol.SSL2,THTTPSecureProtocol.SSL3,THTTPSecureProtocol.TLS1,THTTPSecureProtocol.TLS11,THTTPSecureProtocol.TLS12,THTTPSecureProtocol.TLS13]; httpCli.SecureProtocols := [THTTPSecureProtocol.SSL3,THTTPSecureProtocol.TLS1,THTTPSecureProtocol.TLS11,THTTPSecureProtocol.TLS12,THTTPSecureProtocol.TLS13]; {$ENDIF} {$IFNDEF MACOS} if assigned(OnReceiveData) then httpCli.OnReceiveData := OnReceiveData; {$ENDIF} result := httpCli.Get(url,nil,xtHeaders); |