我正在尝试使用javascript(WinRT)在UWP(通用Windows应用程序)上安装x509证书(实用)。
public step(): void {
let options: any = window.Windows.Security.Cryptography.Certificates.InstallOptions.none;
try {
window.Windows.Security.Cryptography.Certificates.CertificateEnrollmentManager
.installCertificateAsync(this.x509, options)
.done((resp: any) => {
console.log(resp);
});
} catch (err) {
console.log(err);
}
}
证书如下:
-----开始证书----- ... -----结束证书-----
然而,代码错误地显示以下消息。
//# sourceURL=browsertools://browsertools.library.js
(function() { return function(err) { var o = {};o["Windows.Foundation.IAsyncAction"] = function () { o["WinRT Promise.done()"](); };o["WinRT Promise.done()"] = function () { throw err; };return o["Windows.Foundation.IAsyncAction"]}})()
WinRTError: The data is invalid.
InstallResponse
at o[WinRT Promise.done()] (eval code:1:175)
at o[Windows.Foundation.IAsyncAction] (eval code:1:10
有什么想法吗?