Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@aws-crypto/kms-keyring-node
Advanced tools
The AWS Encryption SDK for JavaScript is a client-side encryption library designed to make it easy for everyone to encrypt and decrypt data using industry standards and best practices. It uses a data format compatible with the AWS Encryption SDKs in other
@aws-crypto/kms-keyring-node is an AWS SDK package that provides keyring implementations for AWS Key Management Service (KMS). It allows you to encrypt and decrypt data using AWS KMS keys in a Node.js environment.
Encrypting Data
This feature allows you to encrypt data using a KMS key. The code sample demonstrates how to create a KMS keyring and use it to encrypt a plaintext message.
const { KmsKeyringNode, buildClient, CommitmentPolicy } = require('@aws-crypto/kms-keyring-node');
const { encrypt } = require('@aws-crypto/client-node');
const keyring = new KmsKeyringNode({ generatorKeyId: 'arn:aws:kms:us-west-2:123456789012:key/abcd-1234-efgh-5678' });
const plaintext = Buffer.from('Hello, world!');
(async () => {
const { result } = await encrypt(keyring, plaintext);
console.log(result); // Encrypted data
})();
Decrypting Data
This feature allows you to decrypt data that was encrypted using a KMS key. The code sample demonstrates how to create a KMS keyring and use it to decrypt an encrypted message.
const { KmsKeyringNode, buildClient, CommitmentPolicy } = require('@aws-crypto/kms-keyring-node');
const { decrypt } = require('@aws-crypto/client-node');
const keyring = new KmsKeyringNode({ generatorKeyId: 'arn:aws:kms:us-west-2:123456789012:key/abcd-1234-efgh-5678' });
const encryptedData = Buffer.from('...'); // Encrypted data from previous step
(async () => {
const { plaintext } = await decrypt(keyring, encryptedData);
console.log(plaintext.toString()); // Decrypted data
})();
Multi-Region Keyring
This feature allows you to create a multi-region keyring that can use multiple KMS keys from different regions. The code sample demonstrates how to configure a keyring with multiple KMS key ARNs.
const { KmsKeyringNode } = require('@aws-crypto/kms-keyring-node');
const keyring = new KmsKeyringNode({
generatorKeyId: 'arn:aws:kms:us-west-2:123456789012:key/abcd-1234-efgh-5678',
keyIds: [
'arn:aws:kms:us-east-1:123456789012:key/abcd-1234-efgh-5678',
'arn:aws:kms:eu-west-1:123456789012:key/abcd-1234-efgh-5678'
]
});
console.log(keyring);
The aws-sdk package is the official AWS SDK for JavaScript, which includes support for AWS KMS among many other AWS services. It provides a more general-purpose interface for interacting with AWS services, including KMS, but does not offer the same high-level abstractions for encryption and decryption as @aws-crypto/kms-keyring-node.
node-forge is a JavaScript library for implementing various cryptographic functions, including encryption and decryption. While it does not integrate directly with AWS KMS, it provides a wide range of cryptographic utilities that can be used for similar purposes. It requires more manual setup and does not offer the same seamless integration with AWS services.
crypto-js is a popular library for cryptographic operations in JavaScript. It provides a variety of cryptographic algorithms and utilities but does not integrate with AWS KMS. It is useful for general-purpose cryptographic needs but lacks the specific key management features provided by @aws-crypto/kms-keyring-node.
The AWS Encryption SDK for JavaScript is a client-side encryption library designed to make it easy for everyone to encrypt and decrypt data using industry standards and best practices. It uses a data format compatible with the AWS Encryption SDKs in other languages. For more information on the AWS Encryption SDKs in all languages, see the Developer Guide.
This package should only be used as part of the AWS Encryption SDK for Javascript. For more information about the packages in this project and how they can be used together, see the main node package readme
npm install @aws-crypto/kms-keyring-node
npm test
This SDK is distributed under the Apache License, Version 2.0, see LICENSE.txt and NOTICE.txt for more information.
FAQs
The AWS Encryption SDK for JavaScript is a client-side encryption library designed to make it easy for everyone to encrypt and decrypt data using industry standards and best practices. It uses a data format compatible with the AWS Encryption SDKs in other
The npm package @aws-crypto/kms-keyring-node receives a total of 162,557 weekly downloads. As such, @aws-crypto/kms-keyring-node popularity was classified as popular.
We found that @aws-crypto/kms-keyring-node demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.