Windows 10 通用应用程序 - 忽略 SSL 证书验证 [英] Windows 10 Universal App - Ignore SSL Certificate Valdiation

查看:66
本文介绍了Windows 10 通用应用程序 - 忽略 SSL 证书验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发手机 Windows 10 通用应用程序.我正在尝试使用自动签名证书连接到 OAuth 服务器.

I am working on a phone Windows 10 Universal Application. I am trying to connect to an OAuth server with auto-signed certificate.

当我打开该服务器的 Web 视图时,我收到错误消息:

When I open a web view to that server I get the error :

访问此资源所需的安全证书无效"

"Security certificate required to access this resource is invalid"

我想使用以下指令,但通用应用上不存在 ServicePointManager.

I wanted to use the following intstruction but ServicePointManager does not exist on Universal App.

ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };

知道如何绕过这些应用程序的 ssl 验证吗?谢谢.

Any idea how to bypass ssl validation on these apps ? Thanks.

推荐答案

在 Windows Runtime 中,webview 永远不应转到不受信任的页面,因此您将遇到上述异常.
为了解决您的问题,您需要在您的 UWP 应用程序中包含证书,否则您必须忽略 SSL 证书错误.

In Windows Runtime the webview should not ever go to an untrusted page, so you will meet the above exception.
In order to solve your problem, you need to include the Certificates on your UWP app or you have to Ignore SSL Certificate errors.

关于如何在您的 UWP 应用中包含证书,您需要将证书"声明添加到您的 Package.appxmanifest.
更多信息,请尝试参考这篇文章:http://blogs.msdn.com/b/wsdevsol/archive/2014/06/05/include-self-signed-certificates-with-your-windows-runtime-based-windows-phone-8-1-apps.aspx

For how to include the Certificates on your UWP app, you need to add the "Certificate" Declaration to your Package.appxmanifest.
For more information, please try to refer to this article: http://blogs.msdn.com/b/wsdevsol/archive/2014/06/05/including-self-signed-certificates-with-your-windows-runtime-based-windows-phone-8-1-apps.aspx

是的,ServicePointManager 在 Windows 运行时应用程序中不可用,为了忽略 SSL 证书错误,我们可以使用 HttpBaseProtocolFilter.IgnorableServerCertificateErrors |ignorableServerCertificateErrors 属性来帮助我们.更多信息,请尝试参考以下两篇文章:
http://blogs.msdn.com/b/wsdevsol/archive/2013/10/17/how-to-ignore-self-signed-certificate-errors-in-windows-store-apps-8-1.aspx.
https://bernhardelbl.wordpress.com/2013/06/28/ignore-ssl-certificate-errors-in-windows-8-1-apps/.

Yes, ServicePointManager is not available in the Windows Runtime app, in order to ignore SSL Certificate errors, we can use the HttpBaseProtocolFilter.IgnorableServerCertificateErrors | ignorableServerCertificateErrors property to help us. For more information, please try to refer to the following two articles:
http://blogs.msdn.com/b/wsdevsol/archive/2013/10/17/how-to-ignore-self-signed-certificate-errors-in-windows-store-apps-8-1.aspx.
https://bernhardelbl.wordpress.com/2013/06/28/ignore-ssl-certificate-errors-in-windows-8-1-apps/.

这篇关于Windows 10 通用应用程序 - 忽略 SSL 证书验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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