How to use the tls.createSecurePair function in tls

To help you get started, we’ve selected a few tls examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github andris9 / rai / test / rai.js View on Github external
var client = netlib.connect(PORT_NUMBER, function(){
                var sslcontext = crypto.createCredentials();
                var pair = tlslib.createSecurePair(sslcontext, false);
                
                pair.encrypted.pipe(client);
                client.pipe(pair.encrypted);
                pair.fd = client.fd;
                
                pair.on("secure", function(){
                    pair.cleartext.on("data", function(chunk){
                        test.equal(chunk.toString(), "TEST\r\n");
                        pair.cleartext.end();
                    });
                });
            });
github andris9 / rai / test / rai.js View on Github external
var client = netlib.connect(PORT_NUMBER, function(){
                var sslcontext = crypto.createCredentials();
                var pair = tlslib.createSecurePair(sslcontext, false);
                
                pair.encrypted.pipe(client);
                client.pipe(pair.encrypted);
                pair.fd = client.fd;
                
                pair.on("secure", function(){
                    test.ok(1, "secure connection");
                });
            });
github graalvm / graaljs / test / parallel / test-tls-legacy-onselect.js View on Github external
const server = net.Server(common.mustCall(function(raw) {
  const pair = tls.createSecurePair(null, true, false, false);
  pair.on('error', function() {});
  pair.ssl.setSNICallback(common.mustCall(function() {
    raw.destroy();
    server.close();
  }));
  require('_tls_legacy').pipe(pair, raw);
})).listen(0, function() {
  tls.connect({
github graalvm / graaljs / graal-nodejs / benchmark / tls / secure-pair.js View on Github external
function securePair(conn, client) {
    const serverCtx = tls.createSecureContext(options);
    const serverPair = tls.createSecurePair(serverCtx, true, true, false);
    conn.pipe(serverPair.encrypted);
    serverPair.encrypted.pipe(conn);
    serverPair.on('error', (error) => {
      throw new Error(`Pair error: ${error}`);
    });
    serverPair.cleartext.pipe(client);
  }

tls

[![Build Status](https://secure.travis-ci.org/rolandpoulter/js-utils.png)](http://travis-ci.org/rolandpoulter/js-utils)

Unknown
Latest version published 12 years ago

Package Health Score

41 / 100
Full package analysis