diff --git a/src/jamidht/archive_account_manager.cpp b/src/jamidht/archive_account_manager.cpp index 66f28c41f01ff68cda8eb2bdf7770e1fa7570194..b5499846104d53c5926db9cae08912743784e766 100644 --- a/src/jamidht/archive_account_manager.cpp +++ b/src/jamidht/archive_account_manager.cpp @@ -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()); }