Skip to content

Commit 83278b2

Browse files
tniessentargos
authored andcommittedSep 21, 2018
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: #22980 Fixes: #22978 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent d38ce82 commit 83278b2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎test/parallel/test-crypto-keygen.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ function convertDERToPEM(label, der) {
169169
// Since the private key is encrypted, signing shouldn't work anymore.
170170
assert.throws(() => {
171171
testSignVerify(publicKey, privateKey);
172-
}, /bad decrypt/);
172+
}, /bad decrypt|asn1 encoding routines/);
173173

174174
// Signing should work with the correct password.
175175
testSignVerify(publicKey, {
@@ -232,7 +232,7 @@ function convertDERToPEM(label, der) {
232232
// Since the private key is encrypted, signing shouldn't work anymore.
233233
assert.throws(() => {
234234
testSignVerify(publicKey, privateKey);
235-
}, /bad decrypt/);
235+
}, /bad decrypt|asn1 encoding routines/);
236236

237237
testSignVerify(publicKey, {
238238
key: privateKey,

0 commit comments

Comments
 (0)