mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
test: fix flaky key pair generation test
There is a very small chance (about 0.4%) that OpenSSL will successfully decrypt a key without the correct passphrase and will then fail while parsing its ASN.1 structure. In those rare cases, the error message will be different. PR-URL: https://github.com/nodejs/node/pull/22980 Fixes: https://github.com/nodejs/node/issues/22978 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
@@ -169,7 +169,7 @@ function convertDERToPEM(label, der) {
|
||||
// Since the private key is encrypted, signing shouldn't work anymore.
|
||||
assert.throws(() => {
|
||||
testSignVerify(publicKey, privateKey);
|
||||
}, /bad decrypt/);
|
||||
}, /bad decrypt|asn1 encoding routines/);
|
||||
|
||||
// Signing should work with the correct password.
|
||||
testSignVerify(publicKey, {
|
||||
@@ -232,7 +232,7 @@ function convertDERToPEM(label, der) {
|
||||
// Since the private key is encrypted, signing shouldn't work anymore.
|
||||
assert.throws(() => {
|
||||
testSignVerify(publicKey, privateKey);
|
||||
}, /bad decrypt/);
|
||||
}, /bad decrypt|asn1 encoding routines/);
|
||||
|
||||
testSignVerify(publicKey, {
|
||||
key: privateKey,
|
||||
|
||||
Reference in New Issue
Block a user