![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
ecies-lite
Advanced tools
A lightweight ECIES tool implemented in pure Node.JS
First of all, eccrypto
is a great tool that supports many EC crypto functions. However, it was developed years ago, and the crypto library has evolved a lot since then. It seems that ECIES (Elliptic Curve Integrated Encryption Scheme) can be implemented in pure Node.JS, so I re-implemented it with the help of the latest crypto module released with Node.JS 10.x (according to my test, it runs pretty well with any node version after 6.x).
config(curveName, cipherAlgorithm, hmacAlgorithm, ivSize, cipherKeyGen, hmacKeyGen)
Config the default parameters for ecies-lite
encrypt(pk, msg, opts)
Encrypt a message using the recepient's public key
decrypt(sk, body, opts)
Decrypt a message in ecies-lite defined format using the recipient's private key
const crypto = require('crypto'),
ecies = require('ecies-lite');
let ecdh = crypto.createECDH('secp256k1');
ecdh.generateKeys();
let publicKey = ecdh.getPublicKey();
let body = ecies.encrypt(publicKey, Buffer.from('This message is for demo purpose'));
/** structure of ECIES body
epk: ephemeral public key;
iv: initialization vector for the cipher algorithm;
ct: cipher text with the derived encrypt key;
mac: MAC value of the above fields using the derived MAC key;
**/
for (let [k, v] of Object.entries(body)) {
console.log(`${k}(${v.length}B):`, v.toString('base64'));
}
let plain = ecies.decrypt(ecdh.getPrivateKey(), body);
console.log('Decrypted plain text:', plain.toString('utf-8'));
const curveName = 'prime256v1';
ecdh = crypto.createECDH(curveName);
ecdh.generateKeys();
const ephemEcdh = crypto.createECDH(curveName);
ephemEcdh.generateKeys();
const macKeyGen = (bytes) => {
let buf = Buffer.from(bytes);
for (let [index, value] of buf.entries()) {
buf[index] = value ^ index;
}
return buf;
}
ecies.config({curveName, macKeyGen});
body = ecies.encrypt(recEcdh.getPublicKey(), Buffer.from('This message is to demo advanced usage'), {esk: ephemEcdh.getPrivateKey()});
console.log(ecies.decrypt(recEcdh.getPrivateKey(), body).toString('utf-8'));
crypto
module shipped with Node later than 6.x
ISC Written in 2018 by tibetty xihua.duan@gmail.com
FAQs
A lightweight ECIES tool implemented in pure Node.JS
The npm package ecies-lite receives a total of 19 weekly downloads. As such, ecies-lite popularity was classified as not popular.
We found that ecies-lite demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.