Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why I get error "security error 12175" with TNetHttpRequest

Tags:

delphi

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

 12175

One 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 ?

like image 312
zac Avatar asked Mar 05 '23 04:03

zac


2 Answers

I solved this by unchecked using SSL2 and SSL3 from NetHTTPClient1 and I used only TLS

like image 143
zac Avatar answered Mar 06 '23 17:03

zac


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.

like image 24
Jochen T Avatar answered Mar 06 '23 18:03

Jochen T