move use of node Buffer to encoding.js

This commit is contained in:
AJ ONeal 2018-11-23 14:24:21 -07:00
parent ec826aa906
commit 9aa463d3d2

View file

@ -136,7 +136,7 @@ ASN1._stringify = function(asn1) {
var ws = '';
function write(asn1) {
console.log(ws, 'ch', Buffer.from([asn1.type]).toString('hex'), asn1.length);
console.log(ws, 'ch', Enc.numToHex(asn1.type), asn1.length);
if (!asn1.children) {
return;
}
@ -176,7 +176,7 @@ ASN1.tpl = function (asn1) {
if (!asn1.children) {
if (0x05 !== asn1.type) {
if (0x06 !== asn1.type) {
val = Buffer.from(asn1.value || '');
val = asn1.value || new Uint8Array(0);
vars.push("// 0x" + Enc.numToHex(val.byteLength) + " (" + val.byteLength + " bytes)\nopts.tpl" + i + " = '"
+ Enc.bufToHex(val) + "';");
if (0x02 !== asn1.type && 0x03 !== asn1.type) {