+ 1

I'am trying to encrypt the password that is sent through ajax in json format. The encrytion logic is in my server.js. How do I p

server.js: app.post('/mylink',function(request,reply){ var data = JSON.stringify(request.body.jsonblob); var pwd = request.body.jsonblob.Password; var cipher = crypto.createCipher(algorithm,password) var crypted = cipher.update(pan,'utf8','hex') crypted += cipher.final('hex'); console.log("crypted"+crypted); reply.send(crypted); }); ajax call in my html page: var json_data = JSON.stringify({ "jsonblob" : { "Password": password } }); $.ajax({ url:"/telemarketer", type: "post", dataType: "json", contentType: "application/json", data: json_data, success:function(response){ if(response.status === "success") { console.log(crypted); } }, error: function(jqXHR, textStatus, errorThtrown) { console.log("error " +textStatus); } });

26th Jan 2018, 12:43 PM
Bhavani Sankar
Bhavani Sankar - avatar
1 Respuesta
+ 1
How do I pass the encrypted response from server.js. Iam able to encrypt but I'am stuck on passing this encrypted response
26th Jan 2018, 12:43 PM
Bhavani Sankar
Bhavani Sankar - avatar