本文介绍了[UWP] [JS] invalidCertificateAuthorityPolicy在Javascript UWP应用程序中无法忽略。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

鉴于使用Javascript开发的UWP应用程序,

Given an UWP application, developed with Javascript,

当我尝试忽略SSL CA无效错误时,使用相关API,Javascript运行时抛出错误,仅针对ChainValidationResult.InvalidCertificateAuthorityPolicy:

When I try to ignore SSL CA invalid error, using the relevant API, the Javascript runtime throws an error, only for ChainValidationResult.InvalidCertificateAuthorityPolicy :

var hBPF = new Windows.Web.Http.Filters.HttpBaseProtocolFilter();

hBPF.ignorableServerCertificateErrors.push(Windows.Security.Cryptography.ChainValidationResult.InvalidCertificateAuthorityPolicy);

hBPF.ignorableServerCertificateErrors.push(Windows.Security.Cryptography.ChainValidationResult.InvalidCertificateAuthorityPolicy);

结果:

错误:该值不是有效的ChainValidationResult。

Error : the value is not a valid ChainValidationResult.

有用的信息:

- ChainValidationResult。 invalidCertificateAuthorityPolicy在记录时返回有效值8,它确实存在

- the ChainValidationResult.invalidCertificateAuthorityPolicy returns a valid value of 8 when logged, it does exist

- 枚举的其他值ChainValidationResult可以添加且无错误

- other values of enum ChainValidationResult are OK and can be added without errors

- 我试过w /和没有设置"企业身份验证" ;在清单中

- I tried w/ and w/o setting "Enterprise authentication" in manifest




 

推荐答案

首先,代码中存在错误。它应该是
而不是  Windows.Security.Cryptography.ChainValidationResult.InvalidCertificateAuthorityPolicy。

First, there is a mistake in your code. It should be Windows.Security.Cryptography.Certificates.ChainValidationResult.invalidCertificateAuthorityPolicy instead of Windows.Security.Cryptography.ChainValidationResult.InvalidCertificateAuthorityPolicy.

另一件事是WinRT不允许忽略这一点。即使你把正确的参数。它还将显示此错误"WinRT信息:'项':提供的值不是可忽略的ChainValidationResult值。"这是设计的。 

Another thing is the WinRT do not allow to ignore this. Even you put the correctly parameter. It will also show this error "WinRT information: 'item': Provided value is not an ignorable ChainValidationResult value." This is by design. 

祝你好运,

Roy


这篇关于[UWP] [JS] invalidCertificateAuthorityPolicy在Javascript UWP应用程序中无法忽略。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-26 08:36