Quantcast
Channel: Active questions tagged https - Stack Overflow
Viewing all articles
Browse latest Browse all 1834

How to ignore "System.Net.Http.CurlException: Peer certificate cannot be authenticated with given CA certificates" on non-Windows platforms?

$
0
0

I have deployed a Kubernetes cluster in Microsoft Azure and would like to call some of the REST APIs from a .NET Core C# program using https. The certificates used when deploying the cluster not in a trusted CA. When I run this program on a Mac, I get the following error:

System.Net.Http.CurlException: Peer certificate cannot beauthenticated with given CA certificates

On Windows, I'm able to set a custom ServerCertificateValidationCallback in order to ignore the error:

    WinHttpHandler winHttpHandler = new WinHttpHandler();    winHttpHandler.ServerCertificateValidationCallback = ValidateServerCertificate;public static bool ValidateServerCertificate(    HttpRequestMessage request,    X509Certificate certificate,    X509Chain chain,    SslPolicyErrors sslPolicyErrors){    return true;}

But, this is not supported under .NET Core on non-Windows platforms.

How can I ignore the error on other platforms?


Viewing all articles
Browse latest Browse all 1834

Latest Images

Trending Articles



Latest Images