Socket
Socket
Sign inDemoInstall

parse-asn1

Package Overview
Dependencies
Maintainers
5
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

parse-asn1

[![TRAVIS](https://secure.travis-ci.org/crypto-browserify/parse-asn1.png)](http://travis-ci.org/crypto-browserify/parse-asn1) [![NPM](http://img.shields.io/npm/v/parse-asn1.svg)](https://www.npmjs.org/package/parse-asn1)


Version published
Maintainers
5
Created

What is parse-asn1?

The parse-asn1 npm package is used for parsing ASN.1 (Abstract Syntax Notation One) data. 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 dealing with cryptographic formats, as many cryptographic protocols use ASN.1 to define the structure of keys and certificates.

What are parse-asn1's main functionalities?

Parsing ASN.1 DER

This feature allows you to parse ASN.1 DER (Distinguished Encoding Rules) encoded data. The code sample reads a DER-encoded file (e.g., a certificate) from the filesystem and uses parse-asn1 to parse it into a JavaScript object.

const parseAsn1 = require('parse-asn1');
const fs = require('fs');

const der = fs.readFileSync('certificate.der');
const certificate = parseAsn1(der);
console.log(certificate);

Extracting Public Key

This feature is used to extract a public key from a DER-encoded file. The code sample demonstrates how to read the DER file and parse it to obtain the public key information.

const parseAsn1 = require('parse-asn1');
const fs = require('fs');

const der = fs.readFileSync('publicKey.der');
const publicKey = parseAsn1(der);
console.log(publicKey);

Parsing Private Key

This feature enables the parsing of a private key from a DER-encoded file. The code sample shows how to read the DER file and use parse-asn1 to parse the private key.

const parseAsn1 = require('parse-asn1');
const fs = require('fs');

const der = fs.readFileSync('privateKey.der');
const privateKey = parseAsn1(der);
console.log(privateKey);

Other packages similar to parse-asn1

FAQs

Package last updated on 29 Oct 2015

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