
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
@peculiar/asn1-cms
Advanced tools
@peculiar/asn1-cms is a JavaScript library for handling ASN.1 structures related to Cryptographic Message Syntax (CMS). It provides tools for encoding and decoding CMS data structures, which are used in secure messaging and data encryption applications.
Encoding CMS Structures
This feature allows you to encode CMS structures into ASN.1 BER format. The code sample demonstrates creating a ContentInfo object with a simple data content type and encoding it to a binary format.
const { ContentInfo } = require('@peculiar/asn1-cms');
const contentInfo = new ContentInfo({
contentType: '1.2.840.113549.1.7.1', // data
content: Buffer.from('Hello, World!')
});
const encoded = contentInfo.toSchema().toBER();
console.log(encoded);
Decoding CMS Structures
This feature allows you to decode ASN.1 BER encoded CMS structures. The code sample shows how to decode a binary encoded ContentInfo object and access its content type and content.
const { ContentInfo } = require('@peculiar/asn1-cms');
const encodedData = new Uint8Array([/* some encoded data */]);
const contentInfo = ContentInfo.fromBER(encodedData.buffer);
console.log(contentInfo.contentType);
console.log(contentInfo.content);
asn1js is a library for encoding and decoding ASN.1 data structures in JavaScript. It provides a more general-purpose ASN.1 handling capability compared to @peculiar/asn1-cms, which is specifically focused on CMS structures.
pkijs is a library for working with Public Key Infrastructure (PKI) in JavaScript. It includes support for CMS, but also provides broader functionality for handling certificates, CRLs, and other PKI-related structures. It is more comprehensive than @peculiar/asn1-cms, which is focused solely on CMS.
FAQs
ASN.1 schema of `Cryptographic Message Syntax (CMS)` (RFC5652)
The npm package @peculiar/asn1-cms receives a total of 172,446 weekly downloads. As such, @peculiar/asn1-cms popularity was classified as popular.
We found that @peculiar/asn1-cms demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 7 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
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.