Socket
Socket
Sign inDemoInstall

public-encrypt

Package Overview
Dependencies
23
Maintainers
4
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Protect your apps from supply chain attacks

Install

public-encrypt

browserify version of publicEncrypt & privateDecrypt

    4.0.3latest
    GitHub
    npm

Version published
Maintainers
4
Weekly downloads
8,579,935
increased by2.58%

Weekly downloads

Package description

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

Readme

Source

publicEncrypt

Build Status

publicEncrypt/privateDecrypt for browserify

Blog post about the moving parts that have gone into this.

FAQs

Last updated on 01 Oct 2018

Did you know?

Socket installs a GitHub app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc