Installations
npm install @lapo/asn1js
Developer Guide
Typescript
No
Module System
ESM
Min. Node Version
>=12.20.0
Node Version
21.5.0
NPM Version
10.2.4
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (96.58%)
CSS (1.5%)
HTML (1.14%)
Shell (0.79%)
Developer
lapo-luchini
Download Statistics
Total Downloads
1,014,814
Last Day
1,730
Last Week
7,639
Last Month
31,423
Last Year
343,054
GitHub Statistics
595 Stars
516 Commits
162 Forks
25 Watching
15 Branches
7 Contributors
Bundle Size
205.21 kB
Minified
35.32 kB
Minified + Gzipped
Package Meta Information
Latest Version
2.0.4
Package Id
@lapo/asn1js@2.0.4
Unpacked Size
530.06 kB
Size
61.39 kB
File Count
11
NPM Version
10.2.4
Node Version
21.5.0
Publised On
08 May 2024
Total Downloads
Cumulative downloads
Total Downloads
1,014,814
Last day
1.1%
1,730
Compared to previous day
Last week
-1.8%
7,639
Compared to previous week
Last month
2.6%
31,423
Compared to previous month
Last year
-7.5%
343,054
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dev Dependencies
5
asn1js
asn1js is a JavaScript generic ASN.1 parser/decoder that can decode any valid ASN.1 DER or BER structures.
An example page that can decode Base64-encoded (raw base64, PEM armoring and begin-base64
are recognized) or Hex-encoded (or local files with some browsers) is included and can be used both online on the official website or offline (ZIP file).
Usage with nodejs
This package can be installed with either npm or yarn via the following commands:
1npm install @lapo/asn1js 2# or other tools 3pnpm install @lapo/asn1js 4yarn add @lapo/asn1js
You can import the classes like this:
1import { ASN1 } from '@lapo/asn1js';
A submodule of this package can also be imported:
1import { Hex } from '@lapo/asn1js/hex.js';
If your code is still not using ES6 Modules (and is using CommonJS) you can require
it normally since NodeJS 22 (with parameter --experimental-require-module
):
1const 2 { ASN1 } = require('@lapo/asn1js'), 3 { Hex } = require('@lapo/asn1js/hex.js'); 4console.log(ASN1.decode(Hex.decode('06032B6570')).content());
On older NodeJS you instead need to use async import
:
1async function main() { 2 const 3 { ASN1 } = await import('@lapo/asn1js'), 4 { Hex } = await import('@lapo/asn1js/hex.js'); 5 console.log(ASN1.decode(Hex.decode('06032B6570')).content()); 6} 7main();
Usage on the web
Can be tested on JSFiddle.
1<script> 2import { ASN1 } from 'https://unpkg.com/@lapo/asn1js@2.0.0/asn1.js'; 3import { Hex } from 'https://unpkg.com/@lapo/asn1js@2.0.0/hex.js'; 4 5document.body.innerText = ASN1.decode(Hex.decode('06032B6570')).content(); 6</script>
Local usage
Since unfortunately ESM modules are not working on file:
protocol due to CORS issues, there is a bundled single-file version working locally. It doesn't work online (due to CSP restrictions about inline content) but can be saved locally and opened in a browser. (known bug: dark mode is currently broken in this mode)
Usage from CLI
You can dump an ASN.1 structure from the command line using the following command (no need to even install it):
1npx @lapo/asn1js ed25519.cer
ISC license
ASN.1 JavaScript decoder Copyright (c) 2008-2024 Lapo Luchini lapo@lapo.it
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
credits
- OBJECT IDENTIFIER values are recognized using data taken from Peter Gutmann's dumpasn1 program.
- BMPString support added by Felipe Gasper
- extended tag support added by Péter Budai
- patches by Gergely Nagy
- Relative OID support added by Mistial Developer
- dark mode and other UI improvements by Oliver Burgmaier
- patches by Nicolai Søborg
links
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: ISC License: LICENSE:0
Reason
0 existing vulnerabilities detected
Reason
4 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 3
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
- Warn: no pull requests merged into dev branch
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/node.js.yml:1
- Info: no jobLevel write permissions found
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.js.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/lapo-luchini/asn1js/node.js.yml/trunk?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.js.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/lapo-luchini/asn1js/node.js.yml/trunk?enable=pin
- Warn: npmCommand not pinned by hash: .github/workflows/node.js.yml:25
- Info: 0 out of 2 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 1 npmCommand dependencies pinned
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'trunk'
Score
3.7
/10
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More