How can I encrypt data with a public key in Node.js?

teerapap picture teerapap · Oct 15, 2011 · Viewed 18.2k times · Source

In crypto, I see only Signer/Verifier for doing digital signature and Cipher/Decipher with symmetric key encryption.

How do I encrypt data with public key?

Answer

Jalaleddin Hosseini picture Jalaleddin Hosseini · Mar 19, 2018
var encrypted = crypto.publicEncrypt(publicKey, buffer);