@lapo/asn1js
Advanced tools
Comparing version 1.2.1 to 1.2.3
17
asn1.js
// ASN.1 JavaScript decoder | ||
// Copyright (c) 2008-2020 Lapo Luchini <lapo@lapo.it> | ||
// Copyright (c) 2008-2021 Lapo Luchini <lapo@lapo.it> | ||
@@ -330,8 +330,11 @@ // Permission to use, copy, modify, and/or distribute this software for any | ||
function recurse(el, parser, maxLength) { | ||
var differentTags = false; | ||
if (el.sub) el.sub.forEach(function (e1) { | ||
if (e1.tag.tagClass != el.tag.tagClass || e1.tag.tagNumber != el.tag.tagNumber) | ||
differentTags = true; | ||
}); | ||
if (!el.sub || differentTags) | ||
var avoidRecurse = true; | ||
if (el.tag.tagConstructed && el.sub) { | ||
avoidRecurse = false; | ||
el.sub.forEach(function (e1) { | ||
if (e1.tag.tagClass != el.tag.tagClass || e1.tag.tagNumber != el.tag.tagNumber) | ||
avoidRecurse = true; | ||
}); | ||
} | ||
if (avoidRecurse) | ||
return el.stream[parser](el.posContent(), el.posContent() + Math.abs(el.length), maxLength); | ||
@@ -338,0 +341,0 @@ var d = { size: 0, str: '' }; |
// Base64 JavaScript decoder | ||
// Copyright (c) 2008-2020 Lapo Luchini <lapo@lapo.it> | ||
// Copyright (c) 2008-2021 Lapo Luchini <lapo@lapo.it> | ||
@@ -89,3 +89,3 @@ // Permission to use, copy, modify, and/or distribute this software for any | ||
Base64.re = /-----BEGIN [^-]+-----([A-Za-z0-9+/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+/=\s]+)====/; | ||
Base64.re = /-----BEGIN [^-]+-----([A-Za-z0-9+/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+/=\s]+)====|^([A-Za-z0-9+/=\s]+)$/; | ||
Base64.unarmor = function (a) { | ||
@@ -98,2 +98,4 @@ var m = Base64.re.exec(a); | ||
a = m[2]; | ||
else if (m[3]) | ||
a = m[3]; | ||
else | ||
@@ -100,0 +102,0 @@ throw "RegExp out of sync"; |
// Hex JavaScript decoder | ||
// Copyright (c) 2008-2020 Lapo Luchini <lapo@lapo.it> | ||
// Copyright (c) 2008-2021 Lapo Luchini <lapo@lapo.it> | ||
@@ -4,0 +4,0 @@ // Permission to use, copy, modify, and/or distribute this software for any |
// Big integer base-10 printing library | ||
// Copyright (c) 2008-2020 Lapo Luchini <lapo@lapo.it> | ||
// Copyright (c) 2008-2021 Lapo Luchini <lapo@lapo.it> | ||
@@ -4,0 +4,0 @@ // Permission to use, copy, modify, and/or distribute this software for any |
{ | ||
"name": "@lapo/asn1js", | ||
"version": "1.2.1", | ||
"version": "1.2.3", | ||
"description": "Generic ASN.1 parser/decoder that can decode any valid ASN.1 DER or BER structures.", | ||
@@ -17,3 +17,3 @@ "main": "asn1.js", | ||
"scripts" : { | ||
"lint" : "npx eslint *.js", | ||
"lint" : "npx eslint asn1.js base64.js hex.js int10.js oids.js", | ||
"test" : "node test" | ||
@@ -20,0 +20,0 @@ }, |
@@ -35,2 +35,19 @@ asn1js | ||
Usage with RequireJS | ||
-------------------- | ||
Can be [tested on JSFiddle](https://jsfiddle.net/lapo/tmdq35ug/). | ||
```html | ||
<script type="text/javascript" src="https://unpkg.com/requirejs/require.js"></script> | ||
<script> | ||
require([ | ||
'https://unpkg.com/@lapo/asn1js/asn1.js', | ||
'https://unpkg.com/@lapo/asn1js/hex.js' | ||
], function(ASN1, Hex) { | ||
document.body.innerText = ASN1.decode(Hex.decode('06032B6570')).content(); | ||
}); | ||
</script> | ||
``` | ||
ISC license | ||
@@ -37,0 +54,0 @@ ----------- |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
247989
3363
76