Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixup! crypto: add ticketKeys option in createSecureContext
  • Loading branch information
ryzokuken committed May 26, 2018
commit 38e22dcf3c24f7e52caa3cfdf2260fb098f6aeba
4 changes: 2 additions & 2 deletions lib/_tls_common.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ function SecureContext(secureProtocol, secureOptions, context) {
if (secureOptions) this.context.setOptions(secureOptions);
}

SecureContext.prototype.getTicketKeys = function getTicketKeys(keys) {
return this.context.getTicketKeys(keys);
SecureContext.prototype.getTicketKeys = function getTicketKeys() {
return this.context.getTicketKeys();
};


Expand Down
22 changes: 22 additions & 0 deletions test/parallel/test-tls-securecontext-ticketkeys.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
'use strict';
const common = require('../common');
if (!common.hasCrypto)
common.skip('missing crypto');
const fixtures = require('../common/fixtures');

const assert = require('assert');
const crypto = require('crypto');
const tls = require('tls');

const keys = crypto.randomBytes(48);
const otherKeys = crypto.randomBytes(48);

const context = tls.createSecureContext({
key: fixtures.readKey('agent1-key.pem'),
cert: fixtures.readKey('agent1-cert.pem'),
ticketKeys: keys
});

assert.strictEqual(context.getTicketKeys(), keys);
context.setTicketKeys(otherKeys);
assert.strictEqual(context.getTicketKeys(), otherKeys);