diff --git a/lib/keymanagers/Key.js b/lib/keymanagers/Key.js index 1f17e78..9a7f90b 100644 --- a/lib/keymanagers/Key.js +++ b/lib/keymanagers/Key.js @@ -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() {