How to encrypt data with public key in NodeJS?


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?

By : teerapap

For those who run into this question when googling, the other SO question has it answered already Encrypting data with Public Key in node.js which works well.

By : mspisars

You might be interested in my NaCl bindings. From its 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>}
// lengths of nonces and public and private keys in bytes
// { nonce: x, pubkey: x, privkey: x }
By : thejh

This video can help you solving your question :)
By: admin