|
@@ -489,7 +489,7 @@ index af2146982c7a3bf7bd7527f44e4b17a3b605026e..f6b91f675cfea367c608892dee078b56
|
|
|
// Non-XOF hash functions should accept valid outputLength options as well.
|
|
|
assert.strictEqual(crypto.createHash('sha224', { outputLength: 28 })
|
|
|
diff --git a/test/parallel/test-crypto-key-objects.js b/test/parallel/test-crypto-key-objects.js
|
|
|
-index aa03a0379a291a4632b68d428d4e1875d60166a3..a6862ace1fa73473b406fe4513b9e7a99296d365 100644
|
|
|
+index c2c47a9ce72f124c78f2743cf88ccd96d714fa1b..fcdbad0262fa1dd8a7858f255d0e5e45a470f72a 100644
|
|
|
--- a/test/parallel/test-crypto-key-objects.js
|
|
|
+++ b/test/parallel/test-crypto-key-objects.js
|
|
|
@@ -307,11 +307,11 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem',
|
|
@@ -572,7 +572,7 @@ index aa03a0379a291a4632b68d428d4e1875d60166a3..a6862ace1fa73473b406fe4513b9e7a9
|
|
|
{
|
|
|
// Test RSA-PSS.
|
|
|
{
|
|
|
-@@ -715,7 +717,7 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem',
|
|
|
+@@ -767,7 +769,7 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem',
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -582,7 +582,7 @@ index aa03a0379a291a4632b68d428d4e1875d60166a3..a6862ace1fa73473b406fe4513b9e7a9
|
|
|
// Exporting an encrypted private key requires a cipher
|
|
|
const privateKey = createPrivateKey(privatePem);
|
|
|
diff --git a/test/parallel/test-crypto-keygen.js b/test/parallel/test-crypto-keygen.js
|
|
|
-index ed5986e6bfd4211a1cc22fa94aaf68fc1013133f..08986a6793a39b275277c8bf188316f669a53c63 100644
|
|
|
+index 09d43317426e712f60d4eba380cd4e044e3f3cf8..43c274b96fbb1c4d8398e2d32b625da21e85d6a6 100644
|
|
|
--- a/test/parallel/test-crypto-keygen.js
|
|
|
+++ b/test/parallel/test-crypto-keygen.js
|
|
|
@@ -297,6 +297,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
|
@@ -593,97 +593,116 @@ index ed5986e6bfd4211a1cc22fa94aaf68fc1013133f..08986a6793a39b275277c8bf188316f6
|
|
|
{
|
|
|
// Test RSA-PSS.
|
|
|
generateKeyPair('rsa-pss', {
|
|
|
-@@ -339,7 +340,9 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
|
|
+@@ -345,7 +346,9 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
|
|
testSignVerify(publicKey, privateKey);
|
|
|
}));
|
|
|
}
|
|
|
+*/
|
|
|
|
|
|
++/*
|
|
|
+ {
|
|
|
+ // 'rsa-pss' should not add a RSASSA-PSS-params sequence by default.
|
|
|
+ // Regression test for: https://github.com/nodejs/node/issues/39936
|
|
|
+@@ -368,7 +371,9 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
|
|
+ assert.strictEqual(spki[3], 11, spki.toString('hex'));
|
|
|
+ }));
|
|
|
+ }
|
|
|
++*/
|
|
|
+
|
|
|
+/*
|
|
|
{
|
|
|
const privateKeyEncoding = {
|
|
|
type: 'pkcs8',
|
|
|
-@@ -409,6 +412,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
|
|
+@@ -417,6 +422,9 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
|
|
});
|
|
|
}));
|
|
|
}
|
|
|
+*/
|
|
|
-
|
|
|
++
|
|
|
++/*
|
|
|
{
|
|
|
- // Test async elliptic curve key generation, e.g. for ECDSA, with a SEC1
|
|
|
-@@ -433,6 +437,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
|
|
- testSignVerify(publicKey, privateKey);
|
|
|
+ // Test async DSA key object generation.
|
|
|
+ generateKeyPair('dsa', {
|
|
|
+@@ -438,7 +446,9 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
|
|
+ });
|
|
|
}));
|
|
|
+ }
|
|
|
++*/
|
|
|
|
|
|
-+ /*
|
|
|
++/*
|
|
|
+ {
|
|
|
// Test async elliptic curve key generation, e.g. for ECDSA, with a SEC1
|
|
|
- // private key with paramEncoding explicit.
|
|
|
- generateKeyPair('ec', {
|
|
|
-@@ -454,6 +459,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
|
|
-
|
|
|
- testSignVerify(publicKey, privateKey);
|
|
|
- }));
|
|
|
-+ */
|
|
|
-
|
|
|
- // Do the same with an encrypted private key.
|
|
|
- generateKeyPair('ec', {
|
|
|
-@@ -489,6 +495,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
|
|
- testSignVerify(publicKey, { key: privateKey, passphrase: 'secret' });
|
|
|
- }));
|
|
|
-
|
|
|
-+ /*
|
|
|
- // Do the same with an encrypted private key with paramEncoding explicit.
|
|
|
- generateKeyPair('ec', {
|
|
|
- namedCurve: 'prime256v1',
|
|
|
-@@ -522,6 +529,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
|
|
-
|
|
|
+ // private key.
|
|
|
+@@ -552,8 +562,10 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
|
|
testSignVerify(publicKey, { key: privateKey, passphrase: 'secret' });
|
|
|
}));
|
|
|
-+ */
|
|
|
}
|
|
|
++*/
|
|
|
|
|
|
{
|
|
|
-@@ -562,6 +570,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
|
|
++ /*
|
|
|
+ // Test async elliptic curve key generation, e.g. for ECDSA, with an encrypted
|
|
|
+ // private key.
|
|
|
+ generateKeyPair('ec', {
|
|
|
+@@ -590,9 +602,11 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
|
|
+ passphrase: 'top secret'
|
|
|
});
|
|
|
}));
|
|
|
++ */
|
|
|
|
|
|
-+ /*
|
|
|
// Test async elliptic curve key generation, e.g. for ECDSA, with an encrypted
|
|
|
// private key with paramEncoding explicit.
|
|
|
++ /*
|
|
|
generateKeyPair('ec', {
|
|
|
-@@ -686,6 +695,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
+ namedCurve: 'P-256',
|
|
|
+ paramEncoding: 'explicit',
|
|
|
+@@ -627,15 +641,16 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
|
|
+ passphrase: 'top secret'
|
|
|
+ });
|
|
|
+ }));
|
|
|
+ */
|
|
|
- }
|
|
|
|
|
|
- // Test invalid parameter encoding.
|
|
|
-@@ -709,6 +719,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
|
|
+ // Test async elliptic curve key generation with 'jwk' encoding
|
|
|
+ [
|
|
|
+- ['ec', ['P-384', 'P-256', 'P-521', 'secp256k1']],
|
|
|
++ ['ec', ['P-384', 'P-256', 'P-521', /*'secp256k1'*/]],
|
|
|
+ ['rsa'],
|
|
|
+ ['ed25519'],
|
|
|
+- ['ed448'],
|
|
|
++ // ['ed448'],
|
|
|
+ ['x25519'],
|
|
|
+- ['x448'],
|
|
|
++ // ['x448'],
|
|
|
+ ].forEach((types) => {
|
|
|
+ const [type, options] = types;
|
|
|
+ switch (type) {
|
|
|
+@@ -738,6 +753,8 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
|
|
message: "The property 'options.paramEncoding' is invalid. " +
|
|
|
"Received 'otherEncoding'"
|
|
|
});
|
|
|
++
|
|
|
+ /*
|
|
|
assert.throws(() => generateKeyPairSync('dsa', {
|
|
|
modulusLength: 4096,
|
|
|
publicKeyEncoding: {
|
|
|
-@@ -722,6 +733,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
|
|
+@@ -751,6 +768,8 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
|
|
code: 'ERR_CRYPTO_JWK_UNSUPPORTED_KEY_TYPE',
|
|
|
message: 'Unsupported JWK Key Type.'
|
|
|
});
|
|
|
+ */
|
|
|
++
|
|
|
assert.throws(() => generateKeyPairSync('ec', {
|
|
|
namedCurve: 'secp224r1',
|
|
|
publicKeyEncoding: {
|
|
|
-@@ -1060,6 +1072,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
|
|
+@@ -1089,6 +1108,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-+ /*
|
|
|
++/*
|
|
|
// Test DSA parameters.
|
|
|
{
|
|
|
// Test invalid modulus lengths.
|
|
|
-@@ -1087,6 +1100,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
|
|
+@@ -1116,6 +1136,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
|
|
});
|
|
|
}
|
|
|
}
|
|
@@ -691,7 +710,7 @@ index ed5986e6bfd4211a1cc22fa94aaf68fc1013133f..08986a6793a39b275277c8bf188316f6
|
|
|
|
|
|
// Test EC parameters.
|
|
|
{
|
|
|
-@@ -1131,13 +1145,13 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
|
|
+@@ -1160,13 +1181,13 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
|
|
}));
|
|
|
|
|
|
generateKeyPair('ec', {
|
|
@@ -708,7 +727,7 @@ index ed5986e6bfd4211a1cc22fa94aaf68fc1013133f..08986a6793a39b275277c8bf188316f6
|
|
|
});
|
|
|
}));
|
|
|
}
|
|
|
-@@ -1145,7 +1159,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
|
|
+@@ -1174,7 +1195,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
|
|
// Test EdDSA key generation.
|
|
|
{
|
|
|
if (!/^1\.1\.0/.test(process.versions.openssl)) {
|
|
@@ -717,7 +736,7 @@ index ed5986e6bfd4211a1cc22fa94aaf68fc1013133f..08986a6793a39b275277c8bf188316f6
|
|
|
generateKeyPair(keyType, common.mustSucceed((publicKey, privateKey) => {
|
|
|
assert.strictEqual(publicKey.type, 'public');
|
|
|
assert.strictEqual(publicKey.asymmetricKeyType, keyType);
|
|
|
-@@ -1159,6 +1173,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
|
|
+@@ -1188,6 +1209,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -725,7 +744,7 @@ index ed5986e6bfd4211a1cc22fa94aaf68fc1013133f..08986a6793a39b275277c8bf188316f6
|
|
|
// Test classic Diffie-Hellman key generation.
|
|
|
{
|
|
|
generateKeyPair('dh', {
|
|
|
-@@ -1271,6 +1286,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
|
|
+@@ -1300,6 +1322,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
|
|
});
|
|
|
}
|
|
|
}
|
|
@@ -733,7 +752,7 @@ index ed5986e6bfd4211a1cc22fa94aaf68fc1013133f..08986a6793a39b275277c8bf188316f6
|
|
|
|
|
|
// Test invalid key encoding types.
|
|
|
{
|
|
|
-@@ -1471,6 +1487,7 @@ if (!common.hasOpenSSL3) {
|
|
|
+@@ -1500,6 +1523,7 @@ if (!common.hasOpenSSL3) {
|
|
|
}, common.mustSucceed((publicKey, privateKey) => {
|
|
|
assert.strictEqual(publicKey.type, 'public');
|
|
|
|
|
@@ -741,7 +760,7 @@ index ed5986e6bfd4211a1cc22fa94aaf68fc1013133f..08986a6793a39b275277c8bf188316f6
|
|
|
for (const passphrase of ['', Buffer.alloc(0)]) {
|
|
|
const privateKeyObject = createPrivateKey({
|
|
|
passphrase,
|
|
|
-@@ -1478,6 +1495,7 @@ if (!common.hasOpenSSL3) {
|
|
|
+@@ -1507,6 +1531,7 @@ if (!common.hasOpenSSL3) {
|
|
|
});
|
|
|
assert.strictEqual(privateKeyObject.asymmetricKeyType, 'rsa');
|
|
|
}
|
|
@@ -851,7 +870,7 @@ index 9afcb38616dafd6da1ab7b5843d68f4f796ca9a6..00d3381056a5a40c549f06d74c130149
|
|
|
}
|
|
|
+*/
|
|
|
diff --git a/test/parallel/test-crypto-sign-verify.js b/test/parallel/test-crypto-sign-verify.js
|
|
|
-index 444135538ccff8a705806941843717be954ed143..fe07bbbf0b18ae4ff344cb972600d5ee3bd8ede3 100644
|
|
|
+index 6893f0c0e6d49a8e171ec9f156f74656dab9fd06..4c8ccd10e0dcd64669cccca1e8c2e5279d683595 100644
|
|
|
--- a/test/parallel/test-crypto-sign-verify.js
|
|
|
+++ b/test/parallel/test-crypto-sign-verify.js
|
|
|
@@ -29,6 +29,7 @@ const keySize = 2048;
|
|
@@ -1220,6 +1239,23 @@ index 151eebd36c9765df086a020ba42920b2442b1b77..efe97ff2499cba909ac5500d827364fa
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+diff --git a/test/parallel/test-webcrypto-export-import-rsa.js b/test/parallel/test-webcrypto-export-import-rsa.js
|
|
|
+index 04cf6388fc739d3eab0a8d47857590c7a9b84342..d111e697db652b98dd8a9eb7869b1a98ba6bca79 100644
|
|
|
+--- a/test/parallel/test-webcrypto-export-import-rsa.js
|
|
|
++++ b/test/parallel/test-webcrypto-export-import-rsa.js
|
|
|
+@@ -480,6 +480,7 @@ const testVectors = [
|
|
|
+ await Promise.all(variations);
|
|
|
+ })().then(common.mustCall());
|
|
|
+
|
|
|
++/*
|
|
|
+ {
|
|
|
+ const publicPem = fixtures.readKey('rsa_pss_public_2048.pem', 'ascii');
|
|
|
+ const privatePem = fixtures.readKey('rsa_pss_private_2048.pem', 'ascii');
|
|
|
+@@ -521,3 +522,4 @@ const testVectors = [
|
|
|
+ assert.strictEqual(jwk.alg, 'PS256');
|
|
|
+ })().then(common.mustCall());
|
|
|
+ }
|
|
|
++*/
|
|
|
diff --git a/test/parallel/test-webcrypto-wrap-unwrap.js b/test/parallel/test-webcrypto-wrap-unwrap.js
|
|
|
index 1094845c73e14313860ad476fb7baba2a11b5af4..51972b4b34b191ac59145889dbf2da5c0d407dbe 100644
|
|
|
--- a/test/parallel/test-webcrypto-wrap-unwrap.js
|