|
|
@ -95,7 +95,7 @@ ASN1.parse = function parseAsn1(buf, depth) { |
|
|
|
if (0x80 & asn1.length) { |
|
|
|
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); |
|
|
|
asn1.length = parseInt(Enc.bufToHex(buf.slice(index, index + asn1.lengthSize)), 16); |
|
|
|
index += asn1.lengthSize; |
|
|
|
} |
|
|
|
|
|
|
@ -173,12 +173,12 @@ ASN1.tpl = function (asn1) { |
|
|
|
} else if (0x03 === asn1.type) { |
|
|
|
str += "ASN1.BitStr("; |
|
|
|
} else { |
|
|
|
str += "ASN1('" + Buffer.from([asn1.type]).toString('hex') + "', "; |
|
|
|
str += "ASN1('" + Enc.numToHex(asn1.type) + "', "; |
|
|
|
} |
|
|
|
if (!asn1.children) { |
|
|
|
val = Buffer.from(asn1.value || ''); |
|
|
|
vars.push("// " + val.byteLength + " bytes\nvar tpl" + i + " = '" |
|
|
|
+ val.toString('hex') + "';"); |
|
|
|
vars.push("// 0x" + Enc.numToHex(val.byteLength) + " (" + val.byteLength + " bytes)\nvar tpl" + i + " = '" |
|
|
|
+ Enc.bufToHex(val) + "';"); |
|
|
|
str += "tpl" + i + ")"; |
|
|
|
return ; |
|
|
|
} |
|
|
|