Lines 28-43
const {
Link Here
|
28 |
ERR_CRYPTO_CUSTOM_ENGINE_NOT_SUPPORTED, |
28 |
ERR_CRYPTO_CUSTOM_ENGINE_NOT_SUPPORTED, |
29 |
ERR_INVALID_ARG_TYPE |
29 |
ERR_INVALID_ARG_TYPE |
30 |
} = require('internal/errors').codes; |
30 |
} = require('internal/errors').codes; |
31 |
|
|
|
32 |
const { SSL_OP_CIPHER_SERVER_PREFERENCE } = internalBinding('constants').crypto; |
31 |
const { SSL_OP_CIPHER_SERVER_PREFERENCE } = internalBinding('constants').crypto; |
33 |
|
32 |
|
34 |
// Lazily loaded from internal/crypto/util. |
33 |
// Lazily loaded from internal/crypto/util. |
35 |
let toBuf = null; |
34 |
let toBuf = null; |
36 |
|
35 |
|
|
|
36 |
|
37 |
const { SecureContext: NativeSecureContext } = internalBinding('crypto'); |
37 |
const { SecureContext: NativeSecureContext } = internalBinding('crypto'); |
38 |
function SecureContext(secureProtocol, secureOptions, context) { |
38 |
function SecureContext(secureProtocol, secureOptions, context, min_version, |
|
|
39 |
max_version) { |
39 |
if (!(this instanceof SecureContext)) { |
40 |
if (!(this instanceof SecureContext)) { |
40 |
return new SecureContext(secureProtocol, secureOptions, context); |
41 |
return new SecureContext(secureProtocol, secureOptions, context, |
|
|
42 |
min_version, max_version); |
41 |
} |
43 |
} |
42 |
|
44 |
|
43 |
if (context) { |
45 |
if (context) { |
Lines 46-54
function SecureContext(secureProtocol, secureOptions, context) {
Link Here
|
46 |
this.context = new NativeSecureContext(); |
48 |
this.context = new NativeSecureContext(); |
47 |
|
49 |
|
48 |
if (secureProtocol) { |
50 |
if (secureProtocol) { |
49 |
this.context.init(secureProtocol); |
51 |
this.context.init(min_version, max_version, secureProtocol); |
50 |
} else { |
52 |
} else { |
51 |
this.context.init(); |
53 |
this.context.init(min_version, max_version); |
52 |
} |
54 |
} |
53 |
} |
55 |
} |
54 |
|
56 |
|
Lines 75-81
exports.createSecureContext = function createSecureContext(options, context) {
Link Here
|
75 |
if (options.honorCipherOrder) |
77 |
if (options.honorCipherOrder) |
76 |
secureOptions |= SSL_OP_CIPHER_SERVER_PREFERENCE; |
78 |
secureOptions |= SSL_OP_CIPHER_SERVER_PREFERENCE; |
77 |
|
79 |
|
78 |
const c = new SecureContext(options.secureProtocol, secureOptions, context); |
80 |
const c = new SecureContext(options.secureProtocol, secureOptions, context, |
|
|
81 |
options.min_version || tls.DEFAULT_MIN_VERSION, |
82 |
options.max_version || tls.DEFAULT_MAX_VERSION); |
79 |
var i; |
83 |
var i; |
80 |
var val; |
84 |
var val; |
81 |
|
85 |
|