Skip to content

Getting Started

dweller long gone edited this page May 26, 2026 · 2 revisions

Getting Started

This page covers the shortest path from installation to a ranked ASN.1 definition candidate list.

Install

npm install @pkistudio/asn1defsifter

The package exports:

  • @pkistudio/asn1defsifter: public core API.
  • @pkistudio/asn1defsifter/core: core API alias.
  • @pkistudio/asn1defsifter/app: standalone viewer initializer.
  • @pkistudio/asn1defsifter/styles.css: standalone viewer styles.

First Candidate Lookup

import { createPkiComponentCorpus, findAsn1Candidates, parseInputToTlvNodes } from '@pkistudio/asn1defsifter';

const corpus = createPkiComponentCorpus();
const [node] = await parseInputToTlvNodes('300d06092a864886f70d01010b0500', { format: 'hex' });
const candidates = findAsn1Candidates(node, { schemaCorpus: corpus, maxResults: 5 });

console.log(candidates[0]);

The example DER fragment is an AlgorithmIdentifier-shaped SEQUENCE containing an RSA signature algorithm OID and NULL parameters. The resolver returns ranked candidates rather than a single forced answer.

Generate a PKI Report

Use createPkiCandidateReport() when the built-in PKI corpus is enough:

import { createPkiCandidateReport } from '@pkistudio/asn1defsifter';

const report = await createPkiCandidateReport('300d06092a864886f70d01010b0500', {
  profiles: ['x509', 'pkcs8'],
  minScore: 0.8,
  includeSubtrees: true
});

console.log(report.roots[0].summary.bestCandidate);

See Candidate Reports for report shape details.

Run the Viewer Locally

npm run dev -- --port 5173 --strictPort

Then open:

http://localhost:5173/

The hosted viewer is available at:

https://pkistudio.github.io/asn1defsifter/

Use the embedded PkiStudioJS viewer's Load menu to load DER, BER, PEM, HEX, or clipboard input. ASN.1 Definition Sifter watches the viewer document and refreshes candidates when the document changes.

Use the viewer's Corpora menu to add, edit, remove, save, load, or revert the ASN.1 definition corpora used for candidate matching. The built-in PkiComponents corpus is active by default, and custom corpus names appear in candidate results.

What Results Mean

Candidate results include:

  • ASN.1 typeName and optional moduleName.
  • score from 0 to 1.
  • confidence as low, medium, or high.
  • Human-readable evidence.
  • Diagnostics that explain weak or mismatched aspects.
  • Ambiguity notes for structurally plausible alternatives.
  • Matched paths connecting TLV paths to schema paths.

DER does not preserve field names, module names, comments, or schema-level intent. A high score means the bytes are structurally compatible with a definition; it does not prove global uniqueness.

Clone this wiki locally