Skip to content

Commit db5ee23

Browse files
danbevrichardlau
authored andcommitted
test: update OpenSSL 3.0.0-alpha15 error messages
PR-URL: #38451 Fixes: #38373 Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 786ed4d commit db5ee23

7 files changed

+26
-18
lines changed

test/parallel/test-crypto-dh-stateless.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ assert.throws(() => {
226226
crypto.generateKeyPairSync('ec', { namedCurve: not256k1 }));
227227
}, common.hasOpenSSL3 ? {
228228
name: 'Error',
229-
code: 'ERR_OSSL_EC_INCOMPATIBLE_OBJECTS'
229+
code: 'ERR_OSSL_MISMATCHING_SHARED_PARAMETERS'
230230
} : {
231231
name: 'Error',
232232
code: 'ERR_OSSL_EVP_DIFFERENT_PARAMETERS'

test/parallel/test-crypto-key-objects.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,10 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem',
328328
type: 'pkcs1'
329329
});
330330
createPrivateKey({ key, format: 'der', type: 'pkcs1' });
331-
}, {
331+
}, common.hasOpenSSL3 ? {
332+
message: /error:1E08010C:DECODER routines::unsupported/,
333+
library: 'DECODER routines'
334+
} : {
332335
message: /asn1 encoding/,
333336
library: 'asn1 encoding routines'
334337
});
@@ -514,7 +517,8 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem',
514517
// Reading an encrypted key without a passphrase should fail.
515518
assert.throws(() => createPrivateKey(privateDsa), common.hasOpenSSL3 ? {
516519
name: 'Error',
517-
message: 'Failed to read private key',
520+
message: 'error:07880109:common libcrypto routines::interrupted or ' +
521+
'cancelled',
518522
} : {
519523
name: 'TypeError',
520524
code: 'ERR_MISSING_PASSPHRASE',
@@ -540,7 +544,7 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem',
540544
passphrase: Buffer.alloc(1024, 'a')
541545
}), {
542546
message: common.hasOpenSSL3 ?
543-
'Failed to read private key' :
547+
'error:07880109:common libcrypto routines::interrupted or cancelled' :
544548
/bad decrypt/
545549
});
546550

test/parallel/test-crypto-keygen.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,8 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
213213
const publicKey = { key: publicKeyDER, ...publicKeyEncoding };
214214
const expectedError = common.hasOpenSSL3 ? {
215215
name: 'Error',
216-
message: 'Failed to read private key'
216+
message: 'error:07880109:common libcrypto routines::interrupted or ' +
217+
'cancelled'
217218
} : {
218219
name: 'TypeError',
219220
code: 'ERR_MISSING_PASSPHRASE',
@@ -477,7 +478,8 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
477478
// Since the private key is encrypted, signing shouldn't work anymore.
478479
assert.throws(() => testSignVerify(publicKey, privateKey),
479480
common.hasOpenSSL3 ? {
480-
message: 'Failed to read private key'
481+
message: 'error:07880109:common libcrypto ' +
482+
'routines::interrupted or cancelled'
481483
} : {
482484
name: 'TypeError',
483485
code: 'ERR_MISSING_PASSPHRASE',
@@ -510,7 +512,8 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
510512
// Since the private key is encrypted, signing shouldn't work anymore.
511513
assert.throws(() => testSignVerify(publicKey, privateKey),
512514
common.hasOpenSSL3 ? {
513-
message: 'Failed to read private key'
515+
message: 'error:07880109:common libcrypto ' +
516+
'routines::interrupted or cancelled'
514517
} : {
515518
name: 'TypeError',
516519
code: 'ERR_MISSING_PASSPHRASE',
@@ -546,7 +549,8 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
546549
// Since the private key is encrypted, signing shouldn't work anymore.
547550
assert.throws(() => testSignVerify(publicKey, privateKey),
548551
common.hasOpenSSL3 ? {
549-
message: 'Failed to read private key'
552+
message: 'error:07880109:common libcrypto ' +
553+
'routines::interrupted or cancelled'
550554
} : {
551555
name: 'TypeError',
552556
code: 'ERR_MISSING_PASSPHRASE',
@@ -583,7 +587,8 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
583587
// Since the private key is encrypted, signing shouldn't work anymore.
584588
assert.throws(() => testSignVerify(publicKey, privateKey),
585589
common.hasOpenSSL3 ? {
586-
message: 'Failed to read private key'
590+
message: 'error:07880109:common libcrypto ' +
591+
'routines::interrupted or cancelled'
587592
} : {
588593
name: 'TypeError',
589594
code: 'ERR_MISSING_PASSPHRASE',

test/parallel/test-crypto-private-decrypt-gh32240.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ function decrypt(key) {
3535

3636
decrypt(pkey);
3737
assert.throws(() => decrypt(pkeyEncrypted), common.hasOpenSSL3 ?
38-
{ message: 'Failed to read asymmetric key' } :
38+
{ message: 'error:07880109:common libcrypto routines::interrupted or ' +
39+
'cancelled' } :
3940
{ code: 'ERR_MISSING_PASSPHRASE' });
4041
decrypt(pkey); // Should not throw.

test/parallel/test-crypto-rsa-dsa.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,11 @@ const openssl1DecryptError = {
3737
};
3838

3939
const decryptError = common.hasOpenSSL3 ?
40-
{ message: 'Failed to read asymmetric key' } : openssl1DecryptError;
40+
{ message: 'error:1C800064:Provider routines::bad decrypt' } :
41+
openssl1DecryptError;
4142

4243
const decryptPrivateKeyError = common.hasOpenSSL3 ? {
43-
message: 'Failed to read private key',
44+
message: 'error:1C800064:Provider routines::bad decrypt',
4445
} : openssl1DecryptError;
4546

4647
function getBufferCopy(buf) {

test/parallel/test-crypto-sign-verify.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,7 @@ const keySize = 2048;
4444
`-----BEGIN RSA PRIVATE KEY-----
4545
AAAAAAAAAAAA
4646
-----END RSA PRIVATE KEY-----`);
47-
}, { message: common.hasOpenSSL3 ?
48-
'Failed to read private key' :
49-
'bye, bye, library' });
47+
}, { message: 'bye, bye, library' });
5048

5149
delete Object.prototype.library;
5250

test/parallel/test-tls-passphrase.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ server.listen(0, common.mustCall(function() {
224224
})).unref();
225225

226226
const errMessagePassword = common.hasOpenSSL3 ?
227-
/Error: PEM_read_bio_PrivateKey/ : /bad decrypt/;
227+
/Error: error:1400006B:UI routines::processing error/ : /bad decrypt/;
228228

229229
// Missing passphrase
230230
assert.throws(function() {
@@ -254,8 +254,7 @@ assert.throws(function() {
254254
});
255255
}, errMessagePassword);
256256

257-
const errMessageDecrypt = common.hasOpenSSL3 ?
258-
/Error: PEM_read_bio_PrivateKey/ : /bad decrypt/;
257+
const errMessageDecrypt = /bad decrypt/;
259258

260259
// Invalid passphrase
261260
assert.throws(function() {

0 commit comments

Comments
 (0)