mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
tls: make cert/pfx optional in tls.createServer()
Not all ciphers require the presence of a certificate. Remove the check in lib/_tls_wrap.js. Fixes #6887.
This commit is contained in:
committed by
Fedor Indutny
parent
262a752c29
commit
db5abd726f
@@ -475,10 +475,6 @@ function Server(/* [options], listener */) {
|
||||
// Handle option defaults:
|
||||
this.setOptions(options);
|
||||
|
||||
if (!self.pfx && (!self.cert || !self.key)) {
|
||||
throw new Error('Missing PFX or certificate + private key.');
|
||||
}
|
||||
|
||||
var sharedCreds = crypto.createCredentials({
|
||||
pfx: self.pfx,
|
||||
key: self.key,
|
||||
|
||||
@@ -25,14 +25,11 @@ if (!process.versions.openssl) {
|
||||
}
|
||||
|
||||
var common = require('../common');
|
||||
var assert = require('assert');
|
||||
var https = require('https');
|
||||
var tls = require('tls');
|
||||
|
||||
assert.throws(function() {
|
||||
tls.createServer({ /* empty */}).listen(0);
|
||||
}, /missing.+certificate/i);
|
||||
|
||||
assert.throws(function() {
|
||||
https.createServer({ /* empty */}).listen(0);
|
||||
}, /missing.+certificate/i);
|
||||
// Omitting the cert or pfx option to tls.createServer() should not throw.
|
||||
// AECDH-NULL-SHA is a no-authentication/no-encryption cipher and hence
|
||||
// doesn't need a certificate.
|
||||
tls.createServer({ ciphers: 'AECDH-NULL-SHA' }).listen(0, function() {
|
||||
this.close();
|
||||
});
|
||||
Reference in New Issue
Block a user