summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/internal/crypto/keys.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/internal/crypto/keys.js b/lib/internal/crypto/keys.js
index fb17ba36ce..250147d752 100644
--- a/lib/internal/crypto/keys.js
+++ b/lib/internal/crypto/keys.js
@@ -270,7 +270,10 @@ function prepareAsymmetricKey(key, ctx) {
...(ctx !== kCreatePrivate ? ['KeyObject'] : [])],
key);
}
- return { data, ...parseKeyEncoding(key, undefined) };
+
+ const isPublic =
+ (ctx === kConsumePrivate || ctx === kCreatePrivate) ? false : undefined;
+ return { data, ...parseKeyEncoding(key, undefined, isPublic) };
} else {
throw new ERR_INVALID_ARG_TYPE(
'key',