Socket
Socket
Sign inDemoInstall

jsencrypt

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsencrypt

A Javascript library to perform OpenSSL RSA Encryption, Decryption, and Key Generation.


Version published
Weekly downloads
115K
decreased by-13.86%
Maintainers
1
Weekly downloads
 
Created

What is jsencrypt?

The jsencrypt npm package is a JavaScript library used for performing RSA encryption and decryption. It allows you to encrypt and decrypt data using RSA keys, sign messages, and verify signatures. This package is particularly useful for securing data in web applications.

What are jsencrypt's main functionalities?

RSA Encryption

This feature allows you to encrypt data using a public RSA key. The code sample demonstrates how to set a public key and encrypt a message.

const JSEncrypt = require('jsencrypt');
const encrypt = new JSEncrypt();
encrypt.setPublicKey('-----BEGIN PUBLIC KEY-----...-----END PUBLIC KEY-----');
const encrypted = encrypt.encrypt('Hello World');
console.log(encrypted);

RSA Decryption

This feature allows you to decrypt data using a private RSA key. The code sample shows how to set a private key and decrypt an encrypted message.

const JSEncrypt = require('jsencrypt');
const decrypt = new JSEncrypt();
decrypt.setPrivateKey('-----BEGIN PRIVATE KEY-----...-----END PRIVATE KEY-----');
const decrypted = decrypt.decrypt(encrypted);
console.log(decrypted);

Signing Messages

This feature allows you to sign messages using a private RSA key. The code sample demonstrates how to set a private key and sign a message.

const JSEncrypt = require('jsencrypt');
const sign = new JSEncrypt();
sign.setPrivateKey('-----BEGIN PRIVATE KEY-----...-----END PRIVATE KEY-----');
const signature = sign.sign('Message to sign', CryptoJS.SHA256, 'sha256');
console.log(signature);

Verifying Signatures

This feature allows you to verify signatures using a public RSA key. The code sample shows how to set a public key and verify a signed message.

const JSEncrypt = require('jsencrypt');
const verify = new JSEncrypt();
verify.setPublicKey('-----BEGIN PUBLIC KEY-----...-----END PUBLIC KEY-----');
const isValid = verify.verify('Message to sign', signature, CryptoJS.SHA256);
console.log(isValid);

Other packages similar to jsencrypt

FAQs

Package last updated on 21 Jun 2016

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