在加密中,我只看到Signer / Verifier用于进行数字签名和Cipher / Decipher的对称密钥加密。
如何使用公钥加密数据?
在加密中,我只看到Signer / Verifier用于进行数字签名和Cipher / Decipher的对称密钥加密。
如何使用公钥加密数据?
对于那些在谷歌搜索时遇到这个问题的人,另一个问题已经得到了回答 使用node.js中的公钥加密数据 效果很好。
你可能对我感兴趣 NaCl结合。从其API:
// encrypt and sign
box(message, nonce, pubkey, privkey)
// decrypt and validate
unbox(box, nonce, pubkey, privkey)
// generates a new keypair, returns {private: <buffer>, public: <buffer>}
boxKeypair()
// lengths of nonces and public and private keys in bytes
// { nonce: x, pubkey: x, privkey: x }
lengths.box
对于那些在谷歌搜索时遇到这个问题的人,另一个问题已经得到了回答 使用node.js中的公钥加密数据 效果很好。
你可能对我感兴趣 NaCl结合。从其API:
// encrypt and sign
box(message, nonce, pubkey, privkey)
// decrypt and validate
unbox(box, nonce, pubkey, privkey)
// generates a new keypair, returns {private: <buffer>, public: <buffer>}
boxKeypair()
// lengths of nonces and public and private keys in bytes
// { nonce: x, pubkey: x, privkey: x }
lengths.box
var encrypted = crypto.publicEncrypt(publicKey, buffer);