Last active
December 21, 2015 17:39
-
-
Save theosp/6342189 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var tls = require('tls'); | |
var fs = require('fs'); | |
var options = { | |
key: fs.readFileSync('test-key.pem'), | |
cert: fs.readFileSync('test-cert.pem'), | |
// This is necessary only if using the client certificate authentication. | |
requestCert: true, | |
// This is necessary only if the client uses the self-signed certificate. | |
//ca: [ fs.readFileSync('client-cert.pem') ] | |
}; | |
var server = tls.createServer(options, function(cleartextStream) { | |
cleartextStream.on('data', function(data) { | |
console.log(data.toString("utf-8")); | |
}); | |
}); | |
server.listen(8000, function() { | |
console.log('server bound'); | |
}); | |
// $ node % | |
// | |
// openssl s_client -connect 127.0.0.1:8000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment