Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

public-encrypt

Package Overview
Dependencies
Maintainers
4
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

public-encrypt

browserify version of publicEncrypt & privateDecrypt

  • 4.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8.9M
decreased by-15.01%
Maintainers
4
Weekly downloads
 
Created

What is public-encrypt?

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.

What are public-encrypt's main functionalities?

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());

Other packages similar to public-encrypt

FAQs

Package last updated on 01 Oct 2018

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc