From 9aa463d3d2884c746a21169d6d8e710828600309 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Fri, 23 Nov 2018 14:24:21 -0700 Subject: [PATCH] move use of node Buffer to encoding.js --- lib/asn1.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/asn1.js b/lib/asn1.js index 0200a01..fe0ee94 100644 --- a/lib/asn1.js +++ b/lib/asn1.js @@ -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) {