utf8 encode params for key derivation

This commit is contained in:
Kyle Spearrin 2017-02-15 19:02:55 -05:00
parent a9be800f9e
commit 8a2510bcb1
2 changed files with 4 additions and 3 deletions

View File

@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "__MSG_extName__",
"short_name": "__MSG_appName__",
"version": "1.9.2",
"version": "1.9.3",
"description": "__MSG_extDesc__",
"default_locale": "en",
"author": "8bit Solutions LLC",

View File

@ -207,7 +207,8 @@ function initCryptoService() {
};
CryptoService.prototype.makeKey = function (password, salt, b64) {
var key = forge.pbkdf2(password, salt, 5000, 256 / 8, 'sha256');
var key = forge.pbkdf2(forge.util.encodeUtf8(password), forge.util.encodeUtf8(salt),
5000, 256 / 8, 'sha256');
if (b64 && b64 === true) {
return forge.util.encode64(key);
@ -226,7 +227,7 @@ function initCryptoService() {
throw 'Invalid parameters.';
}
var hashBits = forge.pbkdf2(key, password, 1, 256 / 8, 'sha256');
var hashBits = forge.pbkdf2(key, forge.util.encodeUtf8(password), 1, 256 / 8, 'sha256');
callback(forge.util.encode64(hashBits));
});
};