forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
crypto: return clear errors when loading invalid PFX data
PR-URL: nodejs#49566 Reviewed-By: Ben Noordhuis <[email protected]>
- Loading branch information
1 parent
b36d25f
commit 9f848d2
Showing
3 changed files
with
74 additions
and
25 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,23 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
if (!common.hasCrypto) | ||
common.skip('missing crypto'); | ||
const fixtures = require('../common/fixtures'); | ||
|
||
const { | ||
assert, connect, keys | ||
} = require(fixtures.path('tls-connect')); | ||
|
||
const invalidPfx = fixtures.readKey('cert-without-key.pfx'); | ||
|
||
connect({ | ||
client: { | ||
pfx: invalidPfx, | ||
passphrase: 'test', | ||
rejectUnauthorized: false | ||
}, | ||
server: keys.agent1 | ||
}, common.mustCall((e, pair, cleanup) => { | ||
assert.strictEqual(e.message, 'Unable to load private key from PFX data'); | ||
cleanup(); | ||
})); |