![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.
eckey-utils
Advanced tools
Node.js based EC key utilities that can generate PEM keys (required by crypto.sign and crypto.verify) from the raw ones usually but not necessarily generated by crypto.ECDH
Node.js based EC key utilities to generate the PEM contents (required by crypto.Sign and crypto.Verify) from the raw keys generated by crypto.ECDH and to parse key info from given PEM content. The lastest update has added JWK support.
Namely the ECDH.generateKeys function should be used to generate EC keys for the key-exchange purpose, but actually the keys it generates are bare/raw ec private key (i.e., d
in the cryptographic context) and ec public key (the relevant EC point, calculated from base point G
and d
), so supposedly there's no obstacle to use it in ECSDA scenario except that the crypto.Sign and crypto.Verify function doesn't support using raw key directly. This library comes out to bridge this gap by converting raw keys to PEM keys.
On the other side, this library provides a symmetrical function to parse key info (private key PEM -> {privateKey, curveName, publicKey?}, public key PEM -> {curveName, publicKey}) from the given EC PEM content, and such information can be used by crypto.ECDH.
P.s., the latest update: added JWK support - generation and parse.
Some people argue that use one key pair for both ECDH and ECDSA will compromise the security, so please try to avoid using one key pair for both usages except that you know dearly that there's no negative byeffect.
Generate PEM from raw keys
const crypto = require('crypto'), ecKeyUtils = require('eckey-utils');
const curveName = 'secp256k1';
const ecdh = crypto.createECDH(curveName);
ecdh.generateKeys();
const pems = ecKeyUtils.generatePem({
curveName,
privateKey: ecdh.getPrivateKey(),
publicKey: ecdh.getPublicKey()
});
const sign = crypto.createSign('sha256');
const message = Buffer.from('Hello, World!');
sign.update(message);
let sig = sign.sign(pems.privateKey);
const verify = crypto.createVerify('sha256');
verify.update(message);
console.log(verify.verify(pems.publicKey, sig));
Parse key information from PEM
const ecKeyUtils = require('eckey-utils');
console.log(ecKeyUtils.parsePem(`-----BEGIN EC PRIVATE KEY-----
MIHcAgEBBEIBL1+Q5pDjC9ijZg/XCBhaJrV8pM+v/XgcwC53sWRFK69paB9zzVAD
ZqzrgXOAghxqWx0QEG8RhvXowXzMOuLmHz2gBwYFK4EEACOhgYkDgYYABAAlLIp1
uSSj9wjrpr4+9UitBXtEwB5AAS/PHyK/FLvM0Ybz0PDeg8RTqKXJziwz0i0AjvWp
FQSyuJe5PXesKhRzXQDqJQTijoekz5mWOdYLRnKln0B87JrXbpx+R0slrEJzPeHo
7fv+DaM09Dfvy30CLHhzaGqRpesz+rvPVKYCyun8EQ==
-----END EC PRIVATE KEY-----`));
console.log(ecKeyUtils.parsePem(`-----BEGIN PUBLIC KEY-----
MD4wEAYHKoZIzj0CAQYFZysBBAkDKgAEgiGotjsUDWG11VFfkBsSoscOvrH27hjw
6bHXZwpyLjXW19Th2MRYGg==
-----END PUBLIC KEY-----`));
Node.js version later than 5.x
Written in 2018 by tibetty xihua.duan@gmail.com
FAQs
Node.js based EC key utilities that can generate PEM keys (required by crypto.sign and crypto.verify) from the raw ones usually but not necessarily generated by crypto.ECDH
The npm package eckey-utils receives a total of 922 weekly downloads. As such, eckey-utils popularity was classified as not popular.
We found that eckey-utils 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.