Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
public-encrypt
Advanced tools
The public-encrypt npm package provides functionality for asymmetric encryption and decryption using public and private keys. It allows users to encrypt data with a public key that can only be decrypted with the corresponding private key, and vice versa.
Public Key Encryption
This feature allows you to encrypt data using a public key. The encrypted data can only be decrypted by someone with the corresponding private key.
const { publicEncrypt } = require('public-encrypt');
const { publicKey, privateKey } = require('crypto').generateKeyPairSync('rsa', { modulusLength: 2048 });
const encryptedData = publicEncrypt(publicKey, Buffer.from('Hello, World!'));
console.log(encryptedData);
Private Key Decryption
This feature allows you to decrypt data using a private key that corresponds to the public key used for encryption.
const { privateDecrypt } = require('public-encrypt');
const { publicKey, privateKey } = require('crypto').generateKeyPairSync('rsa', { modulusLength: 2048 });
const encryptedData = publicEncrypt(publicKey, Buffer.from('Hello, World!'));
const decryptedData = privateDecrypt(privateKey, encryptedData);
console.log(decryptedData.toString());
node-rsa is a package that provides similar functionality for RSA encryption and decryption. It offers a more object-oriented approach compared to public-encrypt and includes additional features such as signing and verifying.
forge is a comprehensive library that includes not only public key encryption but also other cryptographic operations. It is more extensive than public-encrypt, providing a full set of tools for encryption, hashing, and TLS.
crypto-browserify is designed to emulate the Node.js crypto module for use in the browser. It includes functionality for public and private key encryption and decryption, similar to public-encrypt, but is tailored for browser environments.
publicEncrypt/privateDecrypt for browserify
FAQs
browserify version of publicEncrypt & privateDecrypt
The npm package public-encrypt receives a total of 7,173,301 weekly downloads. As such, public-encrypt popularity was classified as popular.
We found that public-encrypt demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.