11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ciconst common = require('../common'); 41cb0ef41Sopenharmony_ciif (!common.hasCrypto) 51cb0ef41Sopenharmony_ci common.skip('missing crypto'); 61cb0ef41Sopenharmony_ci 71cb0ef41Sopenharmony_ciconst assert = require('assert'); 81cb0ef41Sopenharmony_ciconst tls = require('tls'); 91cb0ef41Sopenharmony_ciconst fixtures = require('../common/fixtures'); 101cb0ef41Sopenharmony_ci 111cb0ef41Sopenharmony_ciconst sslcontext = tls.createSecureContext({ 121cb0ef41Sopenharmony_ci cert: fixtures.readKey('rsa_cert.crt'), 131cb0ef41Sopenharmony_ci key: fixtures.readKey('rsa_private.pem') 141cb0ef41Sopenharmony_ci}); 151cb0ef41Sopenharmony_ci 161cb0ef41Sopenharmony_ciconst pair = tls.createSecurePair(sslcontext, true, false, false, { 171cb0ef41Sopenharmony_ci SNICallback: common.mustCall((servername, cb) => { 181cb0ef41Sopenharmony_ci assert.strictEqual(servername, 'www.google.com'); 191cb0ef41Sopenharmony_ci }) 201cb0ef41Sopenharmony_ci}); 211cb0ef41Sopenharmony_ci 221cb0ef41Sopenharmony_ci// Captured traffic from browser's request to https://www.google.com 231cb0ef41Sopenharmony_ciconst sslHello = fixtures.readSync('google_ssl_hello.bin'); 241cb0ef41Sopenharmony_ci 251cb0ef41Sopenharmony_cipair.encrypted.write(sslHello); 26