Tag Archives: node.js

Encrypt string in PHP and decrypt in Node.js

Questions: I am sending data through insecure connection between Apache and Node.js servers. I need to encrypt data in PHP and decrypt in Node.js. I’ve spent 2 days trying to get it to work, however I only managed to get message signing to work, no encryption. I tried passing AES128-CBC, AES256-CBC, DES, AES128, AES256 as… Read More »

AES encrypt in Node.js Decrypt in PHP. Fail.

Questions: In node.js, I use the build in function to encrypt data like that: var text = “Yes”; var password = “123456”; var encrypt = crypto.createCipher(‘aes-256-cbc’, password); var encryptOutput1 = encrypt.update(text, ‘base64’, ‘base64’); var encryptOutput2 = encrypt.final(‘base64’); var encryptedText = encryptOutput1 + encryptOutput2; the output (encrypted text) is: OnNINwXf6U8XmlgKJj48iA== Then I use decrypt it in… Read More »

Sending messages from PHP to Node.js

Questions: How to send messages from php to node.js? I have a linux server running php and node.js. When a user completes a transaction (via php), I’d like send a message from php to node.js. Node will then update the client via a socket connection. What’s a good way to send a small amount of… Read More »

npm excel-export (Node.js) corrupt files

Questions: I need to export some data from my node.js application into an excel spreadsheet (for qa purposes). I looked online and found the convenient npm module called “excel-export”. I installed it and followed the example that can be found here (https://www.npmjs.org/package/excel-export). It works fine, but I have one issue. When I open the file… Read More »

How to style xlsx files in node.js

Questions: I’m exporting a file generated by xlsx.js with my node.js express application server. I’d like to know how to put bold in first line, set auto width and (eventually) colour borders. For example, the first line of the worksheet looks like: var data = [[ {value:”EXTREMELY LONG TITLE 1″, bold: 1, autoWidth:true}, {value:”TITLE2″}, {value:”TITLE3″}… Read More »

Cannot connect to SQL Server with Node.js and Tedious

Questions: When I try to use Node.js and Tedioius to connect to a local SQL Server instance I get this error: { [ConnectionError: Failed to connect to XXXXX:1433 – connect ECONNREFUSED] name: ‘ConnectionError’, message: ‘Failed to connect to XXXXX:1433 – connect ECONNREFUSED’, code: ‘ESOCKET’ } Here is my connection object: var config = { userName:… Read More »

Node-SQL with node.js and MS integrated Security

Questions: I have some sample code that is successfully connecting to SQL Server using Microsoft SQL Server user name and password. But I was wondering if there is a way to use integrated security with this script. Basically which means use the logged in user’s credentials without supplying a password in the script. var sql… Read More »

Uexpected token 'tag' jade node.js

Questions: I get: Unexpected token ‘tag’ expected ‘text’, ‘code’, ‘:’, ‘newline’ or ‘eos’ because of this code: label(for=”polaziste”)Polaziste in #main form(action=”/raspored” method=post) label(for=”polaziste”)Polaziste input(type=”list” id=”polaziste”) datalist#polaziste for pol,i in popis option(value = pol) Why? 🙂 Answers: Try this: label(for=”polaziste”) Polaziste Notice space before Polaziste. Questions: Answers: For others visiting, this error also (expectedly) appears when… Read More »