Socket
Socket
Sign inDemoInstall

asn1

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

asn1

Contains parsers and serializers for ASN.1 (currently BER only)


Version published
Weekly downloads
18M
increased by3.37%
Maintainers
1
Weekly downloads
 
Created

What is asn1?

The asn1 npm package is a library for encoding and decoding Abstract Syntax Notation One (ASN.1) data structures. ASN.1 is a standard interface description language for defining data structures that can be serialized and deserialized in a cross-platform way.

What are asn1's main functionalities?

BER Encoding

This feature allows you to encode data structures using Basic Encoding Rules (BER), which is one of the encoding rules provided by ASN.1.

const asn1 = require('asn1');
const Ber = asn1.Ber;

const writer = new Ber.Writer();
writer.writeInt(123);
const buffer = writer.buffer;

BER Decoding

This feature allows you to decode data structures that were encoded using BER. You can read various types of data, such as integers, from the buffer.

const asn1 = require('asn1');
const Ber = asn1.Ber;

const reader = new Ber.Reader(buffer);
const number = reader.readInt();

Defining ASN.1 Structures

This feature allows you to define custom ASN.1 structures using a fluent API and then encode them. The example shows how to define a structure with an integer and an octet string.

const asn1 = require('asn1');

const ASN1 = asn1.define('MyStructure', function() {
  this.seq().obj(
    this.key('id').int(),
    this.key('value').octstr()
  );
});

const encoded = ASN1.encode({ id: 1, value: Buffer.from('hello') }, 'der');

Other packages similar to asn1

FAQs

Package last updated on 08 Dec 2011

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