Skip to content

Commit 24ab8c6

Browse files
committed
fix(Server): Set tls.DEFAULT_ECDH_CURVE to 'auto'
The default value of tls.DEFAULT_ECDH_CURVE is 'prime256v1', it breaks the connection when certificate is not compatible with the default curve since node^8.6.0. To fix this issue, we need set it to 'auto', makes OpenSSL select the curve automatically.
1 parent d2f4902 commit 24ab8c6

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/Server.js

+7
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@ const createCertificate = require('./utils/createCertificate');
4040
const validateOptions = require('schema-utils');
4141
const schema = require('./options.json');
4242

43+
// Workaround for node ^8.6.0, ^9.0.0
44+
// DEFAULT_ECDH_CURVE is default to prime256v1 in these version
45+
// breaking connection when certificate is not signed with prime256v1
46+
// change it to auto allows OpenSSL to select the curve automatically
47+
// See https://github.com/nodejs/node/issues/16196 for more infomation
48+
require('tls').DEFAULT_ECDH_CURVE = 'auto';
49+
4350
const STATS = {
4451
all: false,
4552
hash: true,

0 commit comments

Comments
 (0)