You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Solution usage of a random salt :
this.encrypt = function(message, password) {
var salt = forge.random.getBytesSync(128);
var key = forge.pkcs5.pbkdf2(password, salt, 4, 16);
var iv = forge.random.getBytesSync(16);
var cipher = forge.cipher.createCipher('AES-CBC', key);
cipher.start({iv: iv});
cipher.update(forge.util.createBuffer(message));
cipher.finish();
var cipherText = forge.util.encode64(cipher.output.getBytes());
return {cipher_text: cipherText, salt: forge.util.encode64(salt), iv: forge.util.encode64(iv)};
}
Application uses static key when performing encryption which makes it easier for an attacker to conduct brute force password guessing.
Source
https://auth0.com/blog/adding-salt-to-hashing-a-better-way-to-store-passwords/
https://www.thepolyglotdeveloper.com/2014/10/implement-aes-strength-encryption-javascript/
https://cwe.mitre.org/data/definitions/329.html
The text was updated successfully, but these errors were encountered: