The remote certificate is invalid according to the validation procedure

ShamahantShamahant Member Posts: 4
Hi,

I have this error "The remote certificate is invalid according to the validation procedure" when I call a REST WS.

Some ideas?

Here my code :

Certificate := Certificate.X509Certificate2();
Certificate.CreateFromCertFile(FilePathToCertificate);
HTTPClientWebHandler := HTTPClientWebHandler.WebRequestHandler;
HTTPClientWebHandler.ClientCertificates.Add(Certificate);
HTTPClientWebHandler.AuthenticationLevel := AuthenticationLevel.MutualAuthRequired;
HTTPClient := HTTPClient.HttpClient(HTTPClientWebHandler);

Into the httpclient, I add also some headers information after that I use the POST method with the httpclient and a MultipartFormDataContent

Variables:
Name DataType Subtype Length
HTTPClient - DotNet - System.Net.Http.HttpClient
HTTPClientWebHandler - DotNet - System.Net.Http.WebRequestHandler
Certificate - DotNet - System.Security.Cryptography.X509Certificates.X509Certificate2
AuthenticationLevel - DotNet - System.Net.Security.AuthenticationLevel

thk
Sign In or Register to comment.