mirror of
https://github.com/node-ebics/node-ebics-client.git
synced 2024-11-24 23:22:06 +00:00
fit: key size is now calculated instead of hardcoded
This commit is contained in:
parent
ce6cd02e58
commit
e8a80932e1
@ -106,9 +106,7 @@ module.exports = class Key {
|
||||
const key = this.keyIsPublic ? this.publicKey : this.privateKey;
|
||||
const eKey = Buffer.from(key.e.toByteArray());
|
||||
|
||||
return to === 'hex'
|
||||
? eKey.toString('hex')
|
||||
: eKey;
|
||||
return to === 'hex' ? eKey.toString('hex') : eKey;
|
||||
}
|
||||
|
||||
d() {
|
||||
@ -128,7 +126,10 @@ module.exports = class Key {
|
||||
|
||||
// eslint-disable-next-line class-methods-use-this
|
||||
size() {
|
||||
return 2048;
|
||||
const keyN = this.n('hex');
|
||||
const bn = new BigInteger(keyN, 16);
|
||||
|
||||
return bn.bitLength();
|
||||
}
|
||||
|
||||
toPem() {
|
||||
|
Loading…
Reference in New Issue
Block a user