Make error case with unverified master key more descriptive

This commit is contained in:
Nicolas Werner 2021-09-03 15:08:16 +02:00
parent bf9601018d
commit 99f3296a64
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9

View file

@ -4442,14 +4442,20 @@ Cache::verificationStatus_(const std::string &user_id, lmdb::txn &txn)
// Update verified devices count to count without cross-signing // Update verified devices count to count without cross-signing
updateUnverifiedDevices(theirKeys->device_keys); updateUnverifiedDevices(theirKeys->device_keys);
if (!mtx::crypto::ed25519_verify_signature( {
auto &mk = ourKeys->master_keys;
std::string dev_id = "ed25519:" + http::client()->device_id();
if (!mk.signatures.count(local_user) ||
!mk.signatures.at(local_user).count(dev_id) ||
!mtx::crypto::ed25519_verify_signature(
olm::client()->identity_keys().ed25519, olm::client()->identity_keys().ed25519,
json(ourKeys->master_keys), json(mk),
ourKeys->master_keys.signatures.at(local_user) mk.signatures.at(local_user).at(dev_id))) {
.at("ed25519:" + http::client()->device_id()))) { nhlog::crypto()->debug("We have not verified our own master key");
verification_storage.status[user_id] = status; verification_storage.status[user_id] = status;
return status; return status;
} }
}
auto master_keys = ourKeys->master_keys.keys; auto master_keys = ourKeys->master_keys.keys;