Socket
Socket
Sign inDemoInstall

public-encrypt

Package Overview
Dependencies
22
Maintainers
4
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    public-encrypt

browserify version of publicEncrypt & privateDecrypt


Version published
Weekly downloads
8.5M
increased by3.17%
Maintainers
4
Install size
520 kB
Created
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 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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc