windows-store-apps – 如何信任Windows商店应用程序中的自签名证书

我试图在Windows Store App中覆盖证书验证,以接受两个外部服务(使用HttpClient)上的自签名证书,以允许Windows 8应用程序接受证书并建立SSL的信任关系

编辑:
我实施了这里记载的方法Installing certs by using the appmanifest

并将相关的.cer文件添加到我的应用程序中,并确保它们是“内容”和“始终复制”.

我的package.appxmanifest扩展部分如下所示:

<Extensions>
<Extension Category="windows.certificates">
  <Certificates>
    <Certificate StoreName="TrustedPeople" Content="Assets\ReportingServices.cer" />
    <Certificate StoreName="TrustedPeople" Content="Assets\Crm.cer" />
    <Certificate StoreName="CA" Content="Assets\DigiCertHighAssurance.cer" />
    <TrustFlags ExclusiveTrust="true" />
    <SelectionCriteria AutoSelect="true" />
  </Certificates>
</Extension>

但这还是不行.

我已经尝试将应用程序证书放在“根”StoreName中,但仍然没有成功.有没有人有任何想法为什么这可能不工作吗?

这是一个老的,但看到有不少观察者,我会给我的解决方案.
// Create the httpClient and send the request
HttpBaseProtocolFilter aHBPF = new HttpBaseProtocolFilter();
// If you want to ignore expired Certs
aHBPF.IgnorableServerCertificateErrors.Add(ChainValidationResult.Expired);
// Untrused because this is a self signed cert that is not installed
aHBPF.IgnorableServerCertificateErrors.Add(ChainValidationResult.Untrusted);
// Host names and certs names may not match
aHBPF.IgnorableServerCertificateErrors.Add(ChainValidationResult.InvalidName);

HttpClient httpClient = new HttpClient(aHBPF);
HttpResponseMessage response = await httpClient.SendRequestAsync(httpRequest,HttpCompletionoption.ResponseHeadersRead).AsTask(cts.Token);

相关文章

Windows2012R2备用域控搭建 前置操作 域控主域控的主dns:自...
主域控角色迁移和夺取(转载) 转载自:http://yupeizhi.blo...
Windows2012R2 NTP时间同步 Windows2012R2里没有了internet时...
Windows注册表操作基础代码 Windows下对注册表进行操作使用的...
黑客常用WinAPI函数整理之前的博客写了很多关于Windows编程的...
一个简单的Windows Socket可复用框架说起网络编程,无非是建...