🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

@aws-crypto/raw-rsa-keyring-node

Package Overview
Dependencies
Maintainers
8
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aws-crypto/raw-rsa-keyring-node

4.2.1
latest
npm
Version published
Weekly downloads
263K
18.75%
Maintainers
8
Weekly downloads
 
Created

What is @aws-crypto/raw-rsa-keyring-node?

@aws-crypto/raw-rsa-keyring-node is a package provided by AWS that allows you to use raw RSA keyrings for encryption and decryption operations. It is part of the AWS Encryption SDK for JavaScript, which provides tools for encrypting and decrypting data using various key management techniques.

What are @aws-crypto/raw-rsa-keyring-node's main functionalities?

Encrypting Data

This code demonstrates how to use the @aws-crypto/raw-rsa-keyring-node package to encrypt data using a raw RSA keyring. It generates an RSA key pair, creates a keyring, and then encrypts a plaintext message.

const { RawRsaKeyringNode, encrypt } = require('@aws-crypto/raw-rsa-keyring-node');
const { KeyPair } = require('crypto');

const keyPair = KeyPair.generateSync('rsa', {
  modulusLength: 2048,
});

const keyring = new RawRsaKeyringNode({
  keyName: 'my-key',
  keyNamespace: 'my-namespace',
  publicKey: keyPair.publicKey,
  privateKey: keyPair.privateKey,
});

const plaintext = Buffer.from('Hello, world!');

(async () => {
  const { result } = await encrypt(keyring, plaintext);
  console.log(result);
})();

Decrypting Data

This code demonstrates how to use the @aws-crypto/raw-rsa-keyring-node package to decrypt data using a raw RSA keyring. It generates an RSA key pair, creates a keyring, and then decrypts a ciphertext message.

const { RawRsaKeyringNode, decrypt } = require('@aws-crypto/raw-rsa-keyring-node');
const { KeyPair } = require('crypto');

const keyPair = KeyPair.generateSync('rsa', {
  modulusLength: 2048,
});

const keyring = new RawRsaKeyringNode({
  keyName: 'my-key',
  keyNamespace: 'my-namespace',
  publicKey: keyPair.publicKey,
  privateKey: keyPair.privateKey,
});

const ciphertext = Buffer.from('...'); // Replace with actual ciphertext

(async () => {
  const { plaintext } = await decrypt(keyring, ciphertext);
  console.log(plaintext.toString());
})();

Other packages similar to @aws-crypto/raw-rsa-keyring-node

FAQs

Package last updated on 10 Apr 2025

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