diff --git a/lib/orders/H004/response.js b/lib/orders/H004/response.js index 66239df..eddaa3b 100644 --- a/lib/orders/H004/response.js +++ b/lib/orders/H004/response.js @@ -126,8 +126,9 @@ module.exports = (xml, keys) => ({ const type = lastChild(keyNodes[i].parentNode).textContent; const modulus = xpath.select(".//*[local-name(.)='Modulus']", keyNodes[i])[0].textContent; const exponent = xpath.select(".//*[local-name(.)='Exponent']", keyNodes[i])[0].textContent; + const modulusBuffer = Buffer.from(modulus, 'base64'); - const mod = new BN(Buffer.from(modulus, 'base64'), 2).toBuffer(); + const mod = new BN(Buffer.from(modulus, 'base64'), 2).toBuffer('be', modulusBuffer.length); const exp = new BN(Buffer.from(exponent, 'base64')).toNumber(); bankKeys[`bank${type}`] = { mod, exp };