From e4970a79535dd5cfff2d010049cf39b644a87850 Mon Sep 17 00:00:00 2001 From: Melvin Keskin Date: Thu, 7 Oct 2021 16:35:50 +0200 Subject: Update to OMEMO 0.8, TM 0.6 and ATM 0.4 * OMEMO has namespace 'urn:xmpp:omemo:2' and uses SCE 0.4 now * TM has namespace 'urn:xmpp:tm:1' and uses Base64 for key identifiers * ATM uses Base64 for key identifiers --- src/client/QXmppTrustMemoryStorage.cpp | 38 +++++++++++++++++----------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'src/client/QXmppTrustMemoryStorage.cpp') diff --git a/src/client/QXmppTrustMemoryStorage.cpp b/src/client/QXmppTrustMemoryStorage.cpp index 1e2b5904..2a188a77 100644 --- a/src/client/QXmppTrustMemoryStorage.cpp +++ b/src/client/QXmppTrustMemoryStorage.cpp @@ -41,16 +41,16 @@ using namespace QXmpp::Private; struct ProcessedKey { - QString id; + QByteArray id; QString ownerJid; QXmppTrustStorage::TrustLevel trustLevel; }; struct UnprocessedKey { - QString id; + QByteArray id; QString ownerJid; - QString senderKeyId; + QByteArray senderKeyId; bool trust; }; @@ -61,7 +61,7 @@ public: QMap securityPolicies; // encryption protocols mapped to keys of this client instance - QMap ownKeys; + QMap ownKeys; // encryption protocols mapped to keys with specified trust levels QMultiHash processedKeys; @@ -100,7 +100,7 @@ QFuture QXmppTrustMemoryStorage::securityPoli return makeReadyFuture(std::move(d->securityPolicies.value(encryption))); } -QFuture QXmppTrustMemoryStorage::addOwnKey(const QString &encryption, const QString &keyId) +QFuture QXmppTrustMemoryStorage::addOwnKey(const QString &encryption, const QByteArray &keyId) { d->ownKeys.insert(encryption, keyId); return makeReadyFuture(); @@ -112,13 +112,13 @@ QFuture QXmppTrustMemoryStorage::removeOwnKey(const QString &encryption) return makeReadyFuture(); } -QFuture QXmppTrustMemoryStorage::ownKey(const QString &encryption) +QFuture QXmppTrustMemoryStorage::ownKey(const QString &encryption) { auto key = d->ownKeys[encryption]; return makeReadyFuture(std::move(key)); } -QFuture QXmppTrustMemoryStorage::addKeys(const QString &encryption, const QString &keyOwnerJid, const QList &keyIds, const QXmppTrustStorage::TrustLevel trustLevel) +QFuture QXmppTrustMemoryStorage::addKeys(const QString &encryption, const QString &keyOwnerJid, const QList &keyIds, const QXmppTrustStorage::TrustLevel trustLevel) { for (const auto &keyId : keyIds) { ProcessedKey key; @@ -131,7 +131,7 @@ QFuture QXmppTrustMemoryStorage::addKeys(const QString &encryption, const return makeReadyFuture(); } -QFuture QXmppTrustMemoryStorage::removeKeys(const QString &encryption, const QList &keyIds) +QFuture QXmppTrustMemoryStorage::removeKeys(const QString &encryption, const QList &keyIds) { if (encryption.isEmpty()) { d->processedKeys.clear(); @@ -151,9 +151,9 @@ QFuture QXmppTrustMemoryStorage::removeKeys(const QString &encryption, con return makeReadyFuture(); } -QFuture>> QXmppTrustMemoryStorage::keys(const QString &encryption, const TrustLevels trustLevels) +QFuture>> QXmppTrustMemoryStorage::keys(const QString &encryption, const TrustLevels trustLevels) { - QHash> keys; + QHash> keys; const auto processedKeys = d->processedKeys.values(encryption); for (const auto &key : processedKeys) { @@ -166,7 +166,7 @@ QFuture>> QXmp return makeReadyFuture(std::move(keys)); } -QFuture QXmppTrustMemoryStorage::setTrustLevel(const QString &encryption, const QMultiHash &keyIds, const TrustLevel trustLevel) +QFuture QXmppTrustMemoryStorage::setTrustLevel(const QString &encryption, const QMultiHash &keyIds, const TrustLevel trustLevel) { for (auto itr = keyIds.constBegin(); itr != keyIds.constEnd(); ++itr) { const auto keyOwnerJid = itr.key(); @@ -214,7 +214,7 @@ QFuture QXmppTrustMemoryStorage::setTrustLevel(const QString &encryption, return makeReadyFuture(); } -QFuture QXmppTrustMemoryStorage::trustLevel(const QString &encryption, const QString &keyId) +QFuture QXmppTrustMemoryStorage::trustLevel(const QString &encryption, const QByteArray &keyId) { const auto processedKeys = d->processedKeys.values(encryption); for (const auto &key : processedKeys) { @@ -226,9 +226,9 @@ QFuture QXmppTrustMemoryStorage::trustLevel(const return makeReadyFuture(std::move(TrustLevel::AutomaticallyDistrusted)); } -QFuture QXmppTrustMemoryStorage::addKeysForPostponedTrustDecisions(const QString &encryption, const QString &senderKeyId, const QList &keyOwners) +QFuture QXmppTrustMemoryStorage::addKeysForPostponedTrustDecisions(const QString &encryption, const QByteArray &senderKeyId, const QList &keyOwners) { - const auto addKeys = [&](const QXmppTrustMessageKeyOwner &keyOwner, bool trust, const QList &keyIds) { + const auto addKeys = [&](const QXmppTrustMessageKeyOwner &keyOwner, bool trust, const QList &keyIds) { for (const auto &keyId : keyIds) { auto isKeyFound = false; @@ -265,13 +265,13 @@ QFuture QXmppTrustMemoryStorage::addKeysForPostponedTrustDecisions(const Q return makeReadyFuture(); } -QFuture QXmppTrustMemoryStorage::removeKeysForPostponedTrustDecisions(const QString &encryption, const QList &keyIdsForAuthentication, const QList &keyIdsForDistrusting) +QFuture QXmppTrustMemoryStorage::removeKeysForPostponedTrustDecisions(const QString &encryption, const QList &keyIdsForAuthentication, const QList &keyIdsForDistrusting) { for (auto itr = d->unprocessedKeys.find(encryption); itr != d->unprocessedKeys.end() && itr.key() == encryption;) { const auto &key = itr.value(); if ((key.trust && keyIdsForAuthentication.contains(key.id)) || - (!key.trust && keyIdsForDistrusting.contains(key.id))) { + (!key.trust && keyIdsForDistrusting.contains(key.id))) { itr = d->unprocessedKeys.erase(itr); } else { ++itr; @@ -280,7 +280,7 @@ QFuture QXmppTrustMemoryStorage::removeKeysForPostponedTrustDecisions(cons return makeReadyFuture(); } -QFuture QXmppTrustMemoryStorage::removeKeysForPostponedTrustDecisions(const QString &encryption, const QList &senderKeyIds) +QFuture QXmppTrustMemoryStorage::removeKeysForPostponedTrustDecisions(const QString &encryption, const QList &senderKeyIds) { if (encryption.isEmpty()) { d->unprocessedKeys.clear(); @@ -300,9 +300,9 @@ QFuture QXmppTrustMemoryStorage::removeKeysForPostponedTrustDecisions(cons return makeReadyFuture(); } -QFuture>> QXmppTrustMemoryStorage::keysForPostponedTrustDecisions(const QString &encryption, const QList &senderKeyIds) +QFuture>> QXmppTrustMemoryStorage::keysForPostponedTrustDecisions(const QString &encryption, const QList &senderKeyIds) { - QHash> keys; + QHash> keys; const auto unprocessedKeys = d->unprocessedKeys.values(encryption); for (const auto &key : unprocessedKeys) { -- cgit v1.2.3