When I try to create encrypted text from text using crypto (Node.JS), I get the message "Error: must give an encryption key."
The code is as follows.
var cipher = crypto.createCipher('aes-256-cbc', userId);
var crypted = cipher.update(password, 'utf8', 'hex');
crypted += cipher.final('hex');
return crypted;
But when I test it with mocha, it gives no errors. In both cases, the inputs are given correctly. Can someone help me?
source
share