Skip to content

Commit

Permalink
crypto: fix generateKeyPair with encoding 'jwk'
Browse files Browse the repository at this point in the history
  • Loading branch information
codebytere committed Aug 18, 2021
1 parent 9987df5 commit 9001f6b
Showing 1 changed file with 10 additions and 19 deletions.
29 changes: 10 additions & 19 deletions patches/node/fix_crypto_tests_to_run_with_bssl.patch
Original file line number Diff line number Diff line change
Expand Up @@ -489,12 +489,12 @@ 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 3159b0da3f2901aab17e0b360eda84decaed9eb3..995b7f6b45bd0aa83eef143b15dede5658ac1bc0 100644
index aa03a0379a291a4632b68d428d4e1875d60166a3..b89071d41abfe731551b0445f2a92fd797165c98 100644
--- a/test/parallel/test-crypto-key-objects.js
+++ b/test/parallel/test-crypto-key-objects.js
@@ -310,11 +310,11 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem',
@@ -307,11 +307,11 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem',
}, common.hasOpenSSL3 ? {
message: 'Failed to read private key',
message: 'error:1E08010C:DECODER routines::unsupported',
} : {
- message: 'error:0909006C:PEM routines:get_name:no start line',
- code: 'ERR_OSSL_PEM_NO_START_LINE',
Expand Down Expand Up @@ -554,15 +554,6 @@ index 3159b0da3f2901aab17e0b360eda84decaed9eb3..995b7f6b45bd0aa83eef143b15dede56
{
// Reading an encrypted key without a passphrase should fail.
assert.throws(() => createPrivateKey(privateDsa), common.hasOpenSSL3 ? {
@@ -550,7 +552,7 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem',
}), {
message: common.hasOpenSSL3 ?
'error:07880109:common libcrypto routines::interrupted or cancelled' :
- /bad decrypt/
+ /bad decrypt|BAD_DECRYPT/
});

const publicKey = createPublicKey(publicDsa);
@@ -573,7 +575,7 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem',
() => privateKey.export({ format: 'jwk' }),
{ code: 'ERR_CRYPTO_JWK_UNSUPPORTED_KEY_TYPE' });
Expand Down Expand Up @@ -643,22 +634,22 @@ index 4612fc4a1ac40a27ccc2c70ac11e32f0fdcaa2c3..a4d604cf0318cfb0771e3573245b1ed9
}

{
@@ -566,6 +574,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
@@ -562,6 +562,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
});
}));

+ /*
+/*
// Test async elliptic curve key generation, e.g. for ECDSA, with an encrypted
// private key with paramEncoding explicit.
generateKeyPair('ec', {
@@ -603,6 +612,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
passphrase: 'top secret'
});
}));
+ */
@@ -688,6 +689,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
});
}

+*/
// Test invalid parameter encoding.
{
assert.throws(() => generateKeyPairSync('ec', {
@@ -951,6 +961,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
}
}
Expand Down

0 comments on commit 9001f6b

Please sign in to comment.