New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@ldapjs/asn1

Package Overview
Dependencies
Maintainers
4
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ldapjs/asn1

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

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
121K
decreased by-16.26%
Maintainers
4
Weekly downloads
 
Created

What is @ldapjs/asn1?

@ldapjs/asn1 is a Node.js 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. This package is particularly useful for working with LDAP (Lightweight Directory Access Protocol) data, which often uses ASN.1 encoding.

What are @ldapjs/asn1's main functionalities?

Encoding ASN.1 Data

This feature allows you to encode data into ASN.1 format. The code sample demonstrates how to create a BER (Basic Encoding Rules) writer, start a sequence, write an integer, and then end the sequence. The resulting buffer contains the encoded ASN.1 data.

const asn1 = require('@ldapjs/asn1');
const Ber = asn1.Ber;

const writer = new Ber.Writer();
writer.startSequence();
writer.writeInt(42);
writer.endSequence();

const encodedData = writer.buffer;
console.log(encodedData);

Decoding ASN.1 Data

This feature allows you to decode ASN.1 data. The code sample demonstrates how to create a BER reader, read a sequence, and then read an integer from the encoded data. The resulting value is the decoded integer.

const asn1 = require('@ldapjs/asn1');
const Ber = asn1.Ber;

const encodedData = Buffer.from([0x30, 0x03, 0x02, 0x01, 0x2A]);
const reader = new Ber.Reader(encodedData);
reader.readSequence();
const value = reader.readInt();

console.log(value); // 42

Other packages similar to @ldapjs/asn1

FAQs

Package last updated on 22 Feb 2023

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