Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@fidm/asn1

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fidm/asn1

ASN.1/DER, PEM for Node.js

  • 1.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
35K
decreased by-88.21%
Maintainers
1
Weekly downloads
 
Created

What is @fidm/asn1?

@fidm/asn1 is a Node.js library for encoding and decoding ASN.1 (Abstract Syntax Notation One) 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 useful for working with various cryptographic standards and protocols that use ASN.1 encoding, such as X.509 certificates.

What are @fidm/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 end the sequence.

const asn1 = require('@fidm/asn1');

const data = asn1.BerWriter();
data.startSequence();
data.writeInt(12345);
data.endSequence();
console.log(data.buffer);

Decoding ASN.1 Data

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

const asn1 = require('@fidm/asn1');

const buffer = Buffer.from([0x30, 0x03, 0x02, 0x01, 0x01]);
const reader = new asn1.BerReader(buffer);
reader.readSequence();
const intValue = reader.readInt();
console.log(intValue);

Parsing X.509 Certificates

This feature allows you to parse X.509 certificates, which are commonly used in SSL/TLS. The code sample demonstrates how to read a certificate file and parse its ASN.1 structure.

const asn1 = require('@fidm/asn1');
const fs = require('fs');

const certBuffer = fs.readFileSync('path/to/certificate.crt');
const reader = new asn1.BerReader(certBuffer);
reader.readSequence();
const cert = reader.readSequence();
console.log(cert);

Other packages similar to @fidm/asn1

Keywords

FAQs

Package last updated on 03 Mar 2019

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