-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
crypto: add
pfx
certs as CA certs too
According to documentation all certificates specified in `pfx` option should be treated as a CA certificates too. While it doesn't seem to be logically correct to me, we can't afford to break API stability at this point. Fix: #5100 PR-URL: #5109 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Shigeki Ohtsu <ohtsu@iij.ad.jp>
- Loading branch information
Showing
2 changed files
with
47 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
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,36 @@ | ||
'use strict'; | ||
|
||
const common = require('../common'); | ||
|
||
if (!common.hasCrypto) { | ||
console.log('1..0 # Skipped: node compiled without crypto.'); | ||
return; | ||
} | ||
|
||
const assert = require('assert'); | ||
const tls = require('tls'); | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
const pfx = fs.readFileSync( | ||
path.join(common.fixturesDir, 'keys', 'agent1-pfx.pem')); | ||
|
||
const server = tls.createServer({ | ||
pfx: pfx, | ||
passphrase: 'sample', | ||
requestCert: true, | ||
rejectUnauthorized: false | ||
}, common.mustCall(function(c) { | ||
assert(c.authorizationError === null, 'authorizationError must be null'); | ||
c.end(); | ||
})).listen(common.PORT, function() { | ||
var client = tls.connect({ | ||
port: common.PORT, | ||
pfx: pfx, | ||
passphrase: 'sample', | ||
rejectUnauthorized: false | ||
}, function() { | ||
client.end(); | ||
server.close(); | ||
}); | ||
}); |