| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 5e0759f commit 2296a4f
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -511,7 +511,7 @@ publicly trusted list of CAs as given in | |||
| 511 | 511 | <http://mxr.mozilla.org/mozilla/source/security/nss/lib/ckfw/builtins/certdata.txt>. | |
| 512 | 512 | ||
| 513 | 513 | ||
| 514 | - ## tls.createSecurePair([context][, isServer][, requestCert][, rejectUnauthorized]) | ||
| 514 | + ## tls.createSecurePair([context][, isServer][, requestCert][, rejectUnauthorized][, options]) | ||
| 515 | 515 | ||
| 516 | 516 | Creates a new secure pair object with two streams, one of which reads/writes | |
| 517 | 517 | encrypted data, and one reads/writes cleartext data. | |
@@ -530,6 +530,8 @@ and the cleartext one is used as a replacement for the initial encrypted stream. | |||
| 530 | 530 | automatically reject clients with invalid certificates. Only applies to | |
| 531 | 531 | servers with `requestCert` enabled. | |
| 532 | 532 | ||
| 533 | + - `options`: An object with common SSL options. See [tls.TLSSocket][]. | ||
| 534 | + | ||
| 533 | 535 | `tls.createSecurePair()` returns a SecurePair object with `cleartext` and | |
| 534 | 536 | `encrypted` stream properties. | |
| 535 | 537 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -761,11 +761,13 @@ function securePairNT(self, options) { | |||
| 761 | 761 | exports.createSecurePair = function(context, | |
| 762 | 762 | isServer, | |
| 763 | 763 | requestCert, | |
| 764 | - rejectUnauthorized) { | ||
| 764 | + rejectUnauthorized, | ||
| 765 | + options) { | ||
| 765 | 766 | var pair = new SecurePair(context, | |
| 766 | 767 | isServer, | |
| 767 | 768 | requestCert, | |
| 768 | - rejectUnauthorized); | ||
| 769 | + rejectUnauthorized, | ||
| 770 | + options); | ||
| 769 | 771 | return pair; | |
| 770 | 772 | }; | |
| 771 | 773 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,27 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + | ||
| 3 | + const common = require('../common'); | ||
| 4 | + const assert = require('assert'); | ||
| 5 | + const fs = require('fs'); | ||
| 6 | + const tls = require('tls'); | ||
| 7 | + | ||
| 8 | + const sslcontext = tls.createSecureContext({ | ||
| 9 | + cert: fs.readFileSync(common.fixturesDir + '/test_cert.pem'), | ||
| 10 | + key: fs.readFileSync(common.fixturesDir + '/test_key.pem') | ||
| 11 | + }); | ||
| 12 | + | ||
| 13 | + var catchedServername; | ||
| 14 | + const pair = tls.createSecurePair(sslcontext, true, false, false, { | ||
| 15 | + SNICallback: common.mustCall(function(servername, cb) { | ||
| 16 | + catchedServername = servername; | ||
| 17 | + }) | ||
| 18 | + }); | ||
| 19 | + | ||
| 20 | + // captured traffic from browser's request to https://www.google.com | ||
| 21 | + const sslHello = fs.readFileSync(common.fixturesDir + '/google_ssl_hello.bin'); | ||
| 22 | + | ||
| 23 | + pair.encrypted.write(sslHello); | ||
| 24 | + | ||
| 25 | + process.on('exit', function() { | ||
| 26 | + assert.strictEqual('www.google.com', catchedServername); | ||
| 27 | + }); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments