add length in hex to tpl comment
This commit is contained in:
parent
d69cde1a40
commit
abce2cc95b
1 changed files with 4 additions and 4 deletions
|
@ -95,7 +95,7 @@ ASN1.parse = function parseAsn1(buf, depth) {
|
||||||
if (0x80 & asn1.length) {
|
if (0x80 & asn1.length) {
|
||||||
asn1.lengthSize = 0x7f & asn1.length;
|
asn1.lengthSize = 0x7f & asn1.length;
|
||||||
// I think that buf->hex->int solves the problem of Endianness... not sure
|
// 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;
|
index += asn1.lengthSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,12 +173,12 @@ ASN1.tpl = function (asn1) {
|
||||||
} else if (0x03 === asn1.type) {
|
} else if (0x03 === asn1.type) {
|
||||||
str += "ASN1.BitStr(";
|
str += "ASN1.BitStr(";
|
||||||
} else {
|
} else {
|
||||||
str += "ASN1('" + Buffer.from([asn1.type]).toString('hex') + "', ";
|
str += "ASN1('" + Enc.numToHex(asn1.type) + "', ";
|
||||||
}
|
}
|
||||||
if (!asn1.children) {
|
if (!asn1.children) {
|
||||||
val = Buffer.from(asn1.value || '');
|
val = Buffer.from(asn1.value || '');
|
||||||
vars.push("// " + val.byteLength + " bytes\nvar tpl" + i + " = '"
|
vars.push("// 0x" + Enc.numToHex(val.byteLength) + " (" + val.byteLength + " bytes)\nvar tpl" + i + " = '"
|
||||||
+ val.toString('hex') + "';");
|
+ Enc.bufToHex(val) + "';");
|
||||||
str += "tpl" + i + ")";
|
str += "tpl" + i + ")";
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue