I am trying to send a package from one server to another but i need to be sure that the sender is the "real" one and the package cannot be intercepted, How can i do this using SSL with NodeJS or some other way.
This is what I've done:
Server code:
server = tls.createServer(function(c) {
console.log('server connected',
c.authorized ? 'authorized' : 'unauthorized');
});
Client code:
var tls = require('tls');
var fs = require('fs');
var options = {
key : fs.readFileSync('server.key'),
cert : fs.readFileSync('server.crt')
};
var client = tls.connect(9838, options, function () {
console.log(client.authorized ? 'Authorized' : 'Not authorized');
});
and this errors out:
Error: 101057795:error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv handshake failure:openssl\ssl\s23_clnt.c:769: