我以这种方式生成 ECDH 密钥
let _this = this;
window.crypto.subtle.generateKey(
{
name: "ECDH",
namedCurve: "P-256", // the curve name
},
true, // <== Here if you want it to be exportable !!
["deriveKey", "deriveBits"] // usage
)
.then(key => {
_this.keys = key;
// export
return window.crypto.subtle.exportKey(
"raw", //can be "jwk" (public or private), "raw" (public only), "spki" (public only), or "pkcs8" (private only)
_this.keys.publicKey
)
.then(rawPublicKey => {
_this.publicKey = rawPublicKey;
return rawPublicKey;
})
})
这样我就有了密码和原始(x,y 坐标)公钥。
我将使用密钥将其用于 ECDSA
我怎样才能做到这一点?