mirror of
https://github.com/node-ebics/node-ebics-client.git
synced 2024-11-24 23:22:06 +00:00
fix: modulus zero byte handling
This commit is contained in:
parent
1320f6f21d
commit
1c1f112ff5
@ -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 };
|
||||
|
Loading…
Reference in New Issue
Block a user