mirror of
https://github.com/node-ebics/node-ebics-client.git
synced 2024-11-22 06:02:09 +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 key = this.keyIsPublic ? this.publicKey : this.privateKey;
|
||||||
const eKey = Buffer.from(key.e.toByteArray());
|
const eKey = Buffer.from(key.e.toByteArray());
|
||||||
|
|
||||||
return to === 'hex'
|
return to === 'hex' ? eKey.toString('hex') : eKey;
|
||||||
? eKey.toString('hex')
|
|
||||||
: eKey;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
d() {
|
d() {
|
||||||
@ -128,7 +126,10 @@ module.exports = class Key {
|
|||||||
|
|
||||||
// eslint-disable-next-line class-methods-use-this
|
// eslint-disable-next-line class-methods-use-this
|
||||||
size() {
|
size() {
|
||||||
return 2048;
|
const keyN = this.n('hex');
|
||||||
|
const bn = new BigInteger(keyN, 16);
|
||||||
|
|
||||||
|
return bn.bitLength();
|
||||||
}
|
}
|
||||||
|
|
||||||
toPem() {
|
toPem() {
|
||||||
|
Loading…
Reference in New Issue
Block a user