Skip to content

Commit 572322f

Browse files
tniessencodebytere
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 1099524 commit 572322f

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
@@ -192,6 +192,7 @@ constexpr size_t kFsStatsBufferLength =
192192
V(commonjs_string, "commonjs") \
193193
V(config_string, "config") \
194194
V(constants_string, "constants") \
195+
V(crypto_dh_string, "dh") \
195196
V(crypto_dsa_string, "dsa") \
196197
V(crypto_ec_string, "ec") \
197198
V(crypto_ed25519_string, "ed25519") \

src/node_crypto.cc

+2
Original file line numberDiff line numberDiff line change
@@ -3903,6 +3903,8 @@ Local<Value> KeyObject::GetAsymmetricKeyType() const {
39033903
return env()->crypto_rsa_pss_string();
39043904
case EVP_PKEY_DSA:
39053905
return env()->crypto_dsa_string();
3906+
case EVP_PKEY_DH:
3907+
return env()->crypto_dh_string();
39063908
case EVP_PKEY_EC:
39073909
return env()->crypto_ec_string();
39083910
case EVP_PKEY_ED25519:

0 commit comments

Comments
 (0)