@complycloud/asn1-der

Javascript library for DER and PEM serialization/deserialization of Abstract Syntax Notation One (ASN.2) object models

Stats

StarsIssuesVersionUpdatedCreatedSize
@complycloud/asn1-der
100.1.33 years ago4 years agoMinified + gzip package size for @complycloud/asn1-der in KB

Readme

@complycloud/asn1-der

Javascript library for DER and PEM serialization/deserialization of Abstract Syntax Notation One (ASN.1)

Uses the ASN.1 Object Model from @complycloud/asn1.

Installation

npm install @complycloud/asn1-der

Usage

import { Universal } from '@complycloud/asn1';
import { DERSerializer } from '@complycloud/asn1-der';
import { readFileSync } from 'fs';

// Serialize to DER
const serialize = new DERSerializer();
const asn1Sequence = new Universal.Sequence([
  new Universal.Integer(123),
  new Universal.PrintableString('Hello World'),
]);
const bufferContainingDEREncodedASN1 = serialize(asn1Sequence);

// Deserialize from PEM
const deserialize = new PEMDeserializer();
const certificate = readFileSync('/path/to/some/certificate.pem', 'utf8');
const certificateASN1 = deserialize(certificate);

Debugging

This library uses the @complyify/debug library for debugging. To enable debug messages, simply set the DEBUG environment variable.

# enable all debugging messages in this library
DEBUG=complycloud:asn1:der:* <your-exec-here>

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.