Browse Source

cleanup

master
AJ ONeal 5 years ago
parent
commit
41312c53ac
  1. 3
      lib/uasn1.js

3
lib/uasn1.js

@ -23,13 +23,11 @@ ASN1.parse = function parseAsn1(buf, depth) {
asn1.lengthSize = 0x7f & asn1.length;
// I think that buf->hex->int solves the problem of Endianness... not sure
asn1.length = parseInt(buf.slice(index, index + asn1.lengthSize).toString('hex'), 16);
//index += 1; // add back the original byte indicating lengthSize
index += asn1.lengthSize;
}
// this is a primitive value type
if (-1 !== VTYPES.indexOf(asn1.type)) {
//console.log('t', asn1.type);
asn1.value = buf.slice(index, index + asn1.length);
return asn1;
}
@ -39,7 +37,6 @@ ASN1.parse = function parseAsn1(buf, depth) {
iters += 1;
child = ASN1.parse(buf.slice(index, index + asn1.length), (depth || 0) + 1);
index += (2 + child.lengthSize + child.length);
//console.log('buflen', buf.byteLength, 'index', index);
asn1.children.push(child);
}
if (iters >= 100) { throw new Error(ELOOP); }

Loading…
Cancel
Save