From 4895927a0a4372e0699f84657e0a299393a3d281 Mon Sep 17 00:00:00 2001 From: Patrick Gansterer Date: Sat, 2 Mar 2019 01:34:11 +0100 Subject: [PATCH] crypto: add KeyObject.asymmetricKeySize Expose the size of asymetric keys of crypto key object from the crypto module added in v11.6.0. PR-URL: https://github.com/nodejs/node/pull/26387 Refs: https://github.com/nodejs/node/pull/24234 Reviewed-By: Ben Noordhuis Reviewed-By: James M Snell Reviewed-By: Ruben Bridgewater --- doc/api/crypto.md | 9 +++++++++ lib/internal/crypto/keys.js | 6 ++++++ src/node_crypto.cc | 13 +++++++++++++ src/node_crypto.h | 4 ++++ test/parallel/test-crypto-key-objects.js | 3 +++ test/parallel/test-crypto-keygen.js | 4 ++++ 6 files changed, 39 insertions(+) diff --git a/doc/api/crypto.md b/doc/api/crypto.md index 328d7daac1f6f3..f10764c9e4b9b2 100644 --- a/doc/api/crypto.md +++ b/doc/api/crypto.md @@ -1121,6 +1121,15 @@ exposes different functions. Most applications should consider using the new `KeyObject` API instead of passing keys as strings or `Buffer`s due to improved security features. +### keyObject.asymmetricKeySize + +* {number} + +For asymmetric keys, this property represents the size of the embedded key in +bytes. This property is `undefined` for symmetric keys. + ### keyObject.asymmetricKeyType