Skip to content

Commit 9319f2f

Browse files
committed
fixup! crypto: add RSA-PSS params to asymmetricKeyDetails
1 parent 98d2e56 commit 9319f2f

File tree

4 files changed

+16
-9
lines changed

4 files changed

+16
-9
lines changed

doc/api/crypto.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1908,14 +1908,20 @@ const {
19081908
### `keyObject.asymmetricKeyDetails`
19091909
<!-- YAML
19101910
added: v15.7.0
1911+
changes:
1912+
- version: REPLACEME
1913+
pr-url: https://github.com/nodejs/node/pull/39851
1914+
description: Expose `RSASSA-PSS-params` sequence parameters
1915+
for RSA-PSS keys.
19111916
-->
19121917

19131918
* {Object}
1914-
* `modulusLength`: {number} Key size in bits (RSA, DSA).
1915-
* `publicExponent`: {bigint} Public exponent (RSA).
1919+
* `modulusLength`: {number} Key size in bits (RSA, RSA-PSS, DSA).
1920+
* `publicExponent`: {bigint} Public exponent (RSA, RSA-PSS).
19161921
* `hashAlgorithm`: {string} Name of the message digest (RSA-PSS).
1917-
* `mgf1Hash`: {string} Name of the message digest used by MGF1 (RSA-PSS).
1918-
* `saltLength`: {number} Salt length in bytes (RSA-PSS).
1922+
* `mgf1HashAlgorithm`: {string} Name of the message digest used by
1923+
MGF1 (RSA-PSS).
1924+
* `saltLength`: {number} Minimal salt length in bytes (RSA-PSS).
19191925
* `divisorLength`: {number} Size of `q` in bits (DSA).
19201926
* `namedCurve`: {string} Name of the curve (EC).
19211927

@@ -1925,7 +1931,8 @@ through this property can be used to uniquely identify a key or to compromise
19251931
the security of the key.
19261932

19271933
For RSA-PSS keys, if the key material contains a `RSASSA-PSS-params` sequence,
1928-
the `hashAlgorithm`, `mgf1Hash`, and `saltLength` properties will be set.
1934+
the `hashAlgorithm`, `mgf1HashAlgorithm`, and `saltLength` properties will be
1935+
set.
19291936

19301937
Other key details might be exposed via this API using additional attributes.
19311938

src/crypto/crypto_rsa.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ Maybe<bool> GetRsaKeyDetail(
599599
if (target
600600
->Set(
601601
env->context(),
602-
env->mgf1_hash_string(),
602+
env->mgf1_hash_algorithm_string(),
603603
OneByteString(env->isolate(), OBJ_nid2ln(mgf1_hash_nid)))
604604
.IsNothing()) {
605605
return Nothing<bool>();

src/env.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ constexpr size_t kFsStatsBufferLength =
317317
V(message_port_string, "messagePort") \
318318
V(message_string, "message") \
319319
V(messageerror_string, "messageerror") \
320-
V(mgf1_hash_string, "mgf1Hash") \
320+
V(mgf1_hash_algorithm_string, "mgf1HashAlgorithm") \
321321
V(minttl_string, "minttl") \
322322
V(module_string, "module") \
323323
V(modulus_string, "modulus") \

test/parallel/test-crypto-key-objects.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,7 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem',
652652
modulusLength: 2048,
653653
publicExponent: 65537n,
654654
hashAlgorithm: 'sha1',
655-
mgf1Hash: 'sha1',
655+
mgf1HashAlgorithm: 'sha1',
656656
saltLength: 20
657657
};
658658

@@ -727,7 +727,7 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem',
727727
modulusLength: 2048,
728728
publicExponent: 65537n,
729729
hashAlgorithm: 'sha512',
730-
mgf1Hash: 'sha256',
730+
mgf1HashAlgorithm: 'sha256',
731731
saltLength: 20
732732
};
733733

0 commit comments

Comments
 (0)