Socket
Book a DemoInstallSign in
Socket

@peculiar/asn1-cms

Package Overview
Dependencies
Maintainers
7
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@peculiar/asn1-cms

ASN.1 schema of `Cryptographic Message Syntax (CMS)` (RFC5652)

latest
npmnpm
Version
2.5.0
Version published
Weekly downloads
204K
13.89%
Maintainers
7
Weekly downloads
 
Created

What is @peculiar/asn1-cms?

@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.

What are @peculiar/asn1-cms's main functionalities?

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);

Other packages similar to @peculiar/asn1-cms

Keywords

asn

FAQs

Package last updated on 08 Sep 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