Skip to content

Commit

Permalink
crypto: add ticketKeys option in createSecureContext
Browse files Browse the repository at this point in the history
There's a method to initialize a TLS Server using tls.createSever by
specifying a ticketKeys option, but none in the underlying constructor,
tls.createSecureContext.

This PR adds the ticketKeys option to tls.createSecureContext.

Fixes: nodejs#20908
  • Loading branch information
ryzokuken committed May 23, 2018
1 parent c89669d commit 2594cd2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
5 changes: 5 additions & 0 deletions lib/_tls_common.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,11 @@ exports.createSecureContext = function createSecureContext(options, context) {
options.clientCertEngine);
}

// Set ticketKeys right inside createSecureContext
if (options.ticketKeys) {
c.context.setTicketKeys(options.ticketKeys);
}

return c;
};

Expand Down
7 changes: 2 additions & 5 deletions lib/_tls_wrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,8 @@ function Server(options, listener) {
secureOptions: this.secureOptions,
honorCipherOrder: this.honorCipherOrder,
crl: this.crl,
sessionIdContext: this.sessionIdContext
sessionIdContext: this.sessionIdContext,
ticketKeys: this.ticketKeys
});

this[kHandshakeTimeout] = options.handshakeTimeout || (120 * 1000);
Expand All @@ -900,10 +901,6 @@ function Server(options, listener) {
this._sharedCreds.context.setSessionTimeout(this.sessionTimeout);
}

if (this.ticketKeys) {
this._sharedCreds.context.setTicketKeys(this.ticketKeys);
}

// constructor call
net.Server.call(this, tlsConnectionListener);

Expand Down

0 comments on commit 2594cd2

Please sign in to comment.