Skip to content

Instantly share code, notes, and snippets.

@heapwolf
Created August 7, 2012 06:42
Show Gist options
  • Save heapwolf/3282430 to your computer and use it in GitHub Desktop.
Save heapwolf/3282430 to your computer and use it in GitHub Desktop.
tls/authorized
var tls = require('tls'),
fs = require('fs');
var options = {
key: fs.readFileSync('private-key.pem'),
cert: fs.readFileSync('public-cert.pem')
};
var conn = tls.connect(8000, options, function() {
if (conn.authorized) {
console.log("Connection authorized by a Certificate Authority.");
} else {
console.log("Connection not authorized: " + conn.authorizationError)
}
});
conn.on("data", function (data) {
console.log(data.toString());
conn.end();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment