|
@@ -508,306 +508,6 @@ 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 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',
|
|
|
- }, common.hasOpenSSL3 ? {
|
|
|
- message: 'error:1E08010C:DECODER routines::unsupported',
|
|
|
- } : {
|
|
|
-- message: 'error:0909006C:PEM routines:get_name:no start line',
|
|
|
-- code: 'ERR_OSSL_PEM_NO_START_LINE',
|
|
|
-- reason: 'no start line',
|
|
|
-- library: 'PEM routines',
|
|
|
-- function: 'get_name',
|
|
|
-+ message: /error:2007E073:BIO routines:BIO_new_mem_buf:null parameter|error:0900006e:PEM routines:OPENSSL_internal:NO_START_LINE/,
|
|
|
-+ code: /ERR_OSSL_BIO_NULL_PARAMETER|ERR_OSSL_PEM_NO_START_LINE/,
|
|
|
-+ reason: /null parameter|NO_START_LINE/,
|
|
|
-+ library: /BIO routines|PEM routines/,
|
|
|
-+ function: /BIO_new_mem_buf|OPENSSL_internal/,
|
|
|
- });
|
|
|
-
|
|
|
- // This should not abort either: https://github.com/nodejs/node/issues/29904
|
|
|
-@@ -334,8 +334,8 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem',
|
|
|
- message: /error:1E08010C:DECODER routines::unsupported/,
|
|
|
- library: 'DECODER routines'
|
|
|
- } : {
|
|
|
-- message: /asn1 encoding/,
|
|
|
-- library: 'asn1 encoding routines'
|
|
|
-+ message: /asn1 encoding|DECODE_ERROR/,
|
|
|
-+ library: /asn1 encoding routines|public key routines/
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
-@@ -349,6 +349,7 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem',
|
|
|
- d: 'wVK6M3SMhQh3NK-7GRrSV-BVWQx1FO5pW8hhQeu_NdA',
|
|
|
- kty: 'OKP'
|
|
|
- } },
|
|
|
-+/*
|
|
|
- { private: fixtures.readKey('ed448_private.pem', 'ascii'),
|
|
|
- public: fixtures.readKey('ed448_public.pem', 'ascii'),
|
|
|
- keyType: 'ed448',
|
|
|
-@@ -380,6 +381,7 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem',
|
|
|
- 'S0jlSYJk',
|
|
|
- kty: 'OKP'
|
|
|
- } },
|
|
|
-+*/
|
|
|
- ].forEach((info) => {
|
|
|
- const keyType = info.keyType;
|
|
|
-
|
|
|
-@@ -421,7 +423,7 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem',
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
--
|
|
|
-+/*
|
|
|
- [
|
|
|
- { private: fixtures.readKey('ec_p256_private.pem', 'ascii'),
|
|
|
- public: fixtures.readKey('ec_p256_public.pem', 'ascii'),
|
|
|
-@@ -514,7 +516,7 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem',
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
--
|
|
|
-+*/
|
|
|
- {
|
|
|
- // Reading an encrypted key without a passphrase should fail.
|
|
|
- assert.throws(() => createPrivateKey(privateDsa), common.hasOpenSSL3 ? {
|
|
|
-@@ -546,7 +548,7 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem',
|
|
|
- }), {
|
|
|
- message: common.hasOpenSSL3 ?
|
|
|
- 'error:1E08010C:DECODER routines::unsupported' :
|
|
|
-- /bad decrypt/
|
|
|
-+ /bad decrypt|error:1e000065:Cipher functions:OPENSSL_internal:BAD_DECRYPT/
|
|
|
- });
|
|
|
-
|
|
|
- const publicKey = createPublicKey(publicDsa);
|
|
|
-@@ -569,7 +571,7 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem',
|
|
|
- () => privateKey.export({ format: 'jwk' }),
|
|
|
- { code: 'ERR_CRYPTO_JWK_UNSUPPORTED_KEY_TYPE' });
|
|
|
- }
|
|
|
--
|
|
|
-+/*
|
|
|
- {
|
|
|
- // Test RSA-PSS.
|
|
|
- {
|
|
|
-@@ -767,7 +769,7 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem',
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
--
|
|
|
-+*/
|
|
|
- {
|
|
|
- // 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 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);
|
|
|
- }));
|
|
|
- }
|
|
|
-
|
|
|
-+/*
|
|
|
- {
|
|
|
- // Test RSA-PSS.
|
|
|
- generateKeyPair('rsa-pss', {
|
|
|
-@@ -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',
|
|
|
-@@ -417,6 +422,9 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
|
|
- });
|
|
|
- }));
|
|
|
- }
|
|
|
-+*/
|
|
|
-+
|
|
|
-+/*
|
|
|
- {
|
|
|
- // 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.
|
|
|
-@@ -552,8 +562,10 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
|
|
- testSignVerify(publicKey, { key: privateKey, passphrase: 'secret' });
|
|
|
- }));
|
|
|
- }
|
|
|
-+*/
|
|
|
-
|
|
|
- {
|
|
|
-+ /*
|
|
|
- // 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', {
|
|
|
- namedCurve: 'P-256',
|
|
|
- paramEncoding: 'explicit',
|
|
|
-@@ -627,15 +641,16 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
|
|
- passphrase: 'top secret'
|
|
|
- });
|
|
|
- }));
|
|
|
-+ */
|
|
|
-
|
|
|
- // 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: {
|
|
|
-@@ -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: {
|
|
|
-@@ -1089,6 +1108,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-+/*
|
|
|
- // Test DSA parameters.
|
|
|
- {
|
|
|
- // Test invalid modulus lengths.
|
|
|
-@@ -1116,6 +1136,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
-+*/
|
|
|
-
|
|
|
- // Test EC parameters.
|
|
|
- {
|
|
|
-@@ -1160,13 +1181,13 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
|
|
- }));
|
|
|
-
|
|
|
- generateKeyPair('ec', {
|
|
|
-- namedCurve: 'secp256k1',
|
|
|
-+ namedCurve: 'secp521r1',
|
|
|
- }, common.mustSucceed((publicKey, privateKey) => {
|
|
|
- assert.deepStrictEqual(publicKey.asymmetricKeyDetails, {
|
|
|
-- namedCurve: 'secp256k1'
|
|
|
-+ namedCurve: 'secp521r1'
|
|
|
- });
|
|
|
- assert.deepStrictEqual(privateKey.asymmetricKeyDetails, {
|
|
|
-- namedCurve: 'secp256k1'
|
|
|
-+ namedCurve: 'secp521r1'
|
|
|
- });
|
|
|
- }));
|
|
|
- }
|
|
|
-@@ -1174,7 +1195,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
|
|
- // Test EdDSA key generation.
|
|
|
- {
|
|
|
- if (!/^1\.1\.0/.test(process.versions.openssl)) {
|
|
|
-- ['ed25519', 'ed448', 'x25519', 'x448'].forEach((keyType) => {
|
|
|
-+ ['ed25519'/*, 'ed448', 'x25519', 'x448'*/].forEach((keyType) => {
|
|
|
- generateKeyPair(keyType, common.mustSucceed((publicKey, privateKey) => {
|
|
|
- assert.strictEqual(publicKey.type, 'public');
|
|
|
- assert.strictEqual(publicKey.asymmetricKeyType, keyType);
|
|
|
-@@ -1188,6 +1209,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-+/*
|
|
|
- // Test classic Diffie-Hellman key generation.
|
|
|
- {
|
|
|
- generateKeyPair('dh', {
|
|
|
-@@ -1300,6 +1322,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
-+*/
|
|
|
-
|
|
|
- // Test invalid key encoding types.
|
|
|
- {
|
|
|
-@@ -1500,6 +1523,7 @@ if (!common.hasOpenSSL3) {
|
|
|
- }, common.mustSucceed((publicKey, privateKey) => {
|
|
|
- assert.strictEqual(publicKey.type, 'public');
|
|
|
-
|
|
|
-+ /*
|
|
|
- for (const passphrase of ['', Buffer.alloc(0)]) {
|
|
|
- const privateKeyObject = createPrivateKey({
|
|
|
- passphrase,
|
|
|
-@@ -1507,6 +1531,7 @@ if (!common.hasOpenSSL3) {
|
|
|
- });
|
|
|
- assert.strictEqual(privateKeyObject.asymmetricKeyType, 'rsa');
|
|
|
- }
|
|
|
-+ */
|
|
|
-
|
|
|
- // Encrypting with an empty passphrase is not the same as not encrypting
|
|
|
- // the key, and not specifying a passphrase should fail when decoding it.
|
|
|
-diff --git a/test/parallel/test-crypto-padding-aes256.js b/test/parallel/test-crypto-padding-aes256.js
|
|
|
-index 14d853bdfd0a5dcc5bdb6e00cb20fdbeaabd2aff..3ae6fc47d4c6a8296a2c3c70daf464fad886a88d 100644
|
|
|
---- a/test/parallel/test-crypto-padding-aes256.js
|
|
|
-+++ b/test/parallel/test-crypto-padding-aes256.js
|
|
|
-@@ -32,13 +32,13 @@ const key = Buffer.from('0123456789abcdef0123456789abcdef' +
|
|
|
- '0123456789abcdef0123456789abcdef', 'hex');
|
|
|
-
|
|
|
- function encrypt(val, pad) {
|
|
|
-- const c = crypto.createCipheriv('aes256', key, iv);
|
|
|
-+ const c = crypto.createCipheriv('aes-256-cbc', key, iv);
|
|
|
- c.setAutoPadding(pad);
|
|
|
- return c.update(val, 'utf8', 'latin1') + c.final('latin1');
|
|
|
- }
|
|
|
-
|
|
|
- function decrypt(val, pad) {
|
|
|
-- const c = crypto.createDecipheriv('aes256', key, iv);
|
|
|
-+ const c = crypto.createDecipheriv('aes-256-cbc', key, iv);
|
|
|
- c.setAutoPadding(pad);
|
|
|
- return c.update(val, 'latin1', 'utf8') + c.final('utf8');
|
|
|
- }
|
|
|
diff --git a/test/parallel/test-crypto-padding.js b/test/parallel/test-crypto-padding.js
|
|
|
index f1f14b472997e76bb4100edb1c6cf4fc24d1074d..5057e3f9bc5bb78aceffa5e79530f8ceed84e6f7 100644
|
|
|
--- a/test/parallel/test-crypto-padding.js
|
|
@@ -1260,10 +960,10 @@ 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
|
|
|
+index ab7aa77394ac9989514b7a184900092bd6753996..b0104ac45867a923a8c651e01e8c6975a62f7c61 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 = [
|
|
|
+@@ -481,6 +481,7 @@ const testVectors = [
|
|
|
await Promise.all(variations);
|
|
|
})().then(common.mustCall());
|
|
|
|
|
@@ -1271,11 +971,14 @@ index 04cf6388fc739d3eab0a8d47857590c7a9b84342..d111e697db652b98dd8a9eb7869b1a98
|
|
|
{
|
|
|
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 = [
|
|
|
+@@ -522,6 +523,7 @@ const testVectors = [
|
|
|
assert.strictEqual(jwk.alg, 'PS256');
|
|
|
})().then(common.mustCall());
|
|
|
}
|
|
|
+*/
|
|
|
+
|
|
|
+ {
|
|
|
+ const ecPublic = crypto.createPublicKey(
|
|
|
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
|