gpt4 book ai didi

javascript - 网络加密 API : importKey does not work in Firefox

转载 作者:行者123 更新时间:2023-11-27 23:43:40 25 4
gpt4 key购买 nike

我在 Google Chrome 46 和 Firefox 41 ( JSBin ) 中尝试了 importKey 的示例:

window.crypto.subtle.importKey(
"jwk", //can be "jwk" (public or private), "spki" (public only), or "pkcs8" (private only)
{ //this is an example jwk key, other key types are Uint8Array objects
kty: "RSA",
e: "AQAB",
n: "vGO3eU16ag9zRkJ4AK8ZUZrjbtp5xWK0LyFMNT8933evJoHeczexMUzSiXaLrEFSyQZortk81zJH3y41MBO_UFDO_X0crAquNrkjZDrf9Scc5-MdxlWU2Jl7Gc4Z18AC9aNibWVmXhgvHYkEoFdLCFG-2Sq-qIyW4KFkjan05IE",
alg: "PS256",
ext: true,
},
{ //these are the algorithm options
name: "RSA-PSS",
hash: {name: "SHA-256"}, //can be "SHA-1", "SHA-256", "SHA-384", or "SHA-512"
},
false, //whether the key is extractable (i.e. can be used in exportKey)
["verify"] //"verify" for public key import, "sign" for private key imports
)
.then(
result => console.log('Ok', result),
e => console.error(e.message)
)

它在 Chrome 中工作,但在 Firefox 中出现指定了无效或非法字符串错误。哪个字符串无效或不合法,为什么?

最佳答案

Firefox 尚不支持 RSA-PSS 算法。您可以在 Bug 1191936 跟踪该错误以针对 WebCrypto 实现它。 .

关于javascript - 网络加密 API : importKey does not work in Firefox,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33437075/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com