Closed hatem-amer closed 2 years ago
In Node Js this done as follows:
const crypto = require('crypto'); const ece = require('http_ece'); const dh = crypto.createECDH('prime256v1'); dh.setPrivateKey("d25a7249abac3beae6d03e0441867de762ea4cfc51e5c202a3fc0a45486d1f94", 'hex'); const params = { version: 'aes128gcm', authSecret: "a7omShAT1ycPQqu9UHaS6Q", privateKey: dh, }; const buf = Buffer.from(array2, 'hex'); const decrypted = ece.decrypt(buf, params); console.log(decrypted.toString());
You can load private keys via load_pem_private_key and load_der_private_key. If you have raw key components you can also use the Numbers classes, although that requires more expertise to use properly.
Numbers
In Node Js this done as follows: