Skip to content

Instantly share code, notes, and snippets.

@andris9
Created August 8, 2011 19:51
Show Gist options
  • Save andris9/1132553 to your computer and use it in GitHub Desktop.
Save andris9/1132553 to your computer and use it in GitHub Desktop.
Node.js + ID kaart
var https = require('https'),
fs = require('fs'),
utillib = require('util');
var options = {
key: fs.readFileSync('private_key.pem'),
cert: fs.readFileSync('certificate.pem'),
ca: [
fs.readFileSync('ESTEID-SK 2007.PEM.cer'),
fs.readFileSync('ESTEID-SK.PEM.cer'),
fs.readFileSync('JUUR-SK.PEM.cer')
],
requestCert: true,
rejectUnauthorized: true
};
https.createServer(options, function (req, res) {
res.setHeader("Content-type","text/plain; charset=utf-8");
res.writeHead(200);
res.end(utillib.inspect(req.connection.getPeerCertificate()));
}).listen(443);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment