better temple output

This commit is contained in:
AJ ONeal 2018-11-22 22:53:10 -07:00
parent abce2cc95b
commit 70ba729899

View file

@ -163,23 +163,27 @@ ASN1.tpl = function (asn1) {
var val;
if ('number' !== typeof k) {
// ignore
} else if (k) {
str += ', ';
} else {
str += ' ';
str += ', ';
}
if (0x02 === asn1.type) {
str += "ASN1.UInt(";
} else if (0x03 === asn1.type) {
str += "ASN1.BitStr(";
} else {
str += "ASN1('" + Enc.numToHex(asn1.type) + "', ";
str += "ASN1('" + Enc.numToHex(asn1.type) + "'";
}
if (!asn1.children) {
if (0x05 !== asn1.type) {
val = Buffer.from(asn1.value || '');
vars.push("// 0x" + Enc.numToHex(val.byteLength) + " (" + val.byteLength + " bytes)\nvar tpl" + i + " = '"
+ Enc.bufToHex(val) + "';");
str += "tpl" + i + ")";
if (0x02 !== asn1.type && 0x03 !== asn1.type) {
str += ", ";
}
str += "tpl" + i;
}
str += ")";
return ;
}
asn1.children.forEach(function (a, j) {