允许与HttpClient的不受信任的SSL证书不受、证书、HttpClient、SSL

2023-09-02 21:28:07 作者:Maxim 座右铭

我努力让我的Windows 8应用程序通过SSL我测试的网络API进行通信。

I'm struggling to get my Windows 8 application to communicate with my test web API over SSL.

看来,HttpClient的/ HttpClientHandler不提供和选择忽略不受信任的证书一样的WebRequest,您可以(虽然在哈克的方式与 ServerCertificateValidationCallback )。

It seems that HttpClient/HttpClientHandler does not provide and option to ignore untrusted certificates like WebRequest enables you to (albeit in a "hacky" way with ServerCertificateValidationCallback).

任何帮助将是非常美联社preciated!

Any help would be much appreciated!

推荐答案

在Windows 8.1,你现在可以放心无效的SSL证书。你必须要么使用Windows.Web.HttpClient或者如果你想使用System.Net.Http.HttpClient,您可以使用消息处理程序适配器我写道: http://www.nuget.org/packages/WinRtHttpClientHandler

With Windows 8.1, you can now trust invalid SSL certs. You have to either use the Windows.Web.HttpClient or if you want to use the System.Net.Http.HttpClient, you can use the message handler adapter I wrote: http://www.nuget.org/packages/WinRtHttpClientHandler

文档都在GitHub上: https://github.com/onovotny/WinRtHttpClientHandler

Docs are on the GitHub: https://github.com/onovotny/WinRtHttpClientHandler