Skip to content

Commit

Permalink
crypto: add key type 'dh'
Browse files Browse the repository at this point in the history
The new key type 'dh' corresponds to EVP_PKEY_DH.

PR-URL: nodejs#31178
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
  • Loading branch information
tniessen authored and targos committed Apr 25, 2020
1 parent 0dd19c5 commit 0f4946e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions doc/api/crypto.md
Original file line number Diff line number Diff line change
Expand Up @@ -1232,6 +1232,9 @@ passing keys as strings or `Buffer`s due to improved security features.
<!-- YAML
added: v11.6.0
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/31178
description: Added support for `'dh'`.
- version: v12.0.0
pr-url: https://github.com/nodejs/node/pull/26960
description: Added support for `'rsa-pss'`
Expand Down Expand Up @@ -1260,6 +1263,7 @@ types are:
* `'x448'` (OID 1.3.101.111)
* `'ed25519'` (OID 1.3.101.112)
* `'ed448'` (OID 1.3.101.113)
* `'dh'` (OID 1.2.840.113549.1.3.1)

This property is `undefined` for unrecognized `KeyObject` types and symmetric
keys.
Expand Down
1 change: 1 addition & 0 deletions src/env.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ constexpr size_t kFsStatsBufferLength =
V(commonjs_string, "commonjs") \
V(config_string, "config") \
V(constants_string, "constants") \
V(crypto_dh_string, "dh") \
V(crypto_dsa_string, "dsa") \
V(crypto_ec_string, "ec") \
V(crypto_ed25519_string, "ed25519") \
Expand Down
2 changes: 2 additions & 0 deletions src/node_crypto.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3326,6 +3326,8 @@ Local<Value> KeyObject::GetAsymmetricKeyType() const {
return env()->crypto_rsa_pss_string();
case EVP_PKEY_DSA:
return env()->crypto_dsa_string();
case EVP_PKEY_DH:
return env()->crypto_dh_string();
case EVP_PKEY_EC:
return env()->crypto_ec_string();
case EVP_PKEY_ED25519:
Expand Down

0 comments on commit 0f4946e

Please sign in to comment.