I am using TNetHttpRequest and TNetHTTPClient to send post data to API url like this:
Params := TMultiPartFormData.Create;
Params.AddFile('file_upload', 'c:myfile.txt','application/octet-stream');
NetHTTPRequest1.Post('https://myurl.com', Params);
This work fin on Windows 10 but on new Windows 7 Home edition I get error
Error Sending data (12175) A security error occurred
I looked at Microsoft error number HERE
ERROR_WINHTTP_SECURE_FAILURE
12175One or more errors were found in the Secure Sockets Layer (SSL) certificate sent by the server. To determine what type of error was
encountered, check for a WINHTTP_CALLBACK_STATUS_SECURE_FAILURE
notification in a status callback function. For more information, see
WINHTTP_STATUS_CALLBACK.
But I really dont know how to call these callback fundtions or what is causing this error ?
asked Apr 11, 2019 at 22:37
2
I solved this by unchecked using SSL2 and SSL3 from NetHTTPClient1 and I used only TLS
answered Apr 11, 2019 at 23:12
zaczac
4,31513 gold badges57 silver badges119 bronze badges
2
I had experienced the same error on Windows 7 Pro, reproducible easily by using the Delphi 10.3. Sample «HttpAsyncDownload».
I tested the compiled application on Windows 10 where it runs flawlessly.
Finally, I found following page which solved the issue for me:
https://support.microsoft.com/en-us/help/3140245/update-to-enable-tls-1-1-and-tls-1-2-as-default-secure-protocols-in-wi
Briefly, support for Transport Layer Security (TLS) 1.1 and TLS 1.2 is acitvated for Windows 7. I used the «easy fix», which enables this systemwide as well as for Internet explorer.
Finally, the above sample application «HttpAsyncDownload» runs on Windows 7 Pro flawlessly.
answered Aug 2, 2020 at 11:20
Skip to content
This is a Windows 7 error, this update can fix the problem. But we can solve the problem without requiring the update using the code below.
SSL2 must be disabled. SSL3,TLS1,TLS11,TLS12 can be used.
SOLUTION:
uses
REST.Types, REST.Client, REST.Authenticator.Basic, Data.Bind.Components,
Data.Bind.ObjectScope, NetEncoding, System.Net.HttpClient;
begin
RESTClient1 := TRESTClient.Create('https://test.com/api');
try
RESTClient1.SecureProtocols := [THTTPSecureProtocol.SSL3,THTTPSecureProtocol.TLS1,THTTPSecureProtocol.TLS11,THTTPSecureProtocol.TLS12];
HTTPBasicAuthenticator1 := THTTPBasicAuthenticator.Create('apikey',MyApiKey);
try
RESTRequest1 := TRESTRequest.Create(nil);
try
RESTRequest1.Method := TRESTRequestMethod.rmPOST;
RESTClient1.Authenticator:=HTTPBasicAuthenticator1;
RESTRequest1.Client := RESTClient1;
RESTRequest1.ClearBody;
RESTRequest1.AddBody('{"input1": ["abc"], "input2":"xyz"}',TRestContentType.ctAPPLICATION_JSON);
RESTRequest1.Execute;
MyResult := RESTRequest1.Response.Content;
finally
RESTRequest1.Free;
end;
finally
HTTPBasicAuthenticator1.Free;
end;
finally
RESTClient1.Free;
end;
end;
I have run into the same problem with the RESTClient (and any HTTPS based controls for that matter), and i suspect the issue you are having with windows 7, is due to the limited cipher suites available on 7 and 8.1
Some servers have switched to using strong cipher’s for their TLS…and merely enabling TLS 1.2 will not work on operating systems older than Windows 10.
I’ve seen some servers only support TLS ciphers such as
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
These are not supported on Windows 7 (and i believe neither on 8.1) — there is no way to add them either.
Microsoft in their (lack) of wisdom never added them on their final cipher update, despite them being in use at the time, and now these OS’s no longer receive any mainstream support and are considered EOL, they won’t ever add them.
If you try to connect to a server which uses the above ciphers for TLS, on windows 7, you will get the 12175 security error.
You can see what ciphers are supported on windows 7 here: https://docs.microsoft.com/en-us/windows/win32/secauthn/tls-cipher-suites-in-windows-7
You can test your servers SSL certificate here to find out what TLS ciphers it supports: https://www.ssllabs.com/ssltest
If the server supports ciphers on the list, and yet you are still getting the error then the previous posts for enabling TLS1.2 on windows 7 may work, you may also have to set the appropriate SecureProtocols property on the RESTClient.
Я использую TNetHttpRequest и TNetHTTPClient для отправки данных публикации на URL-адрес API следующим образом:
Params := TMultiPartFormData.Create;
Params.AddFile('file_upload', 'c:myfile.txt','application/octet-stream');
NetHTTPRequest1.Post('https://myurl.com', Params);
Это работает в Windows 10, но в новой версии Windows 7 Home я получаю ошибку
Ошибка отправки данных (12175) Произошла ошибка безопасности.
Я посмотрел номер ошибки Microsoft ЗДЕСЬ
ERROR_WINHTTP_SECURE_FAILURE
12175Одна или несколько ошибок были обнаружены в сертификате Secure Sockets Layer (SSL), отправленном сервером. Чтобы определить, какой тип ошибки произошел, проверьте наличие уведомления WINHTTP_CALLBACK_STATUS_SECURE_FAILURE в функции обратного вызова состояния. Для получения дополнительной информации см. WINHTTP_STATUS_CALLBACK.
Но я действительно не знаю, как вызывать эти функции обратного вызова или что вызывает эту ошибку?
2 ответа
Лучший ответ
Я решил это, сняв флажок с помощью SSL2 и SSL3 из NetHTTPClient1, и я использовал только TLS
6
zac
12 Апр 2019 в 17:43
Я столкнулся с той же ошибкой в Windows 7 Pro, легко воспроизводимой с помощью Delphi 10.3. Пример «HttpAsyncDownload».
Я тестировал скомпилированное приложение в Windows 10, где оно работает безупречно.
Наконец, я нашел следующую страницу, которая решила проблему для меня: https://support.microsoft.com/en-us/help/3140245/update-to-enable-tls-1-1-and-tls-1-2- как-по-умолчанию-безопасные-протоколы-в-Wi
Вкратце, поддержка Transport Layer Security (TLS) 1.1 и TLS 1.2 активирована для Windows 7. Я использовал «простое исправление», которое позволяет использовать его как для всей системы, так и для Internet Explorer.
Наконец, приведенный выше пример приложения «HttpAsyncDownload» безупречно работает в Windows 7 Pro.
1
Jochen T
2 Авг 2020 в 14:20
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);
|
#1 : 19/02-21 16:16 Vjeetn Posts: 7 |
I’m trying to use TVMaze.com but get this error: TVMaze.com: Error sending data: (12175). It’s some sort of security error message. How to fix? Edit: I can’t check for new updates of AR either :/ 19/02-21 16:16 — edited 19/02-21 16:19 |
|
#2 : 19/02-21 17:41 David Lee Posts: 1069 |
Looks like the probem is on your system. Both «TV Show Import» and «Check for new version…» work perfectly for me (AR 3.87 64bit, Win 10 pro). |
|
#3 : 19/02-21 19:09 Vjeetn Posts: 7 |
Reply to #2: Hopefully someone can tell me what that code means as that might help me narrow down the issue. |
|
#4 : 19/02-21 19:25 Vjeetn Posts: 7 |
I have just tried with an earlier (portable) version of AR and this one is working. I have no clue why newer versions can’t connect. |
|
#5 : 25/02-21 18:21 Melissa Posts: 1 |
Hello, |
For more information, see the about_Remote_Troubleshooting Help topic..
Have troubleshooted but unable to identify the issue — permissions are set and able to run other commands. gets to around 400 get-requests then errors
Import-PSSession : Running the Get-Command command in a remote session reported the following error: Processing data
for a remote command failed with the following error message: WS-Management cannot process the request. The operation
failed because of an HTTP error. The HTTP error (12175) is: A security error occurred . For more information, see the
about_Remote_Troubleshooting Help topic..
At C:Program FilesWindowsPowerShellModulesExchangeOnlineManagement2.0.3ExchangeOnlineManagement.psm1:435 char:40
- … oduleInfo = Import-PSSession $PSSession -AllowClobber -DisableNameChe …
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~- CategoryInfo : InvalidResult: (:) [Import-PSSession], RuntimeException
- FullyQualifiedErrorId : ErrorFromRemoteCommand,Microsoft.PowerShell.Commands.ImportPSSessionCommand