wip: migrate to node-forge

This commit is contained in:
Vladislav Hristov
2019-10-31 18:57:42 +02:00
parent 1c1f112ff5
commit 4149c01695
7 changed files with 384 additions and 38 deletions

View File

@@ -126,12 +126,15 @@ 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('be', modulusBuffer.length);
const exp = new BN(Buffer.from(exponent, 'base64')).toNumber();
bankKeys[`bank${type}`] = { mod, exp };
const mod = Buffer.from(modulus, 'base64');
const exp = Buffer.from(exponent, 'base64');
bankKeys[`bank${type}`] = {
mod,
exp,
modulus,
exponent,
};
}
return bankKeys;