-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
crypto: return a clearer error when loading an unsupported pkcs12
PR-URL: #54485 Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
- Loading branch information
Showing
3 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
if (!common.hasCrypto) | ||
common.skip('missing crypto'); | ||
if (!common.hasOpenSSL3) | ||
common.skip('OpenSSL legacy failures are only testable with OpenSSL 3+'); | ||
|
||
const fixtures = require('../common/fixtures'); | ||
|
||
const { | ||
assert, connect, keys | ||
} = require(fixtures.path('tls-connect')); | ||
|
||
const legacyPfx = fixtures.readKey('legacy.pfx'); | ||
|
||
connect({ | ||
client: { | ||
pfx: legacyPfx, | ||
passphrase: 'legacy', | ||
rejectUnauthorized: false | ||
}, | ||
server: keys.agent1 | ||
}, common.mustCall((e, pair, cleanup) => { | ||
assert.strictEqual(e.code, 'ERR_CRYPTO_UNSUPPORTED_OPERATION'); | ||
assert.strictEqual(e.message, 'Unsupported PKCS12 PFX data'); | ||
cleanup(); | ||
})); |