Skip to content
Snippets Groups Projects
Commit d0a40f2a authored by Adrien Béraud's avatar Adrien Béraud
Browse files

getPasswordKey: try to decrypt to check if password is valid

Change-Id: I74f9ec6e69d2de0da7a589e013b9c3f3f29382ce
parent bac3ca1f
No related branches found
No related tags found
No related merge requests found
......@@ -657,7 +657,10 @@ ArchiveAccountManager::getPasswordKey(const std::string& password)
{
try {
auto data = dhtnet::fileutils::loadFile(fileutils::getFullPath(path_, archivePath_));
return dht::crypto::aesGetKey(data, password);
// Try to decrypt to check if password is valid
auto key = dht::crypto::aesGetKey(data, password);
auto decrypted = dht::crypto::aesDecrypt(dht::crypto::aesGetEncrypted(data), key);
return key;
} catch (const std::exception& e) {
JAMI_ERR("Error loading archive: %s", e.what());
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment