Elliptic Curve Diffie-Hellman with ephemeral-static keys implementation for NodeJS
npm install ecdh-esElliptic Curve Diffie-Hellman with ephemeral-static keys implementation for NodeJS
npm install --save ecdh-es
var encrypted = ecdh.encrypt(pubkey, 'Hello, world!') // -> Buffer
var decrypted = ecdh.decrypt(privkey, encrypted) // -> Buffer
// (use toString() to convert back to string message)
// Uses the secp256k1 curve and AES-128-CBC cipher by default,
// but can be overridden as follows:
var ecdh = require('ecdh-es')({
curve_name: 'secp192k1',
cipher_algo: 'AES-256-CBC',
key_size: 32,
iv_size: 16
})
crypto api)If you're not using browserify, you can use the standalone bundle at dist/ecdh.min.js,
which comes packaged with all of the dependencies.
Including it in your page will provide global ECDH object you can use.
MIT