在浏览器中通过WebCryptoAPI生成ECDH密钥,而不是浏览器化的节点密码模块
我有一个非常小的节点脚本来创build一个公钥/私钥有没有办法在客户端做到这一点,而不必浏览孔encryption模块?
var crypto = require('crypto'); var userCurve = crypto.createECDH('prime256v1'); var userPublicKey = userCurve.generateKeys() var userPrivateKey = userCurve.getPrivateKey();
到目前为止,我已经尝试过:
// https://github.com/diafygi/webcrypto-examples#ecdh---generatekey window.crypto.subtle.generateKey( { name: "ECDH", namedCurve: "P-256", //can be "P-256", "P-384", or "P-521" }, true, //whether the key is extractable (ie can be used in exportKey) ["deriveKey", "deriveBits"] //can be any combination of "deriveKey" and "deriveBits" ) .then(function(key){ //returns a keypair object console.log(key); console.log(key.publicKey); console.log(key.privateKey); }) .catch(function(err){ console.error(err); });
但是,当我login它时,它看起来不像节点版本
- 在Express(MEANJS)生产模式下使用LetsEncrypt SSL证书
- 与crypto.createSign一起使用密码保护的私钥
- 数字签名与node.jsencryption
- 麻烦encryption在iOS上和使用RAW RSA在Node.js解密
- Node.js:将请求的inputinput到crypto.hash中
- AES256encryption在node.js和objective-c之间得到不同的结果
- 基于令牌的authentication(在Node.js中)
- Node.js`crypto.final`使得encryption的结果不同于PHP`mcrypt_encrypt`
- 去朗生成hmac