|
|
@ -29,6 +29,7 @@ ASN1.parse = function parseAsn1(buf, depth) { |
|
|
|
|
|
|
|
// 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; |
|
|
|
} |
|
|
@ -36,8 +37,9 @@ ASN1.parse = function parseAsn1(buf, depth) { |
|
|
|
asn1.children = []; |
|
|
|
while (iters < 100 && index < buf.byteLength) { |
|
|
|
iters += 1; |
|
|
|
child = ASN1.parse(buf.slice(index), (depth || 0) + 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); } |
|
|
|