kimus / leximail

LexiMail is a Open Source and cross-platform e-mail desktop application.
http://leximail.org/
Other
142 stars 29 forks source link

Encrypt User information #7

Open Que20 opened 10 years ago

Que20 commented 10 years ago

Hi, Just wanted to know : how do you store the user's information, in leximail ? I understand that you use node.js, so theoretically, the user's password is stored in one of the js files in clear (I suppose that the password must be clearly send to the server...). I'm asking that because I'm also developing a node.js mail client ^^ Thank you in advance.

kimus commented 10 years ago

Hi, today the user and password is stored in a .json file not encrypted. But you could store it in a encrypted way if you like. Eventually I will use some kind of user generated cert for encryption and decryption but it's not yet in my schedule.

But you can use crypto module in something like:

var crypto = require('crypto');

var algorithm = 'aes256'; // or any other algorithm supported by OpenSSL
var key = 'someUserKey';
var password = 'somepassword';

var cipher = crypto.createCipher(algorithm, key);  
var encrypted = cipher.update(password, 'utf8', 'hex') + cipher.final('hex');

var decipher = crypto.createDecipher(algorithm, key);
var decrypted = decipher.update(encrypted, 'hex', 'utf8') + decipher.final('utf8');
Que20 commented 10 years ago

Thank you. I'll do that :+1: