diff options
| author | Melvin Keskin <melvo@olomono.de> | 2021-09-17 01:38:29 +0200 |
|---|---|---|
| committer | Linus Jahn <lnj@kaidan.im> | 2021-09-25 15:51:01 +0200 |
| commit | effe99a4c0006cf159ab7342cc27b13c2d1cf2e6 (patch) | |
| tree | d04778225074c7c7788e4b0e29d71d2ec245da85 /src | |
| parent | d071f033c8298fb159eb8f2fb24462e4d0371dc4 (diff) | |
| download | qxmpp-effe99a4c0006cf159ab7342cc27b13c2d1cf2e6.tar.gz | |
AtmManager: Use security policies
Diffstat (limited to 'src')
| -rw-r--r-- | src/client/QXmppAtmManager.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/client/QXmppAtmManager.cpp b/src/client/QXmppAtmManager.cpp index df3b1350..fb14aec0 100644 --- a/src/client/QXmppAtmManager.cpp +++ b/src/client/QXmppAtmManager.cpp @@ -52,6 +52,13 @@ using namespace QXmpp::Private; /// QXmppTrustStorage *trustStorage = new QXmppTrustMemoryStorage; /// \endcode /// +/// You can set a security policy used by ATM via the trust manager. +/// Is is recommended to apply TOAKAFA for good security and usability when +/// using \xep{0384, OMEMO Encryption}: +/// \code +/// trustStorage->setSecurityPolicy("urn:xmpp:omemo:1", QXmppTrustStorage::Toakafa); +/// \endcode +/// /// Afterwards, this manager must be added with the storage: /// \code /// QXmppAtmManager *manager = new QXmppAtmManager(trustStorage); @@ -402,13 +409,20 @@ QFuture<void> QXmppAtmManager::authenticate(const QString &encryption, const QMu } else { auto future = m_trustStorage->setTrustLevel(encryption, keyIds, QXmppTrustStorage::Authenticated); await(future, this, [=]() { - auto future = distrustAutomaticallyTrustedKeys(encryption, keyIds.uniqueKeys()); - await(future, this, [=]() { + if (m_trustStorage->securityPolicy(encryption) == QXmppTrustStorage::Toakafa) { + auto future = distrustAutomaticallyTrustedKeys(encryption, keyIds.uniqueKeys()); + await(future, this, [=]() { + auto future = makePostponedTrustDecisions(encryption, keyIds.values()); + await(future, this, [=]() { + interface->reportFinished(); + }); + }); + } else { auto future = makePostponedTrustDecisions(encryption, keyIds.values()); await(future, this, [=]() { interface->reportFinished(); }); - }); + } }); } |
