Skip to content

Commit 9f85585

Browse files
tniessentargos
authored andcommitted
crypto: add key type 'dh'
The new key type 'dh' corresponds to EVP_PKEY_DH. PR-URL: #31178 Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
1 parent 784fb8f commit 9f85585

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

doc/api/crypto.md

+4
Original file line numberDiff line numberDiff line change
@@ -1232,6 +1232,9 @@ passing keys as strings or `Buffer`s due to improved security features.
12321232
<!-- YAML
12331233
added: v11.6.0
12341234
changes:
1235+
- version: REPLACEME
1236+
pr-url: https://github.com/nodejs/node/pull/31178
1237+
description: Added support for `'dh'`.
12351238
- version: v12.0.0
12361239
pr-url: https://github.com/nodejs/node/pull/26960
12371240
description: Added support for `'rsa-pss'`
@@ -1260,6 +1263,7 @@ types are:
12601263
* `'x448'` (OID 1.3.101.111)
12611264
* `'ed25519'` (OID 1.3.101.112)
12621265
* `'ed448'` (OID 1.3.101.113)
1266+
* `'dh'` (OID 1.2.840.113549.1.3.1)
12631267

12641268
This property is `undefined` for unrecognized `KeyObject` types and symmetric
12651269
keys.

src/env.h

+1
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ constexpr size_t kFsStatsBufferLength =
194194
V(commonjs_string, "commonjs") \
195195
V(config_string, "config") \
196196
V(constants_string, "constants") \
197+
V(crypto_dh_string, "dh") \
197198
V(crypto_dsa_string, "dsa") \
198199
V(crypto_ec_string, "ec") \
199200
V(crypto_ed25519_string, "ed25519") \

src/node_crypto.cc

+2
Original file line numberDiff line numberDiff line change
@@ -3326,6 +3326,8 @@ Local<Value> KeyObject::GetAsymmetricKeyType() const {
33263326
return env()->crypto_rsa_pss_string();
33273327
case EVP_PKEY_DSA:
33283328
return env()->crypto_dsa_string();
3329+
case EVP_PKEY_DH:
3330+
return env()->crypto_dh_string();
33293331
case EVP_PKEY_EC:
33303332
return env()->crypto_ec_string();
33313333
case EVP_PKEY_ED25519:

0 commit comments

Comments
 (0)