%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
'use strict'; const common = require('../../common'); const fixture = require('../../common/fixtures'); if (!common.hasCrypto) common.skip('missing crypto'); const fs = require('fs'); const path = require('path'); const engine = path.join(__dirname, `/build/${common.buildType}/testengine.engine`); if (!fs.existsSync(engine)) common.skip('no client cert engine'); const assert = require('assert'); const https = require('https'); const agentKey = fs.readFileSync(fixture.path('/keys/agent1-key.pem')); const agentCert = fs.readFileSync(fixture.path('/keys/agent1-cert.pem')); const agentCa = fs.readFileSync(fixture.path('/keys/ca1-cert.pem')); const serverOptions = { key: agentKey, cert: agentCert, ca: agentCa, requestCert: true, rejectUnauthorized: true }; const server = https.createServer(serverOptions, common.mustCall((req, res) => { res.writeHead(200); res.end('hello world'); })).listen(0, common.localhostIPv4, common.mustCall(() => { const clientOptions = { method: 'GET', host: common.localhostIPv4, port: server.address().port, path: '/test', clientCertEngine: engine, // `engine` will provide key+cert rejectUnauthorized: false, // Prevent failing on self-signed certificates headers: {} }; const req = https.request(clientOptions, common.mustCall((response) => { let body = ''; response.setEncoding('utf8'); response.on('data', (chunk) => { body += chunk; }); response.on('end', common.mustCall(() => { assert.strictEqual(body, 'hello world'); server.close(); })); })); req.end(); }));