diff --git a/doc/api/crypto.md b/doc/api/crypto.md index df424b8abf9126..001d550a24951b 100644 --- a/doc/api/crypto.md +++ b/doc/api/crypto.md @@ -1908,14 +1908,20 @@ const { ### `keyObject.asymmetricKeyDetails` * {Object} - * `modulusLength`: {number} Key size in bits (RSA, DSA). - * `publicExponent`: {bigint} Public exponent (RSA). + * `modulusLength`: {number} Key size in bits (RSA, RSA-PSS, DSA). + * `publicExponent`: {bigint} Public exponent (RSA, RSA-PSS). * `hashAlgorithm`: {string} Name of the message digest (RSA-PSS). - * `mgf1Hash`: {string} Name of the message digest used by MGF1 (RSA-PSS). - * `saltLength`: {number} Salt length in bytes (RSA-PSS). + * `mgf1HashAlgorithm`: {string} Name of the message digest used by + MGF1 (RSA-PSS). + * `saltLength`: {number} Minimal salt length in bytes (RSA-PSS). * `divisorLength`: {number} Size of `q` in bits (DSA). * `namedCurve`: {string} Name of the curve (EC). @@ -1925,7 +1931,8 @@ through this property can be used to uniquely identify a key or to compromise the security of the key. For RSA-PSS keys, if the key material contains a `RSASSA-PSS-params` sequence, -the `hashAlgorithm`, `mgf1Hash`, and `saltLength` properties will be set. +the `hashAlgorithm`, `mgf1HashAlgorithm`, and `saltLength` properties will be +set. Other key details might be exposed via this API using additional attributes. diff --git a/src/crypto/crypto_rsa.cc b/src/crypto/crypto_rsa.cc index 803e068cc77f7b..1bbf9a1753e4e2 100644 --- a/src/crypto/crypto_rsa.cc +++ b/src/crypto/crypto_rsa.cc @@ -599,7 +599,7 @@ Maybe GetRsaKeyDetail( if (target ->Set( env->context(), - env->mgf1_hash_string(), + env->mgf1_hash_algorithm_string(), OneByteString(env->isolate(), OBJ_nid2ln(mgf1_hash_nid))) .IsNothing()) { return Nothing(); diff --git a/src/env.h b/src/env.h index 7c108f74fb994e..4fd5be8e15029b 100644 --- a/src/env.h +++ b/src/env.h @@ -317,7 +317,7 @@ constexpr size_t kFsStatsBufferLength = V(message_port_string, "messagePort") \ V(message_string, "message") \ V(messageerror_string, "messageerror") \ - V(mgf1_hash_string, "mgf1Hash") \ + V(mgf1_hash_algorithm_string, "mgf1HashAlgorithm") \ V(minttl_string, "minttl") \ V(module_string, "module") \ V(modulus_string, "modulus") \ diff --git a/test/parallel/test-crypto-key-objects.js b/test/parallel/test-crypto-key-objects.js index 427f87c0bcd27b..c2c47a9ce72f12 100644 --- a/test/parallel/test-crypto-key-objects.js +++ b/test/parallel/test-crypto-key-objects.js @@ -652,7 +652,7 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem', modulusLength: 2048, publicExponent: 65537n, hashAlgorithm: 'sha1', - mgf1Hash: 'sha1', + mgf1HashAlgorithm: 'sha1', saltLength: 20 }; @@ -727,7 +727,7 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem', modulusLength: 2048, publicExponent: 65537n, hashAlgorithm: 'sha512', - mgf1Hash: 'sha256', + mgf1HashAlgorithm: 'sha256', saltLength: 20 };