允许与HttpClient的不受信任的SSL证书 [英] Allowing Untrusted SSL Certificates with HttpClient

查看:1081
本文介绍了允许与HttpClient的不受信任的SSL证书的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我努力让我的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,您可以使用消息处理程序适配器我写道: <一href="http://www.nuget.org/packages/WinRtHttpClientHandler">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上: <一href="https://github.com/onovotny/WinRtHttpClientHandler">https://github.com/onovotny/WinRtHttpClientHandler

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

这篇关于允许与HttpClient的不受信任的SSL证书的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆