Skip to content

Instantly share code, notes, and snippets.

@heapwolf heapwolf/50.js
Created Aug 7, 2012

Embed
What would you like to do?
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
You can’t perform that action at this time.