diff options
| author | Melvin Keskin <melvo@olomono.de> | 2021-10-07 16:35:50 +0200 |
|---|---|---|
| committer | Linus Jahn <lnj@kaidan.im> | 2021-10-10 20:12:46 +0200 |
| commit | e4970a79535dd5cfff2d010049cf39b644a87850 (patch) | |
| tree | f274962b1063012ce0482e9e7328070bec69fba0 /tests | |
| parent | e1836d08b2f659d2ac5c98280e08d96c8df60d88 (diff) | |
| download | qxmpp-e4970a79535dd5cfff2d010049cf39b644a87850.tar.gz | |
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
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/qxmppatmmanager/tst_qxmppatmmanager.cpp | 592 | ||||
| -rw-r--r-- | tests/qxmppmessage/tst_qxmppmessage.cpp | 22 | ||||
| -rw-r--r-- | tests/qxmppomemodata/tst_qxmppomemodata.cpp | 28 | ||||
| -rw-r--r-- | tests/qxmpptrustmemorystorage/tst_qxmpptrustmemorystorage.cpp | 194 | ||||
| -rw-r--r-- | tests/qxmpptrustmessages/tst_qxmpptrustmessages.cpp | 60 |
5 files changed, 448 insertions, 448 deletions
diff --git a/tests/qxmppatmmanager/tst_qxmppatmmanager.cpp b/tests/qxmppatmmanager/tst_qxmppatmmanager.cpp index db39c2f8..c913b2bc 100644 --- a/tests/qxmppatmmanager/tst_qxmppatmmanager.cpp +++ b/tests/qxmppatmmanager/tst_qxmppatmmanager.cpp @@ -99,17 +99,17 @@ void tst_QXmppAtmManager::testSendTrustMessage() { QXmppTrustMessageKeyOwner keyOwnerAlice; keyOwnerAlice.setJid(QStringLiteral("alice@example.org")); - keyOwnerAlice.setTrustedKeys({ QStringLiteral("d11715b069372e7a4416caaaced4f30200838155e57dad37a5a4aa24538e58e5"), - QStringLiteral("b589ffc1c20ec414a85b85b551f3ebff381b2e2a412b62ac15f0bb1756f3badd") }); - keyOwnerAlice.setDistrustedKeys({ QStringLiteral("788a40d0eae5a40409d4687a36d3106bbe361971aec0245598571e7b629edc6b"), - QStringLiteral("b6c21e111bd4f9ed06ee0485cb302bf1238e90b89986a04061e48d49ddbe95cb") }); + keyOwnerAlice.setTrustedKeys({ QByteArray::fromBase64(QByteArrayLiteral("0RcVsGk3LnpEFsqqztTzAgCDgVXlfa03paSqJFOOWOU=")), + QByteArray::fromBase64(QByteArrayLiteral("tYn/wcIOxBSoW4W1UfPr/zgbLipBK2KsFfC7F1bzut0=")) }); + keyOwnerAlice.setDistrustedKeys({ QByteArray::fromBase64(QByteArrayLiteral("eIpA0OrlpAQJ1Gh6NtMQa742GXGuwCRVmFcee2Ke3Gs=")), + QByteArray::fromBase64(QByteArrayLiteral("tsIeERvU+e0G7gSFyzAr8SOOkLiZhqBAYeSNSd2+lcs=")) }); QXmppTrustMessageKeyOwner keyOwnerBob; keyOwnerBob.setJid(QStringLiteral("bob@example.com")); - keyOwnerBob.setTrustedKeys({ QStringLiteral("d11715b069372e7a4416caaaced4f30200838155e57dad37a5a4aa24538e58e5"), - QStringLiteral("b589ffc1c20ec414a85b85b551f3ebff381b2e2a412b62ac15f0bb1756f3badd") }); - keyOwnerBob.setDistrustedKeys({ QStringLiteral("788a40d0eae5a40409d4687a36d3106bbe361971aec0245598571e7b629edc6b"), - QStringLiteral("b6c21e111bd4f9ed06ee0485cb302bf1238e90b89986a04061e48d49ddbe95cb") }); + keyOwnerBob.setTrustedKeys({ QByteArray::fromBase64(QByteArrayLiteral("0RcVsGk3LnpEFsqqztTzAgCDgVXlfa03paSqJFOOWOU=")), + QByteArray::fromBase64(QByteArrayLiteral("tYn/wcIOxBSoW4W1UfPr/zgbLipBK2KsFfC7F1bzut0=")) }); + keyOwnerBob.setDistrustedKeys({ QByteArray::fromBase64(QByteArrayLiteral("eIpA0OrlpAQJ1Gh6NtMQa742GXGuwCRVmFcee2Ke3Gs=")), + QByteArray::fromBase64(QByteArrayLiteral("tsIeERvU+e0G7gSFyzAr8SOOkLiZhqBAYeSNSd2+lcs=")) }); bool isMessageSent = false; const QObject context; @@ -157,56 +157,56 @@ void tst_QXmppAtmManager::testMakePostponedTrustDecisions() QXmppTrustMessageKeyOwner keyOwnerAlice; keyOwnerAlice.setJid(QStringLiteral("alice@example.org")); - keyOwnerAlice.setTrustedKeys({ QStringLiteral("d11715b069372e7a4416caaaced4f30200838155e57dad37a5a4aa24538e58e5"), - QStringLiteral("b589ffc1c20ec414a85b85b551f3ebff381b2e2a412b62ac15f0bb1756f3badd") }); - keyOwnerAlice.setDistrustedKeys({ QStringLiteral("788a40d0eae5a40409d4687a36d3106bbe361971aec0245598571e7b629edc6b"), - QStringLiteral("b6c21e111bd4f9ed06ee0485cb302bf1238e90b89986a04061e48d49ddbe95cb") }); + keyOwnerAlice.setTrustedKeys({ QByteArray::fromBase64(QByteArrayLiteral("0RcVsGk3LnpEFsqqztTzAgCDgVXlfa03paSqJFOOWOU=")), + QByteArray::fromBase64(QByteArrayLiteral("tYn/wcIOxBSoW4W1UfPr/zgbLipBK2KsFfC7F1bzut0=")) }); + keyOwnerAlice.setDistrustedKeys({ QByteArray::fromBase64(QByteArrayLiteral("eIpA0OrlpAQJ1Gh6NtMQa742GXGuwCRVmFcee2Ke3Gs=")), + QByteArray::fromBase64(QByteArrayLiteral("tsIeERvU+e0G7gSFyzAr8SOOkLiZhqBAYeSNSd2+lcs=")) }); m_trustStorage->addKeysForPostponedTrustDecisions(ns_omemo, - QStringLiteral("c33b0b7420ed386508a0b90701037715db7ce862e3134ef5e85d269dc8bfa556"), + QByteArray::fromBase64(QByteArrayLiteral("wzsLdCDtOGUIoLkHAQN3Fdt86GLjE0716F0mnci/pVY=")), { keyOwnerAlice }); QXmppTrustMessageKeyOwner keyOwnerBob; keyOwnerBob.setJid(QStringLiteral("bob@example.com")); - keyOwnerBob.setTrustedKeys({ QStringLiteral("cfa3155773071826642a06a99e0f214070a1e7b8999a5710a209939accb7fcac"), - QStringLiteral("ddba9d09f8506a5b0ea772dcac556e702401e29451582ca805357c28cfe83a16") }); - keyOwnerBob.setDistrustedKeys({ QStringLiteral("6da21f2f14214ebb58e49999bec2da53531e9c0535c3065c23507b33259ad08b"), - QStringLiteral("537f949e44e9d7682eb0a6f35b037496a0cb10f6f609d3313f86d8f39abda710") }); + keyOwnerBob.setTrustedKeys({ QByteArray::fromBase64(QByteArrayLiteral("z6MVV3MHGCZkKgapng8hQHCh57iZmlcQogmTmsy3/Kw=")), + QByteArray::fromBase64(QByteArrayLiteral("3bqdCfhQalsOp3LcrFVucCQB4pRRWCyoBTV8KM/oOhY=")) }); + keyOwnerBob.setDistrustedKeys({ QByteArray::fromBase64(QByteArrayLiteral("baIfLxQhTrtY5JmZvsLaU1MenAU1wwZcI1B7MyWa0Is=")), + QByteArray::fromBase64(QByteArrayLiteral("U3+UnkTp12gusKbzWwN0lqDLEPb2CdMxP4bY85q9pxA=")) }); m_trustStorage->addKeysForPostponedTrustDecisions(ns_omemo, - QStringLiteral("705dcb8b775d109cedf6bc3fd5e026312df5fc6fc6e194e97fef706c4b39d470"), + QByteArray::fromBase64(QByteArrayLiteral("cF3Li3ddEJzt9rw/1eAmMS31/G/G4ZTpf+9wbEs51HA=")), { keyOwnerBob }); QXmppTrustMessageKeyOwner keyOwnerCarol; keyOwnerCarol.setJid(QStringLiteral("carol@example.net")); - keyOwnerCarol.setTrustedKeys({ QStringLiteral("3b145a90018ab57cae07db1d1f78090dad57cec575f0100c7157ff9b5bc3dd78") }); - keyOwnerCarol.setDistrustedKeys({ QStringLiteral("4ca6481a110c73e8320a0ac91320a77fb3adba804584eba939685dc0585f6419") }); + keyOwnerCarol.setTrustedKeys({ QByteArray::fromBase64(QByteArrayLiteral("OxRakAGKtXyuB9sdH3gJDa1XzsV18BAMcVf/m1vD3Xg=")) }); + keyOwnerCarol.setDistrustedKeys({ QByteArray::fromBase64(QByteArrayLiteral("TKZIGhEMc+gyCgrJEyCnf7OtuoBFhOupOWhdwFhfZBk=")) }); m_trustStorage->addKeysForPostponedTrustDecisions(ns_omemo, - QStringLiteral("6609344b11856de4a00f0fd96a7cdafe3ccdaebeadd4b5348d85f677b45178a6"), + QByteArray::fromBase64(QByteArrayLiteral("Zgk0SxGFbeSgDw/Zanza/jzNrr6t1LU0jYX2d7RReKY=")), { keyOwnerCarol }); auto futureVoid = m_manager->makePostponedTrustDecisions(ns_omemo, - { QStringLiteral("c33b0b7420ed386508a0b90701037715db7ce862e3134ef5e85d269dc8bfa556"), - QStringLiteral("705dcb8b775d109cedf6bc3fd5e026312df5fc6fc6e194e97fef706c4b39d470") }); + { QByteArray::fromBase64(QByteArrayLiteral("wzsLdCDtOGUIoLkHAQN3Fdt86GLjE0716F0mnci/pVY=")), + QByteArray::fromBase64(QByteArrayLiteral("cF3Li3ddEJzt9rw/1eAmMS31/G/G4ZTpf+9wbEs51HA=")) }); while (!futureVoid.isFinished()) { QCoreApplication::processEvents(); } auto futurePotsponed = m_trustStorage->keysForPostponedTrustDecisions(ns_omemo, - { QStringLiteral("c33b0b7420ed386508a0b90701037715db7ce862e3134ef5e85d269dc8bfa556"), - QStringLiteral("705dcb8b775d109cedf6bc3fd5e026312df5fc6fc6e194e97fef706c4b39d470") }); + { QByteArray::fromBase64(QByteArrayLiteral("wzsLdCDtOGUIoLkHAQN3Fdt86GLjE0716F0mnci/pVY=")), + QByteArray::fromBase64(QByteArrayLiteral("cF3Li3ddEJzt9rw/1eAmMS31/G/G4ZTpf+9wbEs51HA=")) }); QVERIFY(futurePotsponed.isFinished()); auto resultPostponed = futurePotsponed.result(); QVERIFY(resultPostponed.isEmpty()); - QMultiHash<QString, QString> trustedKeys = { { QStringLiteral("carol@example.net"), - QStringLiteral("3b145a90018ab57cae07db1d1f78090dad57cec575f0100c7157ff9b5bc3dd78") } }; - QMultiHash<QString, QString> distrustedKeys = { { QStringLiteral("carol@example.net"), - QStringLiteral("4ca6481a110c73e8320a0ac91320a77fb3adba804584eba939685dc0585f6419") } }; + QMultiHash<QString, QByteArray> trustedKeys = { { QStringLiteral("carol@example.net"), + QByteArray::fromBase64(QByteArrayLiteral("OxRakAGKtXyuB9sdH3gJDa1XzsV18BAMcVf/m1vD3Xg=")) } }; + QMultiHash<QString, QByteArray> distrustedKeys = { { QStringLiteral("carol@example.net"), + QByteArray::fromBase64(QByteArrayLiteral("TKZIGhEMc+gyCgrJEyCnf7OtuoBFhOupOWhdwFhfZBk=")) } }; futurePotsponed = m_trustStorage->keysForPostponedTrustDecisions(ns_omemo, - { QStringLiteral("6609344b11856de4a00f0fd96a7cdafe3ccdaebeadd4b5348d85f677b45178a6") }); + { QByteArray::fromBase64(QByteArrayLiteral("Zgk0SxGFbeSgDw/Zanza/jzNrr6t1LU0jYX2d7RReKY=")) }); QVERIFY(futurePotsponed.isFinished()); resultPostponed = futurePotsponed.result(); QCOMPARE( @@ -218,14 +218,14 @@ void tst_QXmppAtmManager::testMakePostponedTrustDecisions() false, distrustedKeys) })); - QMultiHash<QString, QString> authenticatedKeys = { { QStringLiteral("alice@example.org"), - QStringLiteral("d11715b069372e7a4416caaaced4f30200838155e57dad37a5a4aa24538e58e5") }, - { QStringLiteral("alice@example.org"), - QStringLiteral("b589ffc1c20ec414a85b85b551f3ebff381b2e2a412b62ac15f0bb1756f3badd") }, - { QStringLiteral("bob@example.com"), - QStringLiteral("cfa3155773071826642a06a99e0f214070a1e7b8999a5710a209939accb7fcac") }, - { QStringLiteral("bob@example.com"), - QStringLiteral("ddba9d09f8506a5b0ea772dcac556e702401e29451582ca805357c28cfe83a16") } }; + QMultiHash<QString, QByteArray> authenticatedKeys = { { QStringLiteral("alice@example.org"), + QByteArray::fromBase64(QByteArrayLiteral("0RcVsGk3LnpEFsqqztTzAgCDgVXlfa03paSqJFOOWOU=")) }, + { QStringLiteral("alice@example.org"), + QByteArray::fromBase64(QByteArrayLiteral("tYn/wcIOxBSoW4W1UfPr/zgbLipBK2KsFfC7F1bzut0=")) }, + { QStringLiteral("bob@example.com"), + QByteArray::fromBase64(QByteArrayLiteral("z6MVV3MHGCZkKgapng8hQHCh57iZmlcQogmTmsy3/Kw=")) }, + { QStringLiteral("bob@example.com"), + QByteArray::fromBase64(QByteArrayLiteral("3bqdCfhQalsOp3LcrFVucCQB4pRRWCyoBTV8KM/oOhY=")) } }; auto future = m_trustStorage->keys(ns_omemo, QXmppTrustStorage::Authenticated); @@ -237,14 +237,14 @@ void tst_QXmppAtmManager::testMakePostponedTrustDecisions() QXmppTrustStorage::Authenticated, authenticatedKeys) })); - QMultiHash<QString, QString> manuallyDistrustedKeys = { { QStringLiteral("alice@example.org"), - QStringLiteral("788a40d0eae5a40409d4687a36d3106bbe361971aec0245598571e7b629edc6b") }, - { QStringLiteral("alice@example.org"), - QStringLiteral("b6c21e111bd4f9ed06ee0485cb302bf1238e90b89986a04061e48d49ddbe95cb") }, - { QStringLiteral("bob@example.com"), - QStringLiteral("6da21f2f14214ebb58e49999bec2da53531e9c0535c3065c23507b33259ad08b") }, - { QStringLiteral("bob@example.com"), - QStringLiteral("537f949e44e9d7682eb0a6f35b037496a0cb10f6f609d3313f86d8f39abda710") } }; + QMultiHash<QString, QByteArray> manuallyDistrustedKeys = { { QStringLiteral("alice@example.org"), + QByteArray::fromBase64(QByteArrayLiteral("eIpA0OrlpAQJ1Gh6NtMQa742GXGuwCRVmFcee2Ke3Gs=")) }, + { QStringLiteral("alice@example.org"), + QByteArray::fromBase64(QByteArrayLiteral("tsIeERvU+e0G7gSFyzAr8SOOkLiZhqBAYeSNSd2+lcs=")) }, + { QStringLiteral("bob@example.com"), + QByteArray::fromBase64(QByteArrayLiteral("baIfLxQhTrtY5JmZvsLaU1MenAU1wwZcI1B7MyWa0Is=")) }, + { QStringLiteral("bob@example.com"), + QByteArray::fromBase64(QByteArrayLiteral("U3+UnkTp12gusKbzWwN0lqDLEPb2CdMxP4bY85q9pxA=")) } }; future = m_trustStorage->keys(ns_omemo, QXmppTrustStorage::ManuallyDistrusted); @@ -264,38 +264,38 @@ void tst_QXmppAtmManager::testDistrustAutomaticallyTrustedKeys() m_trustStorage->addKeys( ns_omemo, QStringLiteral("alice@example.org"), - { QStringLiteral("470c88ff79bd978c208eef4976e1716f930426f04d4437cf7e8d44c219750c42"), - QStringLiteral("b5fb24aee735c5c7c2f952b3baabcb65425565c7195ff3e0e63f3cba4a6e6363") }, + { QByteArray::fromBase64(QByteArrayLiteral("RwyI/3m9l4wgju9JduFxb5MEJvBNRDfPfo1Ewhl1DEI=")), + QByteArray::fromBase64(QByteArrayLiteral("tfskruc1xcfC+VKzuqvLZUJVZccZX/Pg5j88ukpuY2M=")) }, QXmppTrustStorage::AutomaticallyTrusted); m_trustStorage->addKeys( ns_omemo, QStringLiteral("alice@example.org"), - { QStringLiteral("19a1f2b0d85c7c34b31b6aba3804e1446529b8507d13b882451ff598ad532fe4") }, + { QByteArray::fromBase64(QByteArrayLiteral("GaHysNhcfDSzG2q6OAThRGUpuFB9E7iCRR/1mK1TL+Q=")) }, QXmppTrustStorage::Authenticated); m_trustStorage->addKeys( ns_omemo, QStringLiteral("bob@example.com"), - { QStringLiteral("75955da0120d2b69fc06459e4f3560d2554e6a1e27ffd200fc8bd0a7352ea35c") }, + { QByteArray::fromBase64(QByteArrayLiteral("dZVdoBINK2n8BkWeTzVg0lVOah4n/9IA/IvQpzUuo1w=")) }, QXmppTrustStorage::AutomaticallyTrusted); m_trustStorage->addKeys( ns_omemo, QStringLiteral("bob@example.com"), - { QStringLiteral("59efabd40fe48b10da77c7b7f37a139a13c3cbc83e179fe2adc309984113f0c0") }, + { QByteArray::fromBase64(QByteArrayLiteral("We+r1A/kixDad8e383oTmhPDy8g+F5/ircMJmEET8MA=")) }, QXmppTrustStorage::ManuallyTrusted); m_manager->distrustAutomaticallyTrustedKeys(ns_omemo, { QStringLiteral("alice@example.org"), QStringLiteral("bob@example.com") }); - QMultiHash<QString, QString> automaticallyDistrustedKeys = { { QStringLiteral("alice@example.org"), - QStringLiteral("470c88ff79bd978c208eef4976e1716f930426f04d4437cf7e8d44c219750c42") }, - { QStringLiteral("alice@example.org"), - QStringLiteral("b5fb24aee735c5c7c2f952b3baabcb65425565c7195ff3e0e63f3cba4a6e6363") }, - { QStringLiteral("bob@example.com"), - QStringLiteral("75955da0120d2b69fc06459e4f3560d2554e6a1e27ffd200fc8bd0a7352ea35c") } }; + QMultiHash<QString, QByteArray> automaticallyDistrustedKeys = { { QStringLiteral("alice@example.org"), + QByteArray::fromBase64(QByteArrayLiteral("RwyI/3m9l4wgju9JduFxb5MEJvBNRDfPfo1Ewhl1DEI=")) }, + { QStringLiteral("alice@example.org"), + QByteArray::fromBase64(QByteArrayLiteral("tfskruc1xcfC+VKzuqvLZUJVZccZX/Pg5j88ukpuY2M=")) }, + { QStringLiteral("bob@example.com"), + QByteArray::fromBase64(QByteArrayLiteral("dZVdoBINK2n8BkWeTzVg0lVOah4n/9IA/IvQpzUuo1w=")) } }; auto future = m_trustStorage->keys(ns_omemo, QXmppTrustStorage::AutomaticallyDistrusted); @@ -312,10 +312,10 @@ void tst_QXmppAtmManager::testDistrust() { clearTrustStorage(); - QMultiHash<QString, QString> authenticatedKeys = { { QStringLiteral("alice@example.org"), - QStringLiteral("470c88ff79bd978c208eef4976e1716f930426f04d4437cf7e8d44c219750c42") }, - { QStringLiteral("alice@example.org"), - QStringLiteral("b5fb24aee735c5c7c2f952b3baabcb65425565c7195ff3e0e63f3cba4a6e6363") } }; + QMultiHash<QString, QByteArray> authenticatedKeys = { { QStringLiteral("alice@example.org"), + QByteArray::fromBase64(QByteArrayLiteral("RwyI/3m9l4wgju9JduFxb5MEJvBNRDfPfo1Ewhl1DEI=")) }, + { QStringLiteral("alice@example.org"), + QByteArray::fromBase64(QByteArrayLiteral("tfskruc1xcfC+VKzuqvLZUJVZccZX/Pg5j88ukpuY2M=")) } }; m_trustStorage->addKeys( ns_omemo, @@ -323,8 +323,8 @@ void tst_QXmppAtmManager::testDistrust() authenticatedKeys.values(), QXmppTrustStorage::Authenticated); - QMultiHash<QString, QString> automaticallyTrustedKeys = { { QStringLiteral("bob@example.com"), - QStringLiteral("9b04f41f0afb686d69fb1d2aeb41f45034849ebf1cafb871bf10c48451ab2e66") } }; + QMultiHash<QString, QByteArray> automaticallyTrustedKeys = { { QStringLiteral("bob@example.com"), + QByteArray::fromBase64(QByteArrayLiteral("mwT0Hwr7aG1p+x0q60H0UDSEnr8cr7hxvxDEhFGrLmY=")) } }; m_trustStorage->addKeys( ns_omemo, @@ -332,10 +332,10 @@ void tst_QXmppAtmManager::testDistrust() automaticallyTrustedKeys.values(), QXmppTrustStorage::AutomaticallyTrusted); - QMultiHash<QString, QString> manuallyDistrustedKeys = { { QStringLiteral("alice@example.org"), - QStringLiteral("e858c90ca7305319dc1a46bc46fad3192868f8b5435ffec4d3ea62e6e7aa3814") }, - { QStringLiteral("alice@example.org"), - QStringLiteral("41f5d8cf0ee59a20f7428b68ea5da4c7e1ee335b66290616db0091faeefcabc0") } }; + QMultiHash<QString, QByteArray> manuallyDistrustedKeys = { { QStringLiteral("alice@example.org"), + QByteArray::fromBase64(QByteArrayLiteral("6FjJDKcwUxncGka8RvrTGSho+LVDX/7E0+pi5ueqOBQ=")) }, + { QStringLiteral("alice@example.org"), + QByteArray::fromBase64(QByteArrayLiteral("QfXYzw7lmiD3Qoto6l2kx+HuM1tmKQYW2wCR+u78q8A=")) } }; m_trustStorage->addKeys( ns_omemo, @@ -345,29 +345,29 @@ void tst_QXmppAtmManager::testDistrust() QXmppTrustMessageKeyOwner keyOwnerAlice; keyOwnerAlice.setJid(QStringLiteral("alice@example.org")); - keyOwnerAlice.setTrustedKeys({ QStringLiteral("d11715b069372e7a4416caaaced4f30200838155e57dad37a5a4aa24538e58e5"), - QStringLiteral("b589ffc1c20ec414a85b85b551f3ebff381b2e2a412b62ac15f0bb1756f3badd") }); - keyOwnerAlice.setDistrustedKeys({ QStringLiteral("788a40d0eae5a40409d4687a36d3106bbe361971aec0245598571e7b629edc6b"), - QStringLiteral("b6c21e111bd4f9ed06ee0485cb302bf1238e90b89986a04061e48d49ddbe95cb") }); + keyOwnerAlice.setTrustedKeys({ QByteArray::fromBase64(QByteArrayLiteral("0RcVsGk3LnpEFsqqztTzAgCDgVXlfa03paSqJFOOWOU=")), + QByteArray::fromBase64(QByteArrayLiteral("tYn/wcIOxBSoW4W1UfPr/zgbLipBK2KsFfC7F1bzut0=")) }); + keyOwnerAlice.setDistrustedKeys({ QByteArray::fromBase64(QByteArrayLiteral("eIpA0OrlpAQJ1Gh6NtMQa742GXGuwCRVmFcee2Ke3Gs=")), + QByteArray::fromBase64(QByteArrayLiteral("tsIeERvU+e0G7gSFyzAr8SOOkLiZhqBAYeSNSd2+lcs=")) }); m_trustStorage->addKeysForPostponedTrustDecisions(ns_omemo, - QStringLiteral("470c88ff79bd978c208eef4976e1716f930426f04d4437cf7e8d44c219750c42"), + QByteArray::fromBase64(QByteArrayLiteral("RwyI/3m9l4wgju9JduFxb5MEJvBNRDfPfo1Ewhl1DEI=")), { keyOwnerAlice }); QXmppTrustMessageKeyOwner keyOwnerBob; keyOwnerBob.setJid(QStringLiteral("bob@example.com")); - keyOwnerBob.setTrustedKeys({ QStringLiteral("cfa3155773071826642a06a99e0f214070a1e7b8999a5710a209939accb7fcac") }); - keyOwnerBob.setDistrustedKeys({ QStringLiteral("537f949e44e9d7682eb0a6f35b037496a0cb10f6f609d3313f86d8f39abda710") }); + keyOwnerBob.setTrustedKeys({ QByteArray::fromBase64(QByteArrayLiteral("z6MVV3MHGCZkKgapng8hQHCh57iZmlcQogmTmsy3/Kw=")) }); + keyOwnerBob.setDistrustedKeys({ QByteArray::fromBase64(QByteArrayLiteral("U3+UnkTp12gusKbzWwN0lqDLEPb2CdMxP4bY85q9pxA=")) }); m_trustStorage->addKeysForPostponedTrustDecisions(ns_omemo, - QStringLiteral("9b04f41f0afb686d69fb1d2aeb41f45034849ebf1cafb871bf10c48451ab2e66"), + QByteArray::fromBase64(QByteArrayLiteral("mwT0Hwr7aG1p+x0q60H0UDSEnr8cr7hxvxDEhFGrLmY=")), { keyOwnerAlice, keyOwnerBob }); // The entries for the sender key - // b5fb24aee735c5c7c2f952b3baabcb65425565c7195ff3e0e63f3cba4a6e6363 + // tfskruc1xcfC+VKzuqvLZUJVZccZX/Pg5j88ukpuY2M= // and the keys of keyOwnerBob remain in the storage. m_trustStorage->addKeysForPostponedTrustDecisions(ns_omemo, - QStringLiteral("b5fb24aee735c5c7c2f952b3baabcb65425565c7195ff3e0e63f3cba4a6e6363"), + QByteArray::fromBase64(QByteArrayLiteral("tfskruc1xcfC+VKzuqvLZUJVZccZX/Pg5j88ukpuY2M=")), { keyOwnerBob }); auto futureVoid = m_manager->distrust(ns_omemo, {}); @@ -391,25 +391,25 @@ void tst_QXmppAtmManager::testDistrust() futureVoid = m_manager->distrust(ns_omemo, { std::pair( QStringLiteral("alice@example.org"), - QStringLiteral("470c88ff79bd978c208eef4976e1716f930426f04d4437cf7e8d44c219750c42")), + QByteArray::fromBase64(QByteArrayLiteral("RwyI/3m9l4wgju9JduFxb5MEJvBNRDfPfo1Ewhl1DEI="))), std::pair( QStringLiteral("bob@example.com"), - QStringLiteral("9b04f41f0afb686d69fb1d2aeb41f45034849ebf1cafb871bf10c48451ab2e66")) }); + QByteArray::fromBase64(QByteArrayLiteral("mwT0Hwr7aG1p+x0q60H0UDSEnr8cr7hxvxDEhFGrLmY="))) }); while (!futureVoid.isFinished()) { QCoreApplication::processEvents(); } authenticatedKeys = { { QStringLiteral("alice@example.org"), - QStringLiteral("b5fb24aee735c5c7c2f952b3baabcb65425565c7195ff3e0e63f3cba4a6e6363") } }; + QByteArray::fromBase64(QByteArrayLiteral("tfskruc1xcfC+VKzuqvLZUJVZccZX/Pg5j88ukpuY2M=")) } }; manuallyDistrustedKeys = { { QStringLiteral("alice@example.org"), - QStringLiteral("e858c90ca7305319dc1a46bc46fad3192868f8b5435ffec4d3ea62e6e7aa3814") }, + QByteArray::fromBase64(QByteArrayLiteral("6FjJDKcwUxncGka8RvrTGSho+LVDX/7E0+pi5ueqOBQ=")) }, { QStringLiteral("alice@example.org"), - QStringLiteral("41f5d8cf0ee59a20f7428b68ea5da4c7e1ee335b66290616db0091faeefcabc0") }, + QByteArray::fromBase64(QByteArrayLiteral("QfXYzw7lmiD3Qoto6l2kx+HuM1tmKQYW2wCR+u78q8A=")) }, { QStringLiteral("alice@example.org"), - QStringLiteral("470c88ff79bd978c208eef4976e1716f930426f04d4437cf7e8d44c219750c42") }, + QByteArray::fromBase64(QByteArrayLiteral("RwyI/3m9l4wgju9JduFxb5MEJvBNRDfPfo1Ewhl1DEI=")) }, { QStringLiteral("bob@example.com"), - QStringLiteral("9b04f41f0afb686d69fb1d2aeb41f45034849ebf1cafb871bf10c48451ab2e66") } }; + QByteArray::fromBase64(QByteArrayLiteral("mwT0Hwr7aG1p+x0q60H0UDSEnr8cr7hxvxDEhFGrLmY=")) } }; future = m_trustStorage->keys(ns_omemo); QVERIFY(future.isFinished()); @@ -424,19 +424,19 @@ void tst_QXmppAtmManager::testDistrust() manuallyDistrustedKeys) })); auto futurePostponed = m_trustStorage->keysForPostponedTrustDecisions(ns_omemo, - { QStringLiteral("470c88ff79bd978c208eef4976e1716f930426f04d4437cf7e8d44c219750c42"), - QStringLiteral("9b04f41f0afb686d69fb1d2aeb41f45034849ebf1cafb871bf10c48451ab2e66") }); + { QByteArray::fromBase64(QByteArrayLiteral("RwyI/3m9l4wgju9JduFxb5MEJvBNRDfPfo1Ewhl1DEI=")), + QByteArray::fromBase64(QByteArrayLiteral("mwT0Hwr7aG1p+x0q60H0UDSEnr8cr7hxvxDEhFGrLmY=")) }); QVERIFY(futurePostponed.isFinished()); auto resultPostponed = futurePostponed.result(); QVERIFY(resultPostponed.isEmpty()); - QMultiHash<QString, QString> trustedKeys = { { QStringLiteral("bob@example.com"), - QStringLiteral("cfa3155773071826642a06a99e0f214070a1e7b8999a5710a209939accb7fcac") } }; - QMultiHash<QString, QString> distrustedKeys = { { QStringLiteral("bob@example.com"), - QStringLiteral("537f949e44e9d7682eb0a6f35b037496a0cb10f6f609d3313f86d8f39abda710") } }; + QMultiHash<QString, QByteArray> trustedKeys = { { QStringLiteral("bob@example.com"), + QByteArray::fromBase64(QByteArrayLiteral("z6MVV3MHGCZkKgapng8hQHCh57iZmlcQogmTmsy3/Kw=")) } }; + QMultiHash<QString, QByteArray> distrustedKeys = { { QStringLiteral("bob@example.com"), + QByteArray::fromBase64(QByteArrayLiteral("U3+UnkTp12gusKbzWwN0lqDLEPb2CdMxP4bY85q9pxA=")) } }; futurePostponed = m_trustStorage->keysForPostponedTrustDecisions(ns_omemo, - { QStringLiteral("b5fb24aee735c5c7c2f952b3baabcb65425565c7195ff3e0e63f3cba4a6e6363") }); + { QByteArray::fromBase64(QByteArrayLiteral("tfskruc1xcfC+VKzuqvLZUJVZccZX/Pg5j88ukpuY2M=")) }); QVERIFY(futurePostponed.isFinished()); resultPostponed = futurePostponed.result(); QCOMPARE( @@ -467,10 +467,10 @@ void tst_QXmppAtmManager::testAuthenticate() QFETCH(QXmppTrustStorage::SecurityPolicy, securityPolicy); m_trustStorage->setSecurityPolicies(ns_omemo, securityPolicy); - QMultiHash<QString, QString> authenticatedKeys = { { QStringLiteral("alice@example.org"), - QStringLiteral("ad020bd9a95bb924758b4e84640a75b99f37f3351e120188ab6c21c2edecf998") }, - { QStringLiteral("carol@example.net"), - QStringLiteral("f82419945cb175e4c681b3dbcbb62fbd94f760855c222fb513c3799d273a4130") } }; + QMultiHash<QString, QByteArray> authenticatedKeys = { { QStringLiteral("alice@example.org"), + QByteArray::fromBase64(QByteArrayLiteral("rQIL2albuSR1i06EZAp1uZ838zUeEgGIq2whwu3s+Zg=")) }, + { QStringLiteral("carol@example.net"), + QByteArray::fromBase64(QByteArrayLiteral("+CQZlFyxdeTGgbPby7YvvZT3YIVcIi+1E8N5nSc6QTA=")) } }; m_trustStorage->addKeys( ns_omemo, @@ -484,10 +484,10 @@ void tst_QXmppAtmManager::testAuthenticate() authenticatedKeys.values(QStringLiteral("carol@example.net")), QXmppTrustStorage::Authenticated); - QMultiHash<QString, QString> automaticallyTrustedKeys = { { QStringLiteral("bob@example.com"), - QStringLiteral("9b04f41f0afb686d69fb1d2aeb41f45034849ebf1cafb871bf10c48451ab2e66") }, - { QStringLiteral("bob@example.com"), - QStringLiteral("fddaafd3e44dc8520f74c42227b99210958a544c45794044bd35f13ada883038") } }; + QMultiHash<QString, QByteArray> automaticallyTrustedKeys = { { QStringLiteral("bob@example.com"), + QByteArray::fromBase64(QByteArrayLiteral("mwT0Hwr7aG1p+x0q60H0UDSEnr8cr7hxvxDEhFGrLmY=")) }, + { QStringLiteral("bob@example.com"), + QByteArray::fromBase64(QByteArrayLiteral("/dqv0+RNyFIPdMQiJ7mSEJWKVExFeUBEvTXxOtqIMDg=")) } }; m_trustStorage->addKeys( ns_omemo, @@ -495,10 +495,10 @@ void tst_QXmppAtmManager::testAuthenticate() automaticallyTrustedKeys.values(), QXmppTrustStorage::AutomaticallyTrusted); - QMultiHash<QString, QString> manuallyDistrustedKeys = { { QStringLiteral("alice@example.org"), - QStringLiteral("e858c90ca7305319dc1a46bc46fad3192868f8b5435ffec4d3ea62e6e7aa3814") }, - { QStringLiteral("alice@example.org"), - QStringLiteral("41f5d8cf0ee59a20f7428b68ea5da4c7e1ee335b66290616db0091faeefcabc0") } }; + QMultiHash<QString, QByteArray> manuallyDistrustedKeys = { { QStringLiteral("alice@example.org"), + QByteArray::fromBase64(QByteArrayLiteral("6FjJDKcwUxncGka8RvrTGSho+LVDX/7E0+pi5ueqOBQ=")) }, + { QStringLiteral("alice@example.org"), + QByteArray::fromBase64(QByteArrayLiteral("QfXYzw7lmiD3Qoto6l2kx+HuM1tmKQYW2wCR+u78q8A=")) } }; m_trustStorage->addKeys( ns_omemo, @@ -506,10 +506,10 @@ void tst_QXmppAtmManager::testAuthenticate() manuallyDistrustedKeys.values(), QXmppTrustStorage::ManuallyDistrusted); - QMultiHash<QString, QString> automaticallyDistrustedKeys = { { QStringLiteral("alice@example.org"), - QStringLiteral("470c88ff79bd978c208eef4976e1716f930426f04d4437cf7e8d44c219750c42") }, - { QStringLiteral("alice@example.org"), - QStringLiteral("b5fb24aee735c5c7c2f952b3baabcb65425565c7195ff3e0e63f3cba4a6e6363") } }; + QMultiHash<QString, QByteArray> automaticallyDistrustedKeys = { { QStringLiteral("alice@example.org"), + QByteArray::fromBase64(QByteArrayLiteral("RwyI/3m9l4wgju9JduFxb5MEJvBNRDfPfo1Ewhl1DEI=")) }, + { QStringLiteral("alice@example.org"), + QByteArray::fromBase64(QByteArrayLiteral("tfskruc1xcfC+VKzuqvLZUJVZccZX/Pg5j88ukpuY2M=")) } }; m_trustStorage->addKeys( ns_omemo, @@ -519,55 +519,55 @@ void tst_QXmppAtmManager::testAuthenticate() QXmppTrustMessageKeyOwner keyOwnerAlice; keyOwnerAlice.setJid(QStringLiteral("alice@example.org")); - keyOwnerAlice.setTrustedKeys({ QStringLiteral("d11715b069372e7a4416caaaced4f30200838155e57dad37a5a4aa24538e58e5"), - QStringLiteral("b589ffc1c20ec414a85b85b551f3ebff381b2e2a412b62ac15f0bb1756f3badd") }); - keyOwnerAlice.setDistrustedKeys({ QStringLiteral("788a40d0eae5a40409d4687a36d3106bbe361971aec0245598571e7b629edc6b"), - QStringLiteral("b6c21e111bd4f9ed06ee0485cb302bf1238e90b89986a04061e48d49ddbe95cb") }); + keyOwnerAlice.setTrustedKeys({ QByteArray::fromBase64(QByteArrayLiteral("0RcVsGk3LnpEFsqqztTzAgCDgVXlfa03paSqJFOOWOU=")), + QByteArray::fromBase64(QByteArrayLiteral("tYn/wcIOxBSoW4W1UfPr/zgbLipBK2KsFfC7F1bzut0=")) }); + keyOwnerAlice.setDistrustedKeys({ QByteArray::fromBase64(QByteArrayLiteral("eIpA0OrlpAQJ1Gh6NtMQa742GXGuwCRVmFcee2Ke3Gs=")), + QByteArray::fromBase64(QByteArrayLiteral("tsIeERvU+e0G7gSFyzAr8SOOkLiZhqBAYeSNSd2+lcs=")) }); m_trustStorage->addKeysForPostponedTrustDecisions(ns_omemo, - QStringLiteral("470c88ff79bd978c208eef4976e1716f930426f04d4437cf7e8d44c219750c42"), + QByteArray::fromBase64(QByteArrayLiteral("RwyI/3m9l4wgju9JduFxb5MEJvBNRDfPfo1Ewhl1DEI=")), { keyOwnerAlice }); QXmppTrustMessageKeyOwner keyOwnerBob; keyOwnerBob.setJid(QStringLiteral("bob@example.com")); - keyOwnerBob.setTrustedKeys({ QStringLiteral("cfa3155773071826642a06a99e0f214070a1e7b8999a5710a209939accb7fcac") }); - keyOwnerBob.setDistrustedKeys({ QStringLiteral("537f949e44e9d7682eb0a6f35b037496a0cb10f6f609d3313f86d8f39abda710") }); + keyOwnerBob.setTrustedKeys({ QByteArray::fromBase64(QByteArrayLiteral("z6MVV3MHGCZkKgapng8hQHCh57iZmlcQogmTmsy3/Kw=")) }); + keyOwnerBob.setDistrustedKeys({ QByteArray::fromBase64(QByteArrayLiteral("U3+UnkTp12gusKbzWwN0lqDLEPb2CdMxP4bY85q9pxA=")) }); m_trustStorage->addKeysForPostponedTrustDecisions(ns_omemo, - QStringLiteral("9b04f41f0afb686d69fb1d2aeb41f45034849ebf1cafb871bf10c48451ab2e66"), + QByteArray::fromBase64(QByteArrayLiteral("mwT0Hwr7aG1p+x0q60H0UDSEnr8cr7hxvxDEhFGrLmY=")), { keyOwnerAlice, keyOwnerBob }); QXmppTrustMessageKeyOwner keyOwnerCarol; keyOwnerCarol.setJid(QStringLiteral("carol@example.net")); - keyOwnerCarol.setTrustedKeys({ QStringLiteral("8a4c33ca6a41b155f3dc0c6aa1f64a5923ecc0d2481a22c60f522d7c60509871") }); - keyOwnerCarol.setDistrustedKeys({ QStringLiteral("f82419945cb175e4c681b3dbcbb62fbd94f760855c222fb513c3799d273a4130") }); + keyOwnerCarol.setTrustedKeys({ QByteArray::fromBase64(QByteArrayLiteral("ikwzympBsVXz3AxqofZKWSPswNJIGiLGD1ItfGBQmHE=")) }); + keyOwnerCarol.setDistrustedKeys({ QByteArray::fromBase64(QByteArrayLiteral("+CQZlFyxdeTGgbPby7YvvZT3YIVcIi+1E8N5nSc6QTA=")) }); // The keys of keyOwnerCarol are used for trust decisions once Bob's key - // cfa3155773071826642a06a99e0f214070a1e7b8999a5710a209939accb7fcac is + // z6MVV3MHGCZkKgapng8hQHCh57iZmlcQogmTmsy3/Kw= is // authenticated by the authentication of key - // 9b04f41f0afb686d69fb1d2aeb41f45034849ebf1cafb871bf10c48451ab2e66. + // mwT0Hwr7aG1p+x0q60H0UDSEnr8cr7hxvxDEhFGrLmY=. m_trustStorage->addKeysForPostponedTrustDecisions(ns_omemo, - QStringLiteral("cfa3155773071826642a06a99e0f214070a1e7b8999a5710a209939accb7fcac"), + QByteArray::fromBase64(QByteArrayLiteral("z6MVV3MHGCZkKgapng8hQHCh57iZmlcQogmTmsy3/Kw=")), { keyOwnerCarol }); // The entries for the sender key - // 2e9cf33953840a8e0ddcfe01ec2c5897b0c18421c16ed38135ae051ce2bea43e + // LpzzOVOECo4N3P4B7CxYl7DBhCHBbtOBNa4FHOK+pD4= // and the keys of keyOwnerCarol are removed from the storage // because they are already used for trust decisions once Bob's key - // cfa3155773071826642a06a99e0f214070a1e7b8999a5710a209939accb7fcac is + // z6MVV3MHGCZkKgapng8hQHCh57iZmlcQogmTmsy3/Kw= is // authenticated. m_trustStorage->addKeysForPostponedTrustDecisions(ns_omemo, - QStringLiteral("2e9cf33953840a8e0ddcfe01ec2c5897b0c18421c16ed38135ae051ce2bea43e"), + QByteArray::fromBase64(QByteArrayLiteral("LpzzOVOECo4N3P4B7CxYl7DBhCHBbtOBNa4FHOK+pD4=")), { keyOwnerCarol }); - keyOwnerCarol.setTrustedKeys({ QStringLiteral("b3f7d174dd62bab51b6541c6767202ee5ee7965cefe80acbbb0b0ad46720239f") }); - keyOwnerCarol.setDistrustedKeys({ QStringLiteral("f43e44a243657217e059191f77b2fe729be4713082ab07f9b0ac1cc741df1dbb") }); + keyOwnerCarol.setTrustedKeys({ QByteArray::fromBase64(QByteArrayLiteral("s/fRdN1iurUbZUHGdnIC7l7nllzv6ArLuwsK1GcgI58=")) }); + keyOwnerCarol.setDistrustedKeys({ QByteArray::fromBase64(QByteArrayLiteral("9D5EokNlchfgWRkfd7L+cpvkcTCCqwf5sKwcx0HfHbs=")) }); // The entries for the sender key - // 2975673c8a9b6a4efeed767ee7c7643e87bac3770dfc6ca32a3f08749b5c6edf + // KXVnPIqbak7+7XZ+58dkPoe6w3cN/GyjKj8IdJtcbt8= // and the keys of keyOwnerCarol remain in the storage. m_trustStorage->addKeysForPostponedTrustDecisions(ns_omemo, - QStringLiteral("2975673c8a9b6a4efeed767ee7c7643e87bac3770dfc6ca32a3f08749b5c6edf"), + QByteArray::fromBase64(QByteArrayLiteral("KXVnPIqbak7+7XZ+58dkPoe6w3cN/GyjKj8IdJtcbt8=")), { keyOwnerCarol }); auto futureVoid = m_manager->authenticate(ns_omemo, {}); @@ -594,53 +594,53 @@ void tst_QXmppAtmManager::testAuthenticate() futureVoid = m_manager->authenticate(ns_omemo, { std::pair( QStringLiteral("alice@example.org"), - QStringLiteral("470c88ff79bd978c208eef4976e1716f930426f04d4437cf7e8d44c219750c42")), + QByteArray::fromBase64(QByteArrayLiteral("RwyI/3m9l4wgju9JduFxb5MEJvBNRDfPfo1Ewhl1DEI="))), std::pair( QStringLiteral("bob@example.com"), - QStringLiteral("9b04f41f0afb686d69fb1d2aeb41f45034849ebf1cafb871bf10c48451ab2e66")) }); + QByteArray::fromBase64(QByteArrayLiteral("mwT0Hwr7aG1p+x0q60H0UDSEnr8cr7hxvxDEhFGrLmY="))) }); while (!futureVoid.isFinished()) { QCoreApplication::processEvents(); } authenticatedKeys = { { QStringLiteral("alice@example.org"), - QStringLiteral("ad020bd9a95bb924758b4e84640a75b99f37f3351e120188ab6c21c2edecf998") }, + QByteArray::fromBase64(QByteArrayLiteral("rQIL2albuSR1i06EZAp1uZ838zUeEgGIq2whwu3s+Zg=")) }, { QStringLiteral("alice@example.org"), - QStringLiteral("470c88ff79bd978c208eef4976e1716f930426f04d4437cf7e8d44c219750c42") }, + QByteArray::fromBase64(QByteArrayLiteral("RwyI/3m9l4wgju9JduFxb5MEJvBNRDfPfo1Ewhl1DEI=")) }, { QStringLiteral("bob@example.com"), - QStringLiteral("9b04f41f0afb686d69fb1d2aeb41f45034849ebf1cafb871bf10c48451ab2e66") }, + QByteArray::fromBase64(QByteArrayLiteral("mwT0Hwr7aG1p+x0q60H0UDSEnr8cr7hxvxDEhFGrLmY=")) }, { QStringLiteral("alice@example.org"), - QStringLiteral("d11715b069372e7a4416caaaced4f30200838155e57dad37a5a4aa24538e58e5") }, + QByteArray::fromBase64(QByteArrayLiteral("0RcVsGk3LnpEFsqqztTzAgCDgVXlfa03paSqJFOOWOU=")) }, { QStringLiteral("alice@example.org"), - QStringLiteral("b589ffc1c20ec414a85b85b551f3ebff381b2e2a412b62ac15f0bb1756f3badd") }, + QByteArray::fromBase64(QByteArrayLiteral("tYn/wcIOxBSoW4W1UfPr/zgbLipBK2KsFfC7F1bzut0=")) }, { QStringLiteral("bob@example.com"), - QStringLiteral("cfa3155773071826642a06a99e0f214070a1e7b8999a5710a209939accb7fcac") }, + QByteArray::fromBase64(QByteArrayLiteral("z6MVV3MHGCZkKgapng8hQHCh57iZmlcQogmTmsy3/Kw=")) }, { QStringLiteral("carol@example.net"), - QStringLiteral("8a4c33ca6a41b155f3dc0c6aa1f64a5923ecc0d2481a22c60f522d7c60509871") } }; + QByteArray::fromBase64(QByteArrayLiteral("ikwzympBsVXz3AxqofZKWSPswNJIGiLGD1ItfGBQmHE=")) } }; manuallyDistrustedKeys = { { QStringLiteral("alice@example.org"), - QStringLiteral("e858c90ca7305319dc1a46bc46fad3192868f8b5435ffec4d3ea62e6e7aa3814") }, + QByteArray::fromBase64(QByteArrayLiteral("6FjJDKcwUxncGka8RvrTGSho+LVDX/7E0+pi5ueqOBQ=")) }, { QStringLiteral("alice@example.org"), - QStringLiteral("41f5d8cf0ee59a20f7428b68ea5da4c7e1ee335b66290616db0091faeefcabc0") }, + QByteArray::fromBase64(QByteArrayLiteral("QfXYzw7lmiD3Qoto6l2kx+HuM1tmKQYW2wCR+u78q8A=")) }, { QStringLiteral("alice@example.org"), - QStringLiteral("788a40d0eae5a40409d4687a36d3106bbe361971aec0245598571e7b629edc6b") }, + QByteArray::fromBase64(QByteArrayLiteral("eIpA0OrlpAQJ1Gh6NtMQa742GXGuwCRVmFcee2Ke3Gs=")) }, { QStringLiteral("alice@example.org"), - QStringLiteral("b6c21e111bd4f9ed06ee0485cb302bf1238e90b89986a04061e48d49ddbe95cb") }, + QByteArray::fromBase64(QByteArrayLiteral("tsIeERvU+e0G7gSFyzAr8SOOkLiZhqBAYeSNSd2+lcs=")) }, { QStringLiteral("bob@example.com"), - QStringLiteral("537f949e44e9d7682eb0a6f35b037496a0cb10f6f609d3313f86d8f39abda710") }, + QByteArray::fromBase64(QByteArrayLiteral("U3+UnkTp12gusKbzWwN0lqDLEPb2CdMxP4bY85q9pxA=")) }, { QStringLiteral("carol@example.net"), - QStringLiteral("f82419945cb175e4c681b3dbcbb62fbd94f760855c222fb513c3799d273a4130") } }; + QByteArray::fromBase64(QByteArrayLiteral("+CQZlFyxdeTGgbPby7YvvZT3YIVcIi+1E8N5nSc6QTA=")) } }; if (securityPolicy == QXmppTrustStorage::NoSecurityPolicy) { automaticallyDistrustedKeys = { { QStringLiteral("alice@example.org"), - QStringLiteral("b5fb24aee735c5c7c2f952b3baabcb65425565c7195ff3e0e63f3cba4a6e6363") } }; + QByteArray::fromBase64(QByteArrayLiteral("tfskruc1xcfC+VKzuqvLZUJVZccZX/Pg5j88ukpuY2M=")) } }; automaticallyTrustedKeys = { { QStringLiteral("bob@example.com"), - QStringLiteral("fddaafd3e44dc8520f74c42227b99210958a544c45794044bd35f13ada883038") } }; + QByteArray::fromBase64(QByteArrayLiteral("/dqv0+RNyFIPdMQiJ7mSEJWKVExFeUBEvTXxOtqIMDg=")) } }; } else if (securityPolicy == QXmppTrustStorage::Toakafa) { automaticallyDistrustedKeys = { { QStringLiteral("alice@example.org"), - QStringLiteral("b5fb24aee735c5c7c2f952b3baabcb65425565c7195ff3e0e63f3cba4a6e6363") }, + QByteArray::fromBase64(QByteArrayLiteral("tfskruc1xcfC+VKzuqvLZUJVZccZX/Pg5j88ukpuY2M=")) }, { QStringLiteral("bob@example.com"), - QStringLiteral("fddaafd3e44dc8520f74c42227b99210958a544c45794044bd35f13ada883038") } }; + QByteArray::fromBase64(QByteArrayLiteral("/dqv0+RNyFIPdMQiJ7mSEJWKVExFeUBEvTXxOtqIMDg=")) } }; } future = m_trustStorage->keys(ns_omemo); @@ -679,21 +679,21 @@ void tst_QXmppAtmManager::testAuthenticate() } auto futurePostponed = m_trustStorage->keysForPostponedTrustDecisions(ns_omemo, - { QStringLiteral("470c88ff79bd978c208eef4976e1716f930426f04d4437cf7e8d44c219750c42"), - QStringLiteral("9b04f41f0afb686d69fb1d2aeb41f45034849ebf1cafb871bf10c48451ab2e66"), - QStringLiteral("cfa3155773071826642a06a99e0f214070a1e7b8999a5710a209939accb7fcac"), - QStringLiteral("2e9cf33953840a8e0ddcfe01ec2c5897b0c18421c16ed38135ae051ce2bea43e") }); + { QByteArray::fromBase64(QByteArrayLiteral("RwyI/3m9l4wgju9JduFxb5MEJvBNRDfPfo1Ewhl1DEI=")), + QByteArray::fromBase64(QByteArrayLiteral("mwT0Hwr7aG1p+x0q60H0UDSEnr8cr7hxvxDEhFGrLmY=")), + QByteArray::fromBase64(QByteArrayLiteral("z6MVV3MHGCZkKgapng8hQHCh57iZmlcQogmTmsy3/Kw=")), + QByteArray::fromBase64(QByteArrayLiteral("LpzzOVOECo4N3P4B7CxYl7DBhCHBbtOBNa4FHOK+pD4=")) }); QVERIFY(futurePostponed.isFinished()); auto resultPostponed = futurePostponed.result(); QVERIFY(resultPostponed.isEmpty()); - QMultiHash<QString, QString> trustedKeys = { { QStringLiteral("carol@example.net"), - QStringLiteral("b3f7d174dd62bab51b6541c6767202ee5ee7965cefe80acbbb0b0ad46720239f") } }; - QMultiHash<QString, QString> distrustedKeys = { { QStringLiteral("carol@example.net"), - QStringLiteral("f43e44a243657217e059191f77b2fe729be4713082ab07f9b0ac1cc741df1dbb") } }; + QMultiHash<QString, QByteArray> trustedKeys = { { QStringLiteral("carol@example.net"), + QByteArray::fromBase64(QByteArrayLiteral("s/fRdN1iurUbZUHGdnIC7l7nllzv6ArLuwsK1GcgI58=")) } }; + QMultiHash<QString, QByteArray> distrustedKeys = { { QStringLiteral("carol@example.net"), + QByteArray::fromBase64(QByteArrayLiteral("9D5EokNlchfgWRkfd7L+cpvkcTCCqwf5sKwcx0HfHbs=")) } }; futurePostponed = m_trustStorage->keysForPostponedTrustDecisions(ns_omemo, - { QStringLiteral("2975673c8a9b6a4efeed767ee7c7643e87bac3770dfc6ca32a3f08749b5c6edf") }); + { QByteArray::fromBase64(QByteArrayLiteral("KXVnPIqbak7+7XZ+58dkPoe6w3cN/GyjKj8IdJtcbt8=")) }); QVERIFY(futurePostponed.isFinished()); resultPostponed = futurePostponed.result(); QCOMPARE( @@ -710,14 +710,14 @@ void tst_QXmppAtmManager::testMakeTrustDecisions() { clearTrustStorage(); - QMultiHash<QString, QString> keysBeingAuthenticated = { { QStringLiteral("alice@example.org"), - QStringLiteral("6f85db0fb55a88c3721df6f672aecf2c64da5b788033be625d0a4b91caf7af43") }, + QMultiHash<QString, QByteArray> keysBeingAuthenticated = { { QStringLiteral("alice@example.org"), + QByteArray::fromBase64(QByteArrayLiteral("b4XbD7VaiMNyHfb2cq7PLGTaW3iAM75iXQpLkcr3r0M=")) }, + { QStringLiteral("bob@example.com"), + QByteArray::fromBase64(QByteArrayLiteral("PJz644fYarsYEO1ECZhpqmrtboAB4lqNgSjhQik0jSM=")) } }; + QMultiHash<QString, QByteArray> keysBeingDistrusted = { { QStringLiteral("alice@example.org"), + QByteArray::fromBase64(QByteArrayLiteral("Pw4KZ2uLdEVuGTWaeSbwZsSstBzN2+prK0GDeD8HyKA=")) }, { QStringLiteral("bob@example.com"), - QStringLiteral("3c9cfae387d86abb1810ed44099869aa6aed6e8001e25a8d8128e14229348d23") } }; - QMultiHash<QString, QString> keysBeingDistrusted = { { QStringLiteral("alice@example.org"), - QStringLiteral("3f0e0a676b8b74456e19359a7926f066c4acb41ccddbea6b2b4183783f07c8a0") }, - { QStringLiteral("bob@example.com"), - QStringLiteral("3f0e0a676b8b74456e19359a7926f066c4acb41ccddbea6b2b4183783f07c8a0") } }; + QByteArray::fromBase64(QByteArrayLiteral("Pw4KZ2uLdEVuGTWaeSbwZsSstBzN2+prK0GDeD8HyKA=")) } }; auto futureVoid = m_manager->makeTrustDecisions(ns_omemo, keysBeingAuthenticated, @@ -747,17 +747,17 @@ void tst_QXmppAtmManager::testHandleMessage_data() QXmppTrustMessageKeyOwner keyOwnerAlice; keyOwnerAlice.setJid(QStringLiteral("alice@example.org")); - keyOwnerAlice.setTrustedKeys({ { QStringLiteral("60788b80ba44dddbe8cb831acb1c9c47e04004563dc3a0ffaca663527bb68d26") }, - { QStringLiteral("39ca796a1fc03c8e8f87cdcdddf14966a39b5fb472c20fbe0f8128c089a016bc") } }); - keyOwnerAlice.setDistrustedKeys({ { QStringLiteral("d0f3be3a1a53424b8cdc577f0ae85d595b9167362851f433394be970222f2994") }, - { QStringLiteral("7e470f60872da85f9bceebe477a75532ff33d04a45a00eec12e50d7bf96f131e") } }); + keyOwnerAlice.setTrustedKeys({ { QByteArray::fromBase64(QByteArrayLiteral("YHiLgLpE3dvoy4MayxycR+BABFY9w6D/rKZjUnu2jSY=")) }, + { QByteArray::fromBase64(QByteArrayLiteral("Ocp5ah/API6Ph83N3fFJZqObX7Rywg++D4EowImgFrw=")) } }); + keyOwnerAlice.setDistrustedKeys({ { QByteArray::fromBase64(QByteArrayLiteral("0PO+OhpTQkuM3Fd/CuhdWVuRZzYoUfQzOUvpcCIvKZQ=")) }, + { QByteArray::fromBase64(QByteArrayLiteral("fkcPYIctqF+bzuvkd6dVMv8z0EpFoA7sEuUNe/lvEx4=")) } }); QXmppTrustMessageKeyOwner keyOwnerBob; keyOwnerBob.setJid(QStringLiteral("bob@example.com")); - keyOwnerBob.setTrustedKeys({ { QStringLiteral("9ca4facea151343aba1a9590215fc2c1b03ae5fa8df41a38a95c4c7c58f0975c") }, - { QStringLiteral("138cf9433f5c583b78f63f095f18d21c6950f57c7a6044815fbba47deb762e16") } }); - keyOwnerBob.setDistrustedKeys({ { QStringLiteral("6f712cbe8341814a62403f4a4479a8b0ffeb47b4fedc103ce0c430e0de9e6665") }, - { QStringLiteral("82e465668d105715f74dbcdd8723b0cdd968ac6d199e7768fcff4db16b4c924e") } }); + keyOwnerBob.setTrustedKeys({ { QByteArray::fromBase64(QByteArrayLiteral("nKT6zqFRNDq6GpWQIV/CwbA65fqN9Bo4qVxMfFjwl1w=")) }, + { QByteArray::fromBase64(QByteArrayLiteral("E4z5Qz9cWDt49j8JXxjSHGlQ9Xx6YESBX7ukfet2LhY=")) } }); + keyOwnerBob.setDistrustedKeys({ { QByteArray::fromBase64(QByteArrayLiteral("b3EsvoNBgUpiQD9KRHmosP/rR7T+3BA84MQw4N6eZmU=")) }, + { QByteArray::fromBase64(QByteArrayLiteral("guRlZo0QVxX3TbzdhyOwzdlorG0Znndo/P9NsWtMkk4=")) } }); QList<QXmppTrustMessageKeyOwner> keyOwners; keyOwners << keyOwnerAlice << keyOwnerBob; @@ -769,7 +769,7 @@ void tst_QXmppAtmManager::testHandleMessage_data() QXmppMessage message; message.setFrom(m_client.configuration().jid()); - message.setSenderKey(QStringLiteral("470c88ff79bd978c208eef4976e1716f930426f04d4437cf7e8d44c219750c42")); + message.setSenderKey(QByteArray::fromBase64(QByteArrayLiteral("RwyI/3m9l4wgju9JduFxb5MEJvBNRDfPfo1Ewhl1DEI="))); message.setTrustMessageElement(trustMessageElement); QTest::newRow("carbonForOwnMessage") @@ -833,7 +833,7 @@ void tst_QXmppAtmManager::testHandleMessage_data() << true; message.setFrom(QStringLiteral("bob@example.com/notebook")); - message.setSenderKey(QStringLiteral("a9f349b04319f23aeed1d4bbe83b58693c598e2550e65a495818b26948fd5065")); + message.setSenderKey(QByteArray::fromBase64(QByteArrayLiteral("qfNJsEMZ8jru0dS76DtYaTxZjiVQ5lpJWBiyaUj9UGU="))); QTest::newRow("senderKeyFromContactNotAuthenticated") << message @@ -886,8 +886,8 @@ void tst_QXmppAtmManager::testHandleMessage() const auto keyOwners = message.trustMessageElement()->keyOwners(); if (isSenderKeyAuthenticated) { - QMultiHash<QString, QString> authenticatedKeys; - QMultiHash<QString, QString> manuallyDistrustedKeys; + QMultiHash<QString, QByteArray> authenticatedKeys; + QMultiHash<QString, QByteArray> manuallyDistrustedKeys; if (isOwnMessage) { for (const auto &keyOwner : keyOwners) { @@ -939,8 +939,8 @@ void tst_QXmppAtmManager::testHandleMessage() } } else { if (isOwnMessage) { - QMultiHash<QString, QString> trustedKeys; - QMultiHash<QString, QString> distrustedKeys; + QMultiHash<QString, QByteArray> trustedKeys; + QMultiHash<QString, QByteArray> distrustedKeys; for (const auto &keyOwner : keyOwners) { for (const auto &trustedKey : keyOwner.trustedKeys()) { @@ -965,8 +965,8 @@ void tst_QXmppAtmManager::testHandleMessage() false, distrustedKeys) })); } else { - QMultiHash<QString, QString> trustedKeys; - QMultiHash<QString, QString> distrustedKeys; + QMultiHash<QString, QByteArray> trustedKeys; + QMultiHash<QString, QByteArray> distrustedKeys; for (const auto &keyOwner : keyOwners) { if (keyOwner.jid() == senderJid) { @@ -1017,15 +1017,15 @@ void tst_QXmppAtmManager::testMakeTrustDecisionsNoKeys() m_trustStorage->addKeys( ns_omemo, QStringLiteral("alice@example.org"), - { QStringLiteral("470c88ff79bd978c208eef4976e1716f930426f04d4437cf7e8d44c219750c42"), - QStringLiteral("b5fb24aee735c5c7c2f952b3baabcb65425565c7195ff3e0e63f3cba4a6e6363") }, + { QByteArray::fromBase64(QByteArrayLiteral("RwyI/3m9l4wgju9JduFxb5MEJvBNRDfPfo1Ewhl1DEI=")), + QByteArray::fromBase64(QByteArrayLiteral("tfskruc1xcfC+VKzuqvLZUJVZccZX/Pg5j88ukpuY2M=")) }, QXmppTrustStorage::Authenticated); // key of contact's endpoints m_trustStorage->addKeys( ns_omemo, QStringLiteral("bob@example.com"), - { QStringLiteral("f200530b57eca5890ee1a912e9028df97140f4d99ff4d10883b863b65a538c82") }, + { QByteArray::fromBase64(QByteArrayLiteral("8gBTC1fspYkO4akS6QKN+XFA9Nmf9NEIg7hjtlpTjII=")) }, QXmppTrustStorage::ManuallyDistrusted); const QObject context; @@ -1047,13 +1047,13 @@ void tst_QXmppAtmManager::testMakeTrustDecisionsNoKeys() QVERIFY2(!unexpectedTrustMessageSentSpy.wait(UNEXPECTED_TRUST_MESSAGE_WAITING_TIMEOUT), "Unexpected trust message sent!"); - QMultiHash<QString, QString> authenticatedKeys = { { QStringLiteral("alice@example.org"), - QStringLiteral("470c88ff79bd978c208eef4976e1716f930426f04d4437cf7e8d44c219750c42") }, - { QStringLiteral("alice@example.org"), - QStringLiteral("b5fb24aee735c5c7c2f952b3baabcb65425565c7195ff3e0e63f3cba4a6e6363") } }; + QMultiHash<QString, QByteArray> authenticatedKeys = { { QStringLiteral("alice@example.org"), + QByteArray::fromBase64(QByteArrayLiteral("RwyI/3m9l4wgju9JduFxb5MEJvBNRDfPfo1Ewhl1DEI=")) }, + { QStringLiteral("alice@example.org"), + QByteArray::fromBase64(QByteArrayLiteral("tfskruc1xcfC+VKzuqvLZUJVZccZX/Pg5j88ukpuY2M=")) } }; - QMultiHash<QString, QString> manuallyDistrustedKeys = { { QStringLiteral("bob@example.com"), - QStringLiteral("f200530b57eca5890ee1a912e9028df97140f4d99ff4d10883b863b65a538c82") } }; + QMultiHash<QString, QByteArray> manuallyDistrustedKeys = { { QStringLiteral("bob@example.com"), + QByteArray::fromBase64(QByteArrayLiteral("8gBTC1fspYkO4akS6QKN+XFA9Nmf9NEIg7hjtlpTjII=")) } }; auto future = m_trustStorage->keys(ns_omemo); QVERIFY(future.isFinished()); @@ -1076,32 +1076,32 @@ void tst_QXmppAtmManager::testMakeTrustDecisionsOwnKeys() m_trustStorage->addKeys( ns_omemo, QStringLiteral("alice@example.org"), - { QStringLiteral("470c88ff79bd978c208eef4976e1716f930426f04d4437cf7e8d44c219750c42"), - QStringLiteral("b5fb24aee735c5c7c2f952b3baabcb65425565c7195ff3e0e63f3cba4a6e6363") }, + { QByteArray::fromBase64(QByteArrayLiteral("RwyI/3m9l4wgju9JduFxb5MEJvBNRDfPfo1Ewhl1DEI=")), + QByteArray::fromBase64(QByteArrayLiteral("tfskruc1xcfC+VKzuqvLZUJVZccZX/Pg5j88ukpuY2M=")) }, QXmppTrustStorage::Authenticated); m_trustStorage->addKeys( ns_omemo, QStringLiteral("alice@example.org"), - { QStringLiteral("19a1f2b0d85c7c34b31b6aba3804e1446529b8507d13b882451ff598ad532fe4") }, + { QByteArray::fromBase64(QByteArrayLiteral("GaHysNhcfDSzG2q6OAThRGUpuFB9E7iCRR/1mK1TL+Q=")) }, QXmppTrustStorage::ManuallyDistrusted); // keys of contact's endpoints m_trustStorage->addKeys( ns_omemo, QStringLiteral("bob@example.com"), - { QStringLiteral("fb5549bcc2c21af903aae67a99067e492fa04db438dfa04953014ea16d0c6b58") }, + { QByteArray::fromBase64(QByteArrayLiteral("+1VJvMLCGvkDquZ6mQZ+SS+gTbQ436BJUwFOoW0Ma1g=")) }, QXmppTrustStorage::Authenticated); m_trustStorage->addKeys( ns_omemo, QStringLiteral("bob@example.com"), - { QStringLiteral("f200530b57eca5890ee1a912e9028df97140f4d99ff4d10883b863b65a538c82") }, + { QByteArray::fromBase64(QByteArrayLiteral("8gBTC1fspYkO4akS6QKN+XFA9Nmf9NEIg7hjtlpTjII=")) }, QXmppTrustStorage::ManuallyDistrusted); // key of contact's endpoint m_trustStorage->addKeys( ns_omemo, QStringLiteral("carol@example.net"), - { QStringLiteral("b55cb7ca00675b8aba5764d87bca788bdd38cc3fb1e2b34c45e8313e73c8edfc") }, + { QByteArray::fromBase64(QByteArrayLiteral("tVy3ygBnW4q6V2TYe8p4i904zD+x4rNMRegxPnPI7fw=")) }, QXmppTrustStorage::Authenticated); int sentMessagesCount = 0; @@ -1128,10 +1128,10 @@ void tst_QXmppAtmManager::testMakeTrustDecisionsOwnKeys() const auto keyOwner = keyOwners.at(0); QCOMPARE(keyOwner.jid(), QStringLiteral("alice@example.org")); QCOMPARE(keyOwner.trustedKeys(), - QList({ QStringLiteral("d11715b069372e7a4416caaaced4f30200838155e57dad37a5a4aa24538e58e5"), - QStringLiteral("b589ffc1c20ec414a85b85b551f3ebff381b2e2a412b62ac15f0bb1756f3badd") })); + QList({ QByteArray::fromBase64(QByteArrayLiteral("0RcVsGk3LnpEFsqqztTzAgCDgVXlfa03paSqJFOOWOU=")), + QByteArray::fromBase64(QByteArrayLiteral("tYn/wcIOxBSoW4W1UfPr/zgbLipBK2KsFfC7F1bzut0=")) })); QCOMPARE(keyOwner.distrustedKeys(), - QList({ QStringLiteral("e2206cc893d501f35633f3a0c80f5f6ac3af909f0ad7fd30b98a70546c384393") })); + QList({ QByteArray::fromBase64(QByteArrayLiteral("4iBsyJPVAfNWM/OgyA9fasOvkJ8K1/0wuYpwVGw4Q5M=")) })); } } }); @@ -1157,10 +1157,10 @@ void tst_QXmppAtmManager::testMakeTrustDecisionsOwnKeys() const auto keyOwner = keyOwners.at(0); QCOMPARE(keyOwner.jid(), QStringLiteral("alice@example.org")); QCOMPARE(keyOwner.trustedKeys(), - QList({ QStringLiteral("d11715b069372e7a4416caaaced4f30200838155e57dad37a5a4aa24538e58e5"), - QStringLiteral("b589ffc1c20ec414a85b85b551f3ebff381b2e2a412b62ac15f0bb1756f3badd") })); + QList({ QByteArray::fromBase64(QByteArrayLiteral("0RcVsGk3LnpEFsqqztTzAgCDgVXlfa03paSqJFOOWOU=")), + QByteArray::fromBase64(QByteArrayLiteral("tYn/wcIOxBSoW4W1UfPr/zgbLipBK2KsFfC7F1bzut0=")) })); QCOMPARE(keyOwner.distrustedKeys(), - QList({ QStringLiteral("e2206cc893d501f35633f3a0c80f5f6ac3af909f0ad7fd30b98a70546c384393") })); + QList({ QByteArray::fromBase64(QByteArrayLiteral("4iBsyJPVAfNWM/OgyA9fasOvkJ8K1/0wuYpwVGw4Q5M=")) })); } } }); @@ -1188,18 +1188,18 @@ void tst_QXmppAtmManager::testMakeTrustDecisionsOwnKeys() if (keyOwnerJid == QStringLiteral("alice@example.org")) { QCOMPARE(keyOwner.trustedKeys(), - QList({ QStringLiteral("470c88ff79bd978c208eef4976e1716f930426f04d4437cf7e8d44c219750c42"), - QStringLiteral("b5fb24aee735c5c7c2f952b3baabcb65425565c7195ff3e0e63f3cba4a6e6363") })); + QList({ QByteArray::fromBase64(QByteArrayLiteral("RwyI/3m9l4wgju9JduFxb5MEJvBNRDfPfo1Ewhl1DEI=")), + QByteArray::fromBase64(QByteArrayLiteral("tfskruc1xcfC+VKzuqvLZUJVZccZX/Pg5j88ukpuY2M=")) })); QCOMPARE(keyOwner.distrustedKeys(), - QList({ QStringLiteral("19a1f2b0d85c7c34b31b6aba3804e1446529b8507d13b882451ff598ad532fe4") })); + QList({ QByteArray::fromBase64(QByteArrayLiteral("GaHysNhcfDSzG2q6OAThRGUpuFB9E7iCRR/1mK1TL+Q=")) })); } else if (keyOwnerJid == QStringLiteral("bob@example.com")) { QCOMPARE(keyOwner.trustedKeys(), - QList({ QStringLiteral("fb5549bcc2c21af903aae67a99067e492fa04db438dfa04953014ea16d0c6b58") })); + QList({ QByteArray::fromBase64(QByteArrayLiteral("+1VJvMLCGvkDquZ6mQZ+SS+gTbQ436BJUwFOoW0Ma1g=")) })); QCOMPARE(keyOwner.distrustedKeys(), - QList({ QStringLiteral("f200530b57eca5890ee1a912e9028df97140f4d99ff4d10883b863b65a538c82") })); + QList({ QByteArray::fromBase64(QByteArrayLiteral("8gBTC1fspYkO4akS6QKN+XFA9Nmf9NEIg7hjtlpTjII=")) })); } else if (keyOwnerJid == QStringLiteral("carol@example.net")) { QCOMPARE(keyOwner.trustedKeys(), - QList({ QStringLiteral("b55cb7ca00675b8aba5764d87bca788bdd38cc3fb1e2b34c45e8313e73c8edfc") })); + QList({ QByteArray::fromBase64(QByteArrayLiteral("tVy3ygBnW4q6V2TYe8p4i904zD+x4rNMRegxPnPI7fw=")) })); QVERIFY(keyOwner.distrustedKeys().isEmpty()); } else { QFAIL("Unexpected key owner sent!"); @@ -1211,11 +1211,11 @@ void tst_QXmppAtmManager::testMakeTrustDecisionsOwnKeys() auto future = m_manager->makeTrustDecisions(ns_omemo, QStringLiteral("alice@example.org"), - { QStringLiteral("470c88ff79bd978c208eef4976e1716f930426f04d4437cf7e8d44c219750c42"), - QStringLiteral("d11715b069372e7a4416caaaced4f30200838155e57dad37a5a4aa24538e58e5"), - QStringLiteral("b589ffc1c20ec414a85b85b551f3ebff381b2e2a412b62ac15f0bb1756f3badd") }, - { QStringLiteral("19a1f2b0d85c7c34b31b6aba3804e1446529b8507d13b882451ff598ad532fe4"), - QStringLiteral("e2206cc893d501f35633f3a0c80f5f6ac3af909f0ad7fd30b98a70546c384393") }); + { QByteArray::fromBase64(QByteArrayLiteral("RwyI/3m9l4wgju9JduFxb5MEJvBNRDfPfo1Ewhl1DEI=")), + QByteArray::fromBase64(QByteArrayLiteral("0RcVsGk3LnpEFsqqztTzAgCDgVXlfa03paSqJFOOWOU=")), + QByteArray::fromBase64(QByteArrayLiteral("tYn/wcIOxBSoW4W1UfPr/zgbLipBK2KsFfC7F1bzut0=")) }, + { QByteArray::fromBase64(QByteArrayLiteral("GaHysNhcfDSzG2q6OAThRGUpuFB9E7iCRR/1mK1TL+Q=")), + QByteArray::fromBase64(QByteArrayLiteral("4iBsyJPVAfNWM/OgyA9fasOvkJ8K1/0wuYpwVGw4Q5M=")) }); while (!future.isFinished()) { QCoreApplication::processEvents(); } @@ -1233,14 +1233,14 @@ void tst_QXmppAtmManager::testMakeTrustDecisionsOwnKeysNoOwnEndpoints() m_trustStorage->addKeys( ns_omemo, QStringLiteral("bob@example.com"), - { QStringLiteral("fb5549bcc2c21af903aae67a99067e492fa04db438dfa04953014ea16d0c6b58") }, + { QByteArray::fromBase64(QByteArrayLiteral("+1VJvMLCGvkDquZ6mQZ+SS+gTbQ436BJUwFOoW0Ma1g=")) }, QXmppTrustStorage::Authenticated); // key of contact's endpoint m_trustStorage->addKeys( ns_omemo, QStringLiteral("carol@example.net"), - { QStringLiteral("b55cb7ca00675b8aba5764d87bca788bdd38cc3fb1e2b34c45e8313e73c8edfc") }, + { QByteArray::fromBase64(QByteArrayLiteral("tVy3ygBnW4q6V2TYe8p4i904zD+x4rNMRegxPnPI7fw=")) }, QXmppTrustStorage::Authenticated); int sentMessagesCount = 0; @@ -1267,10 +1267,10 @@ void tst_QXmppAtmManager::testMakeTrustDecisionsOwnKeysNoOwnEndpoints() const auto keyOwner = keyOwners.at(0); QCOMPARE(keyOwner.jid(), QStringLiteral("alice@example.org")); QCOMPARE(keyOwner.trustedKeys(), - QList({ QStringLiteral("d11715b069372e7a4416caaaced4f30200838155e57dad37a5a4aa24538e58e5"), - QStringLiteral("b589ffc1c20ec414a85b85b551f3ebff381b2e2a412b62ac15f0bb1756f3badd") })); + QList({ QByteArray::fromBase64(QByteArrayLiteral("0RcVsGk3LnpEFsqqztTzAgCDgVXlfa03paSqJFOOWOU=")), + QByteArray::fromBase64(QByteArrayLiteral("tYn/wcIOxBSoW4W1UfPr/zgbLipBK2KsFfC7F1bzut0=")) })); QCOMPARE(keyOwner.distrustedKeys(), - QList({ QStringLiteral("e2206cc893d501f35633f3a0c80f5f6ac3af909f0ad7fd30b98a70546c384393") })); + QList({ QByteArray::fromBase64(QByteArrayLiteral("4iBsyJPVAfNWM/OgyA9fasOvkJ8K1/0wuYpwVGw4Q5M=")) })); } } }); @@ -1296,10 +1296,10 @@ void tst_QXmppAtmManager::testMakeTrustDecisionsOwnKeysNoOwnEndpoints() const auto keyOwner = keyOwners.at(0); QCOMPARE(keyOwner.jid(), QStringLiteral("alice@example.org")); QCOMPARE(keyOwner.trustedKeys(), - QList({ QStringLiteral("d11715b069372e7a4416caaaced4f30200838155e57dad37a5a4aa24538e58e5"), - QStringLiteral("b589ffc1c20ec414a85b85b551f3ebff381b2e2a412b62ac15f0bb1756f3badd") })); + QList({ QByteArray::fromBase64(QByteArrayLiteral("0RcVsGk3LnpEFsqqztTzAgCDgVXlfa03paSqJFOOWOU=")), + QByteArray::fromBase64(QByteArrayLiteral("tYn/wcIOxBSoW4W1UfPr/zgbLipBK2KsFfC7F1bzut0=")) })); QCOMPARE(keyOwner.distrustedKeys(), - QList({ QStringLiteral("e2206cc893d501f35633f3a0c80f5f6ac3af909f0ad7fd30b98a70546c384393") })); + QList({ QByteArray::fromBase64(QByteArrayLiteral("4iBsyJPVAfNWM/OgyA9fasOvkJ8K1/0wuYpwVGw4Q5M=")) })); } } }); @@ -1327,11 +1327,11 @@ void tst_QXmppAtmManager::testMakeTrustDecisionsOwnKeysNoOwnEndpoints() if (keyOwnerJid == QStringLiteral("bob@example.com")) { QCOMPARE(keyOwner.trustedKeys(), - QList({ QStringLiteral("fb5549bcc2c21af903aae67a99067e492fa04db438dfa04953014ea16d0c6b58") })); + QList({ QByteArray::fromBase64(QByteArrayLiteral("+1VJvMLCGvkDquZ6mQZ+SS+gTbQ436BJUwFOoW0Ma1g=")) })); QVERIFY(keyOwner.distrustedKeys().isEmpty()); } else if (keyOwnerJid == QStringLiteral("carol@example.net")) { QCOMPARE(keyOwner.trustedKeys(), - QList({ QStringLiteral("b55cb7ca00675b8aba5764d87bca788bdd38cc3fb1e2b34c45e8313e73c8edfc") })); + QList({ QByteArray::fromBase64(QByteArrayLiteral("tVy3ygBnW4q6V2TYe8p4i904zD+x4rNMRegxPnPI7fw=")) })); QVERIFY(keyOwner.distrustedKeys().isEmpty()); } else { QFAIL("Unexpected key owner sent!"); @@ -1343,9 +1343,9 @@ void tst_QXmppAtmManager::testMakeTrustDecisionsOwnKeysNoOwnEndpoints() auto future = m_manager->makeTrustDecisions(ns_omemo, QStringLiteral("alice@example.org"), - { QStringLiteral("d11715b069372e7a4416caaaced4f30200838155e57dad37a5a4aa24538e58e5"), - QStringLiteral("b589ffc1c20ec414a85b85b551f3ebff381b2e2a412b62ac15f0bb1756f3badd") }, - { QStringLiteral("e2206cc893d501f35633f3a0c80f5f6ac3af909f0ad7fd30b98a70546c384393") }); + { QByteArray::fromBase64(QByteArrayLiteral("0RcVsGk3LnpEFsqqztTzAgCDgVXlfa03paSqJFOOWOU=")), + QByteArray::fromBase64(QByteArrayLiteral("tYn/wcIOxBSoW4W1UfPr/zgbLipBK2KsFfC7F1bzut0=")) }, + { QByteArray::fromBase64(QByteArrayLiteral("4iBsyJPVAfNWM/OgyA9fasOvkJ8K1/0wuYpwVGw4Q5M=")) }); while (!future.isFinished()) { QCoreApplication::processEvents(); } @@ -1363,21 +1363,21 @@ void tst_QXmppAtmManager::testMakeTrustDecisionsOwnKeysNoOwnEndpointsWithAuthent m_trustStorage->addKeys( ns_omemo, QStringLiteral("alice@example.org"), - { QStringLiteral("19a1f2b0d85c7c34b31b6aba3804e1446529b8507d13b882451ff598ad532fe4") }, + { QByteArray::fromBase64(QByteArrayLiteral("GaHysNhcfDSzG2q6OAThRGUpuFB9E7iCRR/1mK1TL+Q=")) }, QXmppTrustStorage::ManuallyDistrusted); // key of contact's endpoint m_trustStorage->addKeys( ns_omemo, QStringLiteral("bob@example.com"), - { QStringLiteral("fb5549bcc2c21af903aae67a99067e492fa04db438dfa04953014ea16d0c6b58") }, + { QByteArray::fromBase64(QByteArrayLiteral("+1VJvMLCGvkDquZ6mQZ+SS+gTbQ436BJUwFOoW0Ma1g=")) }, QXmppTrustStorage::Authenticated); // key of contact's endpoint m_trustStorage->addKeys( ns_omemo, QStringLiteral("carol@example.net"), - { QStringLiteral("b55cb7ca00675b8aba5764d87bca788bdd38cc3fb1e2b34c45e8313e73c8edfc") }, + { QByteArray::fromBase64(QByteArrayLiteral("tVy3ygBnW4q6V2TYe8p4i904zD+x4rNMRegxPnPI7fw=")) }, QXmppTrustStorage::Authenticated); int sentMessagesCount = 0; @@ -1404,10 +1404,10 @@ void tst_QXmppAtmManager::testMakeTrustDecisionsOwnKeysNoOwnEndpointsWithAuthent const auto keyOwner = keyOwners.at(0); QCOMPARE(keyOwner.jid(), QStringLiteral("alice@example.org")); QCOMPARE(keyOwner.trustedKeys(), - QList({ QStringLiteral("d11715b069372e7a4416caaaced4f30200838155e57dad37a5a4aa24538e58e5"), - QStringLiteral("b589ffc1c20ec414a85b85b551f3ebff381b2e2a412b62ac15f0bb1756f3badd") })); + QList({ QByteArray::fromBase64(QByteArrayLiteral("0RcVsGk3LnpEFsqqztTzAgCDgVXlfa03paSqJFOOWOU=")), + QByteArray::fromBase64(QByteArrayLiteral("tYn/wcIOxBSoW4W1UfPr/zgbLipBK2KsFfC7F1bzut0=")) })); QCOMPARE(keyOwner.distrustedKeys(), - QList({ QStringLiteral("e2206cc893d501f35633f3a0c80f5f6ac3af909f0ad7fd30b98a70546c384393") })); + QList({ QByteArray::fromBase64(QByteArrayLiteral("4iBsyJPVAfNWM/OgyA9fasOvkJ8K1/0wuYpwVGw4Q5M=")) })); } } }); @@ -1433,10 +1433,10 @@ void tst_QXmppAtmManager::testMakeTrustDecisionsOwnKeysNoOwnEndpointsWithAuthent const auto keyOwner = keyOwners.at(0); QCOMPARE(keyOwner.jid(), QStringLiteral("alice@example.org")); QCOMPARE(keyOwner.trustedKeys(), - QList({ QStringLiteral("d11715b069372e7a4416caaaced4f30200838155e57dad37a5a4aa24538e58e5"), - QStringLiteral("b589ffc1c20ec414a85b85b551f3ebff381b2e2a412b62ac15f0bb1756f3badd") })); + QList({ QByteArray::fromBase64(QByteArrayLiteral("0RcVsGk3LnpEFsqqztTzAgCDgVXlfa03paSqJFOOWOU=")), + QByteArray::fromBase64(QByteArrayLiteral("tYn/wcIOxBSoW4W1UfPr/zgbLipBK2KsFfC7F1bzut0=")) })); QCOMPARE(keyOwner.distrustedKeys(), - QList({ QStringLiteral("e2206cc893d501f35633f3a0c80f5f6ac3af909f0ad7fd30b98a70546c384393") })); + QList({ QByteArray::fromBase64(QByteArrayLiteral("4iBsyJPVAfNWM/OgyA9fasOvkJ8K1/0wuYpwVGw4Q5M=")) })); } } }); @@ -1465,14 +1465,14 @@ void tst_QXmppAtmManager::testMakeTrustDecisionsOwnKeysNoOwnEndpointsWithAuthent if (keyOwnerJid == QStringLiteral("alice@example.org")) { QVERIFY(keyOwner.trustedKeys().isEmpty()); QCOMPARE(keyOwner.distrustedKeys(), - QList({ QStringLiteral("19a1f2b0d85c7c34b31b6aba3804e1446529b8507d13b882451ff598ad532fe4") })); + QList({ QByteArray::fromBase64(QByteArrayLiteral("GaHysNhcfDSzG2q6OAThRGUpuFB9E7iCRR/1mK1TL+Q=")) })); } else if (keyOwnerJid == QStringLiteral("bob@example.com")) { QCOMPARE(keyOwner.trustedKeys(), - QList({ QStringLiteral("fb5549bcc2c21af903aae67a99067e492fa04db438dfa04953014ea16d0c6b58") })); + QList({ QByteArray::fromBase64(QByteArrayLiteral("+1VJvMLCGvkDquZ6mQZ+SS+gTbQ436BJUwFOoW0Ma1g=")) })); QVERIFY(keyOwner.distrustedKeys().isEmpty()); } else if (keyOwnerJid == QStringLiteral("carol@example.net")) { QCOMPARE(keyOwner.trustedKeys(), - QList({ QStringLiteral("b55cb7ca00675b8aba5764d87bca788bdd38cc3fb1e2b34c45e8313e73c8edfc") })); + QList({ QByteArray::fromBase64(QByteArrayLiteral("tVy3ygBnW4q6V2TYe8p4i904zD+x4rNMRegxPnPI7fw=")) })); QVERIFY(keyOwner.distrustedKeys().isEmpty()); } else { QFAIL("Unexpected key owner sent!"); @@ -1484,9 +1484,9 @@ void tst_QXmppAtmManager::testMakeTrustDecisionsOwnKeysNoOwnEndpointsWithAuthent auto future = m_manager->makeTrustDecisions(ns_omemo, QStringLiteral("alice@example.org"), - { QStringLiteral("d11715b069372e7a4416caaaced4f30200838155e57dad37a5a4aa24538e58e5"), - QStringLiteral("b589ffc1c20ec414a85b85b551f3ebff381b2e2a412b62ac15f0bb1756f3badd") }, - { QStringLiteral("e2206cc893d501f35633f3a0c80f5f6ac3af909f0ad7fd30b98a70546c384393") }); + { QByteArray::fromBase64(QByteArrayLiteral("0RcVsGk3LnpEFsqqztTzAgCDgVXlfa03paSqJFOOWOU=")), + QByteArray::fromBase64(QByteArrayLiteral("tYn/wcIOxBSoW4W1UfPr/zgbLipBK2KsFfC7F1bzut0=")) }, + { QByteArray::fromBase64(QByteArrayLiteral("4iBsyJPVAfNWM/OgyA9fasOvkJ8K1/0wuYpwVGw4Q5M=")) }); while (!future.isFinished()) { QCoreApplication::processEvents(); } @@ -1504,15 +1504,15 @@ void tst_QXmppAtmManager::testMakeTrustDecisionsOwnKeysNoContactsWithAuthenticat m_trustStorage->addKeys( ns_omemo, QStringLiteral("alice@example.org"), - { QStringLiteral("470c88ff79bd978c208eef4976e1716f930426f04d4437cf7e8d44c219750c42"), - QStringLiteral("b5fb24aee735c5c7c2f952b3baabcb65425565c7195ff3e0e63f3cba4a6e6363") }, + { QByteArray::fromBase64(QByteArrayLiteral("RwyI/3m9l4wgju9JduFxb5MEJvBNRDfPfo1Ewhl1DEI=")), + QByteArray::fromBase64(QByteArrayLiteral("tfskruc1xcfC+VKzuqvLZUJVZccZX/Pg5j88ukpuY2M=")) }, QXmppTrustStorage::Authenticated); // keys of contact's endpoints m_trustStorage->addKeys( ns_omemo, QStringLiteral("bob@example.com"), - { QStringLiteral("f200530b57eca5890ee1a912e9028df97140f4d99ff4d10883b863b65a538c82") }, + { QByteArray::fromBase64(QByteArrayLiteral("8gBTC1fspYkO4akS6QKN+XFA9Nmf9NEIg7hjtlpTjII=")) }, QXmppTrustStorage::AutomaticallyDistrusted); int sentMessagesCount = 0; @@ -1537,8 +1537,8 @@ void tst_QXmppAtmManager::testMakeTrustDecisionsOwnKeysNoContactsWithAuthenticat const auto keyOwner = keyOwners.at(0); QCOMPARE(keyOwner.jid(), QStringLiteral("alice@example.org")); - if (keyOwner.trustedKeys() == QList({ QStringLiteral("d11715b069372e7a4416caaaced4f30200838155e57dad37a5a4aa24538e58e5"), QStringLiteral("b589ffc1c20ec414a85b85b551f3ebff381b2e2a412b62ac15f0bb1756f3badd") }) && - keyOwner.distrustedKeys() == QList({ QStringLiteral("e2206cc893d501f35633f3a0c80f5f6ac3af909f0ad7fd30b98a70546c384393") })) { + if (keyOwner.trustedKeys() == QList({ QByteArray::fromBase64(QByteArrayLiteral("0RcVsGk3LnpEFsqqztTzAgCDgVXlfa03paSqJFOOWOU=")), QByteArray::fromBase64(QByteArrayLiteral("tYn/wcIOxBSoW4W1UfPr/zgbLipBK2KsFfC7F1bzut0=")) }) && + keyOwner.distrustedKeys() == QList({ QByteArray::fromBase64(QByteArrayLiteral("4iBsyJPVAfNWM/OgyA9fasOvkJ8K1/0wuYpwVGw4Q5M=")) })) { sentMessagesCount++; } } @@ -1565,7 +1565,7 @@ void tst_QXmppAtmManager::testMakeTrustDecisionsOwnKeysNoContactsWithAuthenticat QCOMPARE(keyOwner.jid(), QStringLiteral("alice@example.org")); const auto trustedKeys = keyOwner.trustedKeys(); - if (trustedKeys == QList({ QStringLiteral("470c88ff79bd978c208eef4976e1716f930426f04d4437cf7e8d44c219750c42"), QStringLiteral("b5fb24aee735c5c7c2f952b3baabcb65425565c7195ff3e0e63f3cba4a6e6363") })) { + if (trustedKeys == QList({ QByteArray::fromBase64(QByteArrayLiteral("RwyI/3m9l4wgju9JduFxb5MEJvBNRDfPfo1Ewhl1DEI=")), QByteArray::fromBase64(QByteArrayLiteral("tfskruc1xcfC+VKzuqvLZUJVZccZX/Pg5j88ukpuY2M=")) })) { sentMessagesCount++; QVERIFY(keyOwner.distrustedKeys().isEmpty()); @@ -1576,9 +1576,9 @@ void tst_QXmppAtmManager::testMakeTrustDecisionsOwnKeysNoContactsWithAuthenticat auto future = m_manager->makeTrustDecisions(ns_omemo, QStringLiteral("alice@example.org"), - { QStringLiteral("d11715b069372e7a4416caaaced4f30200838155e57dad37a5a4aa24538e58e5"), - QStringLiteral("b589ffc1c20ec414a85b85b551f3ebff381b2e2a412b62ac15f0bb1756f3badd") }, - { QStringLiteral("e2206cc893d501f35633f3a0c80f5f6ac3af909f0ad7fd30b98a70546c384393") }); + { QByteArray::fromBase64(QByteArrayLiteral("0RcVsGk3LnpEFsqqztTzAgCDgVXlfa03paSqJFOOWOU=")), + QByteArray::fromBase64(QByteArrayLiteral("tYn/wcIOxBSoW4W1UfPr/zgbLipBK2KsFfC7F1bzut0=")) }, + { QByteArray::fromBase64(QByteArrayLiteral("4iBsyJPVAfNWM/OgyA9fasOvkJ8K1/0wuYpwVGw4Q5M=")) }); while (!future.isFinished()) { QCoreApplication::processEvents(); } @@ -1598,21 +1598,21 @@ void tst_QXmppAtmManager::testMakeTrustDecisionsSoleOwnKeyDistrusted() m_trustStorage->addKeys( ns_omemo, QStringLiteral("alice@example.org"), - { QStringLiteral("470c88ff79bd978c208eef4976e1716f930426f04d4437cf7e8d44c219750c42") }, + { QByteArray::fromBase64(QByteArrayLiteral("RwyI/3m9l4wgju9JduFxb5MEJvBNRDfPfo1Ewhl1DEI=")) }, QXmppTrustStorage::Authenticated); // key of contact's endpoint m_trustStorage->addKeys( ns_omemo, QStringLiteral("bob@example.com"), - { QStringLiteral("fb5549bcc2c21af903aae67a99067e492fa04db438dfa04953014ea16d0c6b58") }, + { QByteArray::fromBase64(QByteArrayLiteral("+1VJvMLCGvkDquZ6mQZ+SS+gTbQ436BJUwFOoW0Ma1g=")) }, QXmppTrustStorage::Authenticated); // key of contact's endpoint m_trustStorage->addKeys( ns_omemo, QStringLiteral("carol@example.net"), - { QStringLiteral("b55cb7ca00675b8aba5764d87bca788bdd38cc3fb1e2b34c45e8313e73c8edfc") }, + { QByteArray::fromBase64(QByteArrayLiteral("tVy3ygBnW4q6V2TYe8p4i904zD+x4rNMRegxPnPI7fw=")) }, QXmppTrustStorage::Authenticated); int sentMessagesCount = 0; @@ -1640,7 +1640,7 @@ void tst_QXmppAtmManager::testMakeTrustDecisionsSoleOwnKeyDistrusted() QCOMPARE(keyOwner.jid(), QStringLiteral("alice@example.org")); QVERIFY(keyOwner.trustedKeys().isEmpty()); QCOMPARE(keyOwner.distrustedKeys(), - QList({ QStringLiteral("470c88ff79bd978c208eef4976e1716f930426f04d4437cf7e8d44c219750c42") })); + QList({ QByteArray::fromBase64(QByteArrayLiteral("RwyI/3m9l4wgju9JduFxb5MEJvBNRDfPfo1Ewhl1DEI=")) })); } } }); @@ -1667,7 +1667,7 @@ void tst_QXmppAtmManager::testMakeTrustDecisionsSoleOwnKeyDistrusted() QCOMPARE(keyOwner.jid(), QStringLiteral("alice@example.org")); QVERIFY(keyOwner.trustedKeys().isEmpty()); QCOMPARE(keyOwner.distrustedKeys(), - QList({ QStringLiteral("470c88ff79bd978c208eef4976e1716f930426f04d4437cf7e8d44c219750c42") })); + QList({ QByteArray::fromBase64(QByteArrayLiteral("RwyI/3m9l4wgju9JduFxb5MEJvBNRDfPfo1Ewhl1DEI=")) })); } } }); @@ -1687,7 +1687,7 @@ void tst_QXmppAtmManager::testMakeTrustDecisionsSoleOwnKeyDistrusted() auto future = m_manager->makeTrustDecisions(ns_omemo, QStringLiteral("alice@example.org"), {}, - { QStringLiteral("470c88ff79bd978c208eef4976e1716f930426f04d4437cf7e8d44c219750c42") }); + { QByteArray::fromBase64(QByteArrayLiteral("RwyI/3m9l4wgju9JduFxb5MEJvBNRDfPfo1Ewhl1DEI=")) }); while (!future.isFinished()) { QCoreApplication::processEvents(); } @@ -1696,7 +1696,7 @@ void tst_QXmppAtmManager::testMakeTrustDecisionsSoleOwnKeyDistrusted() QVERIFY2(!unexpectedTrustMessageSentSpy.wait(UNEXPECTED_TRUST_MESSAGE_WAITING_TIMEOUT), "Unexpected trust message sent!"); auto futureTrustLevel = m_trustStorage->trustLevel(ns_omemo, - QStringLiteral("470c88ff79bd978c208eef4976e1716f930426f04d4437cf7e8d44c219750c42")); + QByteArray::fromBase64(QByteArrayLiteral("RwyI/3m9l4wgju9JduFxb5MEJvBNRDfPfo1Ewhl1DEI="))); QVERIFY(futureTrustLevel.isFinished()); auto result = futureTrustLevel.result(); QCOMPARE(result, QXmppTrustStorage::ManuallyDistrusted); @@ -1712,33 +1712,33 @@ void tst_QXmppAtmManager::testMakeTrustDecisionsContactKeys() m_trustStorage->addKeys( ns_omemo, QStringLiteral("alice@example.org"), - { QStringLiteral("470c88ff79bd978c208eef4976e1716f930426f04d4437cf7e8d44c219750c42"), - QStringLiteral("b5fb24aee735c5c7c2f952b3baabcb65425565c7195ff3e0e63f3cba4a6e6363") }, + { QByteArray::fromBase64(QByteArrayLiteral("RwyI/3m9l4wgju9JduFxb5MEJvBNRDfPfo1Ewhl1DEI=")), + QByteArray::fromBase64(QByteArrayLiteral("tfskruc1xcfC+VKzuqvLZUJVZccZX/Pg5j88ukpuY2M=")) }, QXmppTrustStorage::Authenticated); m_trustStorage->addKeys( ns_omemo, QStringLiteral("alice@example.org"), - { QStringLiteral("19a1f2b0d85c7c34b31b6aba3804e1446529b8507d13b882451ff598ad532fe4") }, + { QByteArray::fromBase64(QByteArrayLiteral("GaHysNhcfDSzG2q6OAThRGUpuFB9E7iCRR/1mK1TL+Q=")) }, QXmppTrustStorage::ManuallyDistrusted); // keys of contact's endpoints m_trustStorage->addKeys( ns_omemo, QStringLiteral("bob@example.com"), - { QStringLiteral("fb5549bcc2c21af903aae67a99067e492fa04db438dfa04953014ea16d0c6b58"), - QStringLiteral("4fe76994007cb4649d6d805b4623a6fe3ad2fbc08fbb3187ac7f1999b8f2bcfa") }, + { QByteArray::fromBase64(QByteArrayLiteral("+1VJvMLCGvkDquZ6mQZ+SS+gTbQ436BJUwFOoW0Ma1g=")), + QByteArray::fromBase64(QByteArrayLiteral("T+dplAB8tGSdbYBbRiOm/jrS+8CPuzGHrH8ZmbjyvPo=")) }, QXmppTrustStorage::Authenticated); m_trustStorage->addKeys( ns_omemo, QStringLiteral("bob@example.com"), - { QStringLiteral("f200530b57eca5890ee1a912e9028df97140f4d99ff4d10883b863b65a538c82") }, + { QByteArray::fromBase64(QByteArrayLiteral("8gBTC1fspYkO4akS6QKN+XFA9Nmf9NEIg7hjtlpTjII=")) }, QXmppTrustStorage::ManuallyDistrusted); // key of contact's endpoint m_trustStorage->addKeys( ns_omemo, QStringLiteral("carol@example.net"), - { QStringLiteral("b55cb7ca00675b8aba5764d87bca788bdd38cc3fb1e2b34c45e8313e73c8edfc") }, + { QByteArray::fromBase64(QByteArrayLiteral("tVy3ygBnW4q6V2TYe8p4i904zD+x4rNMRegxPnPI7fw=")) }, QXmppTrustStorage::Authenticated); int sentMessagesCount = 0; @@ -1765,10 +1765,10 @@ void tst_QXmppAtmManager::testMakeTrustDecisionsContactKeys() const auto keyOwner = keyOwners.at(0); QCOMPARE(keyOwner.jid(), QStringLiteral("bob@example.com")); QCOMPARE(keyOwner.trustedKeys(), - QList({ QStringLiteral("9b30de293401566d5c4e6cc5f438c218a6b5e290c00d93952d3f4a87b08aec03"), - QStringLiteral("187ce6ae2fb5539dde1518256d08685e053cbcea675d9d35d9583dd0788bbd6c") })); + QList({ QByteArray::fromBase64(QByteArrayLiteral("mzDeKTQBVm1cTmzF9DjCGKa14pDADZOVLT9Kh7CK7AM=")), + QByteArray::fromBase64(QByteArrayLiteral("GHzmri+1U53eFRglbQhoXgU8vOpnXZ012Vg90HiLvWw=")) })); QCOMPARE(keyOwner.distrustedKeys(), - QList({ QStringLiteral("4fe76994007cb4649d6d805b4623a6fe3ad2fbc08fbb3187ac7f1999b8f2bcfa") })); + QList({ QByteArray::fromBase64(QByteArrayLiteral("T+dplAB8tGSdbYBbRiOm/jrS+8CPuzGHrH8ZmbjyvPo=")) })); } } }); @@ -1794,10 +1794,10 @@ void tst_QXmppAtmManager::testMakeTrustDecisionsContactKeys() const auto keyOwner = keyOwners.at(0); QCOMPARE(keyOwner.jid(), QStringLiteral("alice@example.org")); QCOMPARE(keyOwner.trustedKeys(), - QList({ QStringLiteral("470c88ff79bd978c208eef4976e1716f930426f04d4437cf7e8d44c219750c42"), - QStringLiteral("b5fb24aee735c5c7c2f952b3baabcb65425565c7195ff3e0e63f3cba4a6e6363") })); + QList({ QByteArray::fromBase64(QByteArrayLiteral("RwyI/3m9l4wgju9JduFxb5MEJvBNRDfPfo1Ewhl1DEI=")), + QByteArray::fromBase64(QByteArrayLiteral("tfskruc1xcfC+VKzuqvLZUJVZccZX/Pg5j88ukpuY2M=")) })); QCOMPARE(keyOwner.distrustedKeys(), - QList({ QStringLiteral("19a1f2b0d85c7c34b31b6aba3804e1446529b8507d13b882451ff598ad532fe4") })); + QList({ QByteArray::fromBase64(QByteArrayLiteral("GaHysNhcfDSzG2q6OAThRGUpuFB9E7iCRR/1mK1TL+Q=")) })); } } }); @@ -1816,11 +1816,11 @@ void tst_QXmppAtmManager::testMakeTrustDecisionsContactKeys() auto future = m_manager->makeTrustDecisions(ns_omemo, QStringLiteral("bob@example.com"), - { QStringLiteral("fb5549bcc2c21af903aae67a99067e492fa04db438dfa04953014ea16d0c6b58"), - QStringLiteral("9b30de293401566d5c4e6cc5f438c218a6b5e290c00d93952d3f4a87b08aec03"), - QStringLiteral("187ce6ae2fb5539dde1518256d08685e053cbcea675d9d35d9583dd0788bbd6c") }, - { QStringLiteral("f200530b57eca5890ee1a912e9028df97140f4d99ff4d10883b863b65a538c82"), - QStringLiteral("4fe76994007cb4649d6d805b4623a6fe3ad2fbc08fbb3187ac7f1999b8f2bcfa") }); + { QByteArray::fromBase64(QByteArrayLiteral("+1VJvMLCGvkDquZ6mQZ+SS+gTbQ436BJUwFOoW0Ma1g=")), + QByteArray::fromBase64(QByteArrayLiteral("mzDeKTQBVm1cTmzF9DjCGKa14pDADZOVLT9Kh7CK7AM=")), + QByteArray::fromBase64(QByteArrayLiteral("GHzmri+1U53eFRglbQhoXgU8vOpnXZ012Vg90HiLvWw=")) }, + { QByteArray::fromBase64(QByteArrayLiteral("8gBTC1fspYkO4akS6QKN+XFA9Nmf9NEIg7hjtlpTjII=")), + QByteArray::fromBase64(QByteArrayLiteral("T+dplAB8tGSdbYBbRiOm/jrS+8CPuzGHrH8ZmbjyvPo=")) }); while (!future.isFinished()) { QCoreApplication::processEvents(); } @@ -1841,14 +1841,14 @@ void tst_QXmppAtmManager::testMakeTrustDecisionsContactKeysNoOwnEndpoints() m_trustStorage->addKeys( ns_omemo, QStringLiteral("bob@example.com"), - { QStringLiteral("fb5549bcc2c21af903aae67a99067e492fa04db438dfa04953014ea16d0c6b58") }, + { QByteArray::fromBase64(QByteArrayLiteral("+1VJvMLCGvkDquZ6mQZ+SS+gTbQ436BJUwFOoW0Ma1g=")) }, QXmppTrustStorage::Authenticated); // key of contact's endpoint m_trustStorage->addKeys( ns_omemo, QStringLiteral("carol@example.net"), - { QStringLiteral("b55cb7ca00675b8aba5764d87bca788bdd38cc3fb1e2b34c45e8313e73c8edfc") }, + { QByteArray::fromBase64(QByteArrayLiteral("tVy3ygBnW4q6V2TYe8p4i904zD+x4rNMRegxPnPI7fw=")) }, QXmppTrustStorage::Authenticated); const QObject context; @@ -1865,9 +1865,9 @@ void tst_QXmppAtmManager::testMakeTrustDecisionsContactKeysNoOwnEndpoints() m_manager->makeTrustDecisions(ns_omemo, QStringLiteral("bob@example.com"), - { QStringLiteral("fb5549bcc2c21af903aae67a99067e492fa04db438dfa04953014ea16d0c6b58"), - QStringLiteral("9b30de293401566d5c4e6cc5f438c218a6b5e290c00d93952d3f4a87b08aec03") }, - { QStringLiteral("f200530b57eca5890ee1a912e9028df97140f4d99ff4d10883b863b65a538c82") }); + { QByteArray::fromBase64(QByteArrayLiteral("+1VJvMLCGvkDquZ6mQZ+SS+gTbQ436BJUwFOoW0Ma1g=")), + QByteArray::fromBase64(QByteArrayLiteral("mzDeKTQBVm1cTmzF9DjCGKa14pDADZOVLT9Kh7CK7AM=")) }, + { QByteArray::fromBase64(QByteArrayLiteral("8gBTC1fspYkO4akS6QKN+XFA9Nmf9NEIg7hjtlpTjII=")) }); QVERIFY2(!unexpectedTrustMessageSentSpy.wait(UNEXPECTED_TRUST_MESSAGE_WAITING_TIMEOUT), "Unexpected trust message sent!"); @@ -1884,21 +1884,21 @@ void tst_QXmppAtmManager::testMakeTrustDecisionsContactKeysNoOwnEndpointsWithAut m_trustStorage->addKeys( ns_omemo, QStringLiteral("alice@example.org"), - { QStringLiteral("19a1f2b0d85c7c34b31b6aba3804e1446529b8507d13b882451ff598ad532fe4") }, + { QByteArray::fromBase64(QByteArrayLiteral("GaHysNhcfDSzG2q6OAThRGUpuFB9E7iCRR/1mK1TL+Q=")) }, QXmppTrustStorage::ManuallyDistrusted); // key of contact's endpoint m_trustStorage->addKeys( ns_omemo, QStringLiteral("bob@example.com"), - { QStringLiteral("fb5549bcc2c21af903aae67a99067e492fa04db438dfa04953014ea16d0c6b58") }, + { QByteArray::fromBase64(QByteArrayLiteral("+1VJvMLCGvkDquZ6mQZ+SS+gTbQ436BJUwFOoW0Ma1g=")) }, QXmppTrustStorage::Authenticated); // key of contact's endpoint m_trustStorage->addKeys( ns_omemo, QStringLiteral("carol@example.net"), - { QStringLiteral("b55cb7ca00675b8aba5764d87bca788bdd38cc3fb1e2b34c45e8313e73c8edfc") }, + { QByteArray::fromBase64(QByteArrayLiteral("tVy3ygBnW4q6V2TYe8p4i904zD+x4rNMRegxPnPI7fw=")) }, QXmppTrustStorage::Authenticated); int sentMessagesCount = 0; @@ -1926,7 +1926,7 @@ void tst_QXmppAtmManager::testMakeTrustDecisionsContactKeysNoOwnEndpointsWithAut QCOMPARE(keyOwner.jid(), QStringLiteral("alice@example.org")); QVERIFY(keyOwner.trustedKeys().isEmpty()); QCOMPARE(keyOwner.distrustedKeys(), - QList({ QStringLiteral("19a1f2b0d85c7c34b31b6aba3804e1446529b8507d13b882451ff598ad532fe4") })); + QList({ QByteArray::fromBase64(QByteArrayLiteral("GaHysNhcfDSzG2q6OAThRGUpuFB9E7iCRR/1mK1TL+Q=")) })); } } }); @@ -1945,9 +1945,9 @@ void tst_QXmppAtmManager::testMakeTrustDecisionsContactKeysNoOwnEndpointsWithAut auto future = m_manager->makeTrustDecisions(ns_omemo, QStringLiteral("bob@example.com"), - { QStringLiteral("fb5549bcc2c21af903aae67a99067e492fa04db438dfa04953014ea16d0c6b58"), - QStringLiteral("9b30de293401566d5c4e6cc5f438c218a6b5e290c00d93952d3f4a87b08aec03") }, - { QStringLiteral("f200530b57eca5890ee1a912e9028df97140f4d99ff4d10883b863b65a538c82") }); + { QByteArray::fromBase64(QByteArrayLiteral("+1VJvMLCGvkDquZ6mQZ+SS+gTbQ436BJUwFOoW0Ma1g=")), + QByteArray::fromBase64(QByteArrayLiteral("mzDeKTQBVm1cTmzF9DjCGKa14pDADZOVLT9Kh7CK7AM=")) }, + { QByteArray::fromBase64(QByteArrayLiteral("8gBTC1fspYkO4akS6QKN+XFA9Nmf9NEIg7hjtlpTjII=")) }); while (!future.isFinished()) { QCoreApplication::processEvents(); } @@ -1968,21 +1968,21 @@ void tst_QXmppAtmManager::testMakeTrustDecisionsSoleContactKeyDistrusted() m_trustStorage->addKeys( ns_omemo, QStringLiteral("alice@example.org"), - { QStringLiteral("470c88ff79bd978c208eef4976e1716f930426f04d4437cf7e8d44c219750c42") }, + { QByteArray::fromBase64(QByteArrayLiteral("RwyI/3m9l4wgju9JduFxb5MEJvBNRDfPfo1Ewhl1DEI=")) }, QXmppTrustStorage::Authenticated); // key of contact's endpoint m_trustStorage->addKeys( ns_omemo, QStringLiteral("bob@example.com"), - { QStringLiteral("fb5549bcc2c21af903aae67a99067e492fa04db438dfa04953014ea16d0c6b58") }, + { QByteArray::fromBase64(QByteArrayLiteral("+1VJvMLCGvkDquZ6mQZ+SS+gTbQ436BJUwFOoW0Ma1g=")) }, QXmppTrustStorage::Authenticated); // key of contact's endpoint m_trustStorage->addKeys( ns_omemo, QStringLiteral("carol@example.net"), - { QStringLiteral("b55cb7ca00675b8aba5764d87bca788bdd38cc3fb1e2b34c45e8313e73c8edfc") }, + { QByteArray::fromBase64(QByteArrayLiteral("tVy3ygBnW4q6V2TYe8p4i904zD+x4rNMRegxPnPI7fw=")) }, QXmppTrustStorage::Authenticated); int sentMessagesCount = 0; @@ -2010,7 +2010,7 @@ void tst_QXmppAtmManager::testMakeTrustDecisionsSoleContactKeyDistrusted() QCOMPARE(keyOwner.jid(), QStringLiteral("bob@example.com")); QVERIFY(keyOwner.trustedKeys().isEmpty()); QCOMPARE(keyOwner.distrustedKeys(), - QList({ QStringLiteral("fb5549bcc2c21af903aae67a99067e492fa04db438dfa04953014ea16d0c6b58") })); + QList({ QByteArray::fromBase64(QByteArrayLiteral("+1VJvMLCGvkDquZ6mQZ+SS+gTbQ436BJUwFOoW0Ma1g=")) })); } } }); @@ -2030,7 +2030,7 @@ void tst_QXmppAtmManager::testMakeTrustDecisionsSoleContactKeyDistrusted() auto future = m_manager->makeTrustDecisions(ns_omemo, QStringLiteral("bob@example.com"), {}, - { QStringLiteral("fb5549bcc2c21af903aae67a99067e492fa04db438dfa04953014ea16d0c6b58") }); + { QByteArray::fromBase64(QByteArrayLiteral("+1VJvMLCGvkDquZ6mQZ+SS+gTbQ436BJUwFOoW0Ma1g=")) }); while (!future.isFinished()) { QCoreApplication::processEvents(); } @@ -2039,7 +2039,7 @@ void tst_QXmppAtmManager::testMakeTrustDecisionsSoleContactKeyDistrusted() QVERIFY2(!unexpectedTrustMessageSentSpy.wait(UNEXPECTED_TRUST_MESSAGE_WAITING_TIMEOUT), "Unexpected trust message sent!"); const auto futureTrustLevel = m_trustStorage->trustLevel(ns_omemo, - QStringLiteral("fb5549bcc2c21af903aae67a99067e492fa04db438dfa04953014ea16d0c6b58")); + QByteArray::fromBase64(QByteArrayLiteral("+1VJvMLCGvkDquZ6mQZ+SS+gTbQ436BJUwFOoW0Ma1g="))); QVERIFY(futureTrustLevel.isFinished()); const auto result = futureTrustLevel.result(); QCOMPARE(result, QXmppTrustStorage::ManuallyDistrusted); @@ -2048,19 +2048,19 @@ void tst_QXmppAtmManager::testMakeTrustDecisionsSoleContactKeyDistrusted() void tst_QXmppAtmManager::testMakeTrustDecisionsOwnKeysDone() { auto future = m_trustStorage->trustLevel(ns_omemo, - QStringLiteral("d11715b069372e7a4416caaaced4f30200838155e57dad37a5a4aa24538e58e5")); + QByteArray::fromBase64(QByteArrayLiteral("0RcVsGk3LnpEFsqqztTzAgCDgVXlfa03paSqJFOOWOU="))); QVERIFY(future.isFinished()); auto result = future.result(); QCOMPARE(result, QXmppTrustStorage::Authenticated); future = m_trustStorage->trustLevel(ns_omemo, - QStringLiteral("b589ffc1c20ec414a85b85b551f3ebff381b2e2a412b62ac15f0bb1756f3badd")); + QByteArray::fromBase64(QByteArrayLiteral("tYn/wcIOxBSoW4W1UfPr/zgbLipBK2KsFfC7F1bzut0="))); QVERIFY(future.isFinished()); result = future.result(); QCOMPARE(result, QXmppTrustStorage::Authenticated); future = m_trustStorage->trustLevel(ns_omemo, - QStringLiteral("e2206cc893d501f35633f3a0c80f5f6ac3af909f0ad7fd30b98a70546c384393")); + QByteArray::fromBase64(QByteArrayLiteral("4iBsyJPVAfNWM/OgyA9fasOvkJ8K1/0wuYpwVGw4Q5M="))); QVERIFY(future.isFinished()); result = future.result(); QCOMPARE(result, QXmppTrustStorage::ManuallyDistrusted); @@ -2069,19 +2069,19 @@ void tst_QXmppAtmManager::testMakeTrustDecisionsOwnKeysDone() void tst_QXmppAtmManager::testMakeTrustDecisionsContactKeysDone() { auto future = m_trustStorage->trustLevel(ns_omemo, - QStringLiteral("fb5549bcc2c21af903aae67a99067e492fa04db438dfa04953014ea16d0c6b58")); + QByteArray::fromBase64(QByteArrayLiteral("+1VJvMLCGvkDquZ6mQZ+SS+gTbQ436BJUwFOoW0Ma1g="))); QVERIFY(future.isFinished()); auto result = future.result(); QCOMPARE(result, QXmppTrustStorage::Authenticated); future = m_trustStorage->trustLevel(ns_omemo, - QStringLiteral("9b30de293401566d5c4e6cc5f438c218a6b5e290c00d93952d3f4a87b08aec03")); + QByteArray::fromBase64(QByteArrayLiteral("mzDeKTQBVm1cTmzF9DjCGKa14pDADZOVLT9Kh7CK7AM="))); QVERIFY(future.isFinished()); result = future.result(); QCOMPARE(result, QXmppTrustStorage::Authenticated); future = m_trustStorage->trustLevel(ns_omemo, - QStringLiteral("f200530b57eca5890ee1a912e9028df97140f4d99ff4d10883b863b65a538c82")); + QByteArray::fromBase64(QByteArrayLiteral("8gBTC1fspYkO4akS6QKN+XFA9Nmf9NEIg7hjtlpTjII="))); QVERIFY(future.isFinished()); result = future.result(); QCOMPARE(result, QXmppTrustStorage::ManuallyDistrusted); diff --git a/tests/qxmppmessage/tst_qxmppmessage.cpp b/tests/qxmppmessage/tst_qxmppmessage.cpp index d4e0b7d4..0ae7ba23 100644 --- a/tests/qxmppmessage/tst_qxmppmessage.cpp +++ b/tests/qxmppmessage/tst_qxmppmessage.cpp @@ -1113,15 +1113,15 @@ void tst_QXmppMessage::testTrustMessageElement() const QByteArray xml( "<message id=\"1\" to=\"alice@example.org/\" from=\"alice@example.org/A2\" type=\"chat\">" "<store xmlns=\"urn:xmpp:hints\"/>" - "<trust-message xmlns=\"urn:xmpp:tm:0\" usage=\"urn:xmpp:atm:1\" encryption=\"urn:xmpp:omemo:1\">" + "<trust-message xmlns=\"urn:xmpp:tm:1\" usage=\"urn:xmpp:atm:1\" encryption=\"urn:xmpp:omemo:2\">" "<key-owner jid=\"alice@example.org\">" - "<trust>6850019d7ed0feb6d3823072498ceb4f616c6025586f8f666dc6b9c81ef7e0a4</trust>" - "<trust>221a4f8e228b72182b006e5ca527d3bddccf8d9e6feaf4ce96e1c451e8648020</trust>" + "<trust>aFABnX7Q/rbTgjBySYzrT2FsYCVYb49mbca5yB734KQ=</trust>" + "<trust>IhpPjiKLchgrAG5cpSfTvdzPjZ5v6vTOluHEUehkgCA=</trust>" "</key-owner>" "<key-owner jid=\"bob@example.com\">" - "<trust>623548d3835c6d33ef5cb680f7944ef381cf712bf23a0119dabe5c4f252cd02f</trust>" - "<distrust>b423f5088de9a924d51b31581723d850c7cc67d0a4fe6b267c3d301ff56d2413</distrust>" - "<distrust>d9f849b6b828309c5f2c8df4f38fd891887da5aaa24a22c50d52f69b4a80817e</distrust>" + "<trust>YjVI04NcbTPvXLaA95RO84HPcSvyOgEZ2r5cTyUs0C8=</trust>" + "<distrust>tCP1CI3pqSTVGzFYFyPYUMfMZ9Ck/msmfD0wH/VtJBM=</distrust>" + "<distrust>2fhJtrgoMJxfLI3084/YkYh9paqiSiLFDVL2m0qAgX4=</distrust>" "</key-owner>" "</trust-message>" "</message>"); @@ -1141,7 +1141,7 @@ void tst_QXmppMessage::testOmemoElement() const QByteArray xmlIn(QByteArrayLiteral( "<message id=\"send1\" to=\"juliet@capulet.lit\" from=\"romeo@montague.lit\" type=\"normal\">" "<store xmlns=\"urn:xmpp:hints\"/>" - "<encrypted xmlns=\"urn:xmpp:omemo:1\">" + "<encrypted xmlns=\"urn:xmpp:omemo:2\">" "<header sid=\"27183\">" "<keys jid=\"juliet@capulet.lit\">" "<key rid=\"31415\">Oy5TSG9vVVV4Wz9wUkUvI1lUXiVLIU5bbGIsUV0wRngK</key>" @@ -1172,7 +1172,7 @@ void tst_QXmppMessage::testOmemoElement() const QByteArray xmlOut1(QByteArrayLiteral( "<message id=\"send1\" to=\"juliet@capulet.lit\" from=\"romeo@montague.lit\" type=\"normal\">" "<store xmlns=\"urn:xmpp:hints\"/>" - "<encrypted xmlns=\"urn:xmpp:omemo:1\">" + "<encrypted xmlns=\"urn:xmpp:omemo:2\">" "<header sid=\"27183\">" "<keys jid=\"juliet@capulet.lit\">" "<key rid=\"31415\">Oy5TSG9vVVV4Wz9wUkUvI1lUXiVLIU5bbGIsUV0wRngK</key>" @@ -1199,7 +1199,7 @@ void tst_QXmppMessage::testOmemoElement() const QByteArray xmlOut2(QByteArrayLiteral( "<message type=\"chat\">" - "<encrypted xmlns=\"urn:xmpp:omemo:1\">" + "<encrypted xmlns=\"urn:xmpp:omemo:2\">" "<header sid=\"0\"/>" "<payload/>" "</encrypted>" @@ -1219,8 +1219,8 @@ void tst_QXmppMessage::testOmemoElement() void tst_QXmppMessage::testSenderkey() { QXmppMessage message; - message.setSenderKey(QStringLiteral("6850019d7ed0feb6d3823072498ceb4f616c6025586f8f666dc6b9c81ef7e0a4")); - QCOMPARE(message.senderKey(), QStringLiteral("6850019d7ed0feb6d3823072498ceb4f616c6025586f8f666dc6b9c81ef7e0a4")); + message.setSenderKey(QByteArray::fromBase64(QByteArrayLiteral("aFABnX7Q/rbTgjBySYzrT2FsYCVYb49mbca5yB734KQ="))); + QCOMPARE(message.senderKey(), QByteArray::fromBase64(QByteArrayLiteral("aFABnX7Q/rbTgjBySYzrT2FsYCVYb49mbca5yB734KQ="))); } QTEST_MAIN(tst_QXmppMessage) diff --git a/tests/qxmppomemodata/tst_qxmppomemodata.cpp b/tests/qxmppomemodata/tst_qxmppomemodata.cpp index d53c7220..7282f884 100644 --- a/tests/qxmppomemodata/tst_qxmppomemodata.cpp +++ b/tests/qxmppomemodata/tst_qxmppomemodata.cpp @@ -61,10 +61,10 @@ void tst_QXmppOmemoData::testIsOmemoDeviceElement_data() QTest::addColumn<bool>("isValid"); QTest::newRow("valid") - << QByteArrayLiteral("<device xmlns=\"urn:xmpp:omemo:1\"/>") + << QByteArrayLiteral("<device xmlns=\"urn:xmpp:omemo:2\"/>") << true; QTest::newRow("invalidTag") - << QByteArrayLiteral("<invalid xmlns=\"urn:xmpp:omemo:1\"/>") + << QByteArrayLiteral("<invalid xmlns=\"urn:xmpp:omemo:2\"/>") << false; QTest::newRow("invalidNamespace") << QByteArrayLiteral("<device xmlns=\"invalid\"/>") @@ -124,10 +124,10 @@ void tst_QXmppOmemoData::testIsOmemoDeviceList_data() QTest::addColumn<bool>("isValid"); QTest::newRow("valid") - << QByteArrayLiteral("<devices xmlns=\"urn:xmpp:omemo:1\"/>") + << QByteArrayLiteral("<devices xmlns=\"urn:xmpp:omemo:2\"/>") << true; QTest::newRow("invalidTag") - << QByteArrayLiteral("<invalid xmlns=\"urn:xmpp:omemo:1\"/>") + << QByteArrayLiteral("<invalid xmlns=\"urn:xmpp:omemo:2\"/>") << false; QTest::newRow("invalidNamespace") << QByteArrayLiteral("<devices xmlns=\"invalid\"/>") @@ -148,7 +148,7 @@ void tst_QXmppOmemoData::testIsOmemoDeviceList() void tst_QXmppOmemoData::testOmemoDeviceList() { const QByteArray xml(QByteArrayLiteral( - "<devices xmlns=\"urn:xmpp:omemo:1\">" + "<devices xmlns=\"urn:xmpp:omemo:2\">" "<device id=\"12345\"/>" "<device id=\"4223\" label=\"Gajim on Ubuntu Linux\"/>" "</devices>")); @@ -182,10 +182,10 @@ void tst_QXmppOmemoData::testIsOmemoDeviceBundle_data() QTest::addColumn<bool>("isValid"); QTest::newRow("valid") - << QByteArrayLiteral("<bundle xmlns=\"urn:xmpp:omemo:1\"/>") + << QByteArrayLiteral("<bundle xmlns=\"urn:xmpp:omemo:2\"/>") << true; QTest::newRow("invalidTag") - << QByteArrayLiteral("<invalid xmlns=\"urn:xmpp:omemo:1\"/>") + << QByteArrayLiteral("<invalid xmlns=\"urn:xmpp:omemo:2\"/>") << false; QTest::newRow("invalidNamespace") << QByteArrayLiteral("<bundle xmlns=\"invalid\"/>") @@ -206,7 +206,7 @@ void tst_QXmppOmemoData::testIsOmemoDeviceBundle() void tst_QXmppOmemoData::testOmemoDeviceBundle() { const QByteArray xml(QByteArrayLiteral( - "<bundle xmlns=\"urn:xmpp:omemo:1\">" + "<bundle xmlns=\"urn:xmpp:omemo:2\">" "<ik>a012U0R9WixWKUYhYipucnZOWG06akFOR3Q1NGNOOmUK</ik>" "<spk id=\"1\">Oy5TSG9vVVV4Wz9wUkUvI1lUXiVLIU5bbGIsUV0wRngK</spk>" "<spks>PTEoSk91VnRZSXBzcFlPXy4jZ3NKcGVZZ2d3YVJbVj8K</spks>" @@ -250,10 +250,10 @@ void tst_QXmppOmemoData::testIsOmemoEnvelope_data() QTest::addColumn<bool>("isValid"); QTest::newRow("valid") - << QByteArrayLiteral("<key xmlns=\"urn:xmpp:omemo:1\"/>") + << QByteArrayLiteral("<key xmlns=\"urn:xmpp:omemo:2\"/>") << true; QTest::newRow("invalidTag") - << QByteArrayLiteral("<invalid xmlns=\"urn:xmpp:omemo:1\"/>") + << QByteArrayLiteral("<invalid xmlns=\"urn:xmpp:omemo:2\"/>") << false; QTest::newRow("invalidNamespace") << QByteArrayLiteral("<key xmlns=\"invalid\"/>") @@ -320,10 +320,10 @@ void tst_QXmppOmemoData::testIsOmemoElement_data() QTest::addColumn<bool>("isValid"); QTest::newRow("valid") - << QByteArrayLiteral("<encrypted xmlns=\"urn:xmpp:omemo:1\"/>") + << QByteArrayLiteral("<encrypted xmlns=\"urn:xmpp:omemo:2\"/>") << true; QTest::newRow("invalidTag") - << QByteArrayLiteral("<invalid xmlns=\"urn:xmpp:omemo:1\"/>") + << QByteArrayLiteral("<invalid xmlns=\"urn:xmpp:omemo:2\"/>") << false; QTest::newRow("invalidNamespace") << QByteArrayLiteral("<encrypted xmlns=\"invalid\"/>") @@ -344,7 +344,7 @@ void tst_QXmppOmemoData::testIsOmemoElement() void tst_QXmppOmemoData::testOmemoElement() { const QByteArray xmlIn(QByteArrayLiteral( - "<encrypted xmlns=\"urn:xmpp:omemo:1\">" + "<encrypted xmlns=\"urn:xmpp:omemo:2\">" "<header sid=\"27183\">" "<keys jid=\"juliet@capulet.lit\">" "<key rid=\"31415\">Oy5TSG9vVVV4Wz9wUkUvI1lUXiVLIU5bbGIsUV0wRngK</key>" @@ -372,7 +372,7 @@ void tst_QXmppOmemoData::testOmemoElement() // needed since they are serialized in the reverse order in which they are // deserialized. const QByteArray xmlOut(QByteArrayLiteral( - "<encrypted xmlns=\"urn:xmpp:omemo:1\">" + "<encrypted xmlns=\"urn:xmpp:omemo:2\">" "<header sid=\"27183\">" "<keys jid=\"juliet@capulet.lit\">" "<key rid=\"31415\">Oy5TSG9vVVV4Wz9wUkUvI1lUXiVLIU5bbGIsUV0wRngK</key>" diff --git a/tests/qxmpptrustmemorystorage/tst_qxmpptrustmemorystorage.cpp b/tests/qxmpptrustmemorystorage/tst_qxmpptrustmemorystorage.cpp index 9d803752..7eeafbe0 100644 --- a/tests/qxmpptrustmemorystorage/tst_qxmpptrustmemorystorage.cpp +++ b/tests/qxmpptrustmemorystorage/tst_qxmpptrustmemorystorage.cpp @@ -80,20 +80,20 @@ void tst_QXmppTrustMemoryStorage::testSecurityPolicies() void tst_QXmppTrustMemoryStorage::testOwnKeys() { - m_trustStorage.addOwnKey(ns_ox, QStringLiteral("6850019d7ed0feb6d3823072498ceb4f616c6025586f8f666dc6b9c81ef7e0a4")); - m_trustStorage.addOwnKey(ns_omemo, QStringLiteral("221a4f8e228b72182b006e5ca527d3bddccf8d9e6feaf4ce96e1c451e8648020")); + m_trustStorage.addOwnKey(ns_ox, QByteArray::fromBase64(QByteArrayLiteral("aFABnX7Q/rbTgjBySYzrT2FsYCVYb49mbca5yB734KQ="))); + m_trustStorage.addOwnKey(ns_omemo, QByteArray::fromBase64(QByteArrayLiteral("IhpPjiKLchgrAG5cpSfTvdzPjZ5v6vTOluHEUehkgCA="))); // own OX key auto future = m_trustStorage.ownKey(ns_ox); QVERIFY(future.isFinished()); auto result = future.result(); - QCOMPARE(result, QStringLiteral("6850019d7ed0feb6d3823072498ceb4f616c6025586f8f666dc6b9c81ef7e0a4")); + QCOMPARE(result, QByteArray::fromBase64(QByteArrayLiteral("aFABnX7Q/rbTgjBySYzrT2FsYCVYb49mbca5yB734KQ="))); // own OMEMO key future = m_trustStorage.ownKey(ns_omemo); QVERIFY(future.isFinished()); result = future.result(); - QCOMPARE(result, QStringLiteral("221a4f8e228b72182b006e5ca527d3bddccf8d9e6feaf4ce96e1c451e8648020")); + QCOMPARE(result, QByteArray::fromBase64(QByteArrayLiteral("IhpPjiKLchgrAG5cpSfTvdzPjZ5v6vTOluHEUehkgCA="))); m_trustStorage.removeOwnKey(ns_omemo); @@ -110,63 +110,63 @@ void tst_QXmppTrustMemoryStorage::testKeys() m_trustStorage.addKeys( ns_omemo, QStringLiteral("alice@example.org"), - { QStringLiteral("59a027a56c96d619c5a281f7a09a3d05ae5762892c9cb3de2514c08f13dbbf7f"), - QStringLiteral("ff578add1d8bb633c14f77a5f1fd2ae03bf3a942527c5cb97e42a428f345358c") }); + { QByteArray::fromBase64(QByteArrayLiteral("WaAnpWyW1hnFooH3oJo9Ba5XYoksnLPeJRTAjxPbv38=")), + QByteArray::fromBase64(QByteArrayLiteral("/1eK3R2LtjPBT3el8f0q4DvzqUJSfFy5fkKkKPNFNYw=")) }); m_trustStorage.addKeys( ns_omemo, QStringLiteral("alice@example.org"), - { QStringLiteral("6850019d7ed0feb6d3823072498ceb4f616c6025586f8f666dc6b9c81ef7e0a4") }, + { QByteArray::fromBase64(QByteArrayLiteral("aFABnX7Q/rbTgjBySYzrT2FsYCVYb49mbca5yB734KQ=")) }, QXmppTrustStorage::ManuallyDistrusted); m_trustStorage.addKeys( ns_omemo, QStringLiteral("alice@example.org"), - { QStringLiteral("0a27a6a7864dcd12719d10fe936f2f0227b491726bc25e08adb7c3cbb9fa3b11") }, + { QByteArray::fromBase64(QByteArrayLiteral("Ciemp4ZNzRJxnRD+k28vAie0kXJrwl4IrbfDy7n6OxE=")) }, QXmppTrustStorage::AutomaticallyTrusted); m_trustStorage.addKeys( ns_omemo, QStringLiteral("bob@example.com"), - { QStringLiteral("aef49705177e10808c850bd581c444409c713fe4f810199a8b89981c17c94068") }, + { QByteArray::fromBase64(QByteArrayLiteral("rvSXBRd+EICMhQvVgcREQJxxP+T4EBmai4mYHBfJQGg=")) }, QXmppTrustStorage::AutomaticallyTrusted); m_trustStorage.addKeys( ns_omemo, QStringLiteral("bob@example.com"), - { QStringLiteral("b423f5088de9a924d51b31581723d850c7cc67d0a4fe6b267c3d301ff56d2413"), - QStringLiteral("d9f849b6b828309c5f2c8df4f38fd891887da5aaa24a22c50d52f69b4a80817e") }, + { QByteArray::fromBase64(QByteArrayLiteral("tCP1CI3pqSTVGzFYFyPYUMfMZ9Ck/msmfD0wH/VtJBM=")), + QByteArray::fromBase64(QByteArrayLiteral("2fhJtrgoMJxfLI3084/YkYh9paqiSiLFDVL2m0qAgX4=")) }, QXmppTrustStorage::ManuallyTrusted); m_trustStorage.addKeys( ns_omemo, QStringLiteral("bob@example.com"), - { QStringLiteral("623548d3835c6d33ef5cb680f7944ef381cf712bf23a0119dabe5c4f252cd02f") }, + { QByteArray::fromBase64(QByteArrayLiteral("YjVI04NcbTPvXLaA95RO84HPcSvyOgEZ2r5cTyUs0C8=")) }, QXmppTrustStorage::Authenticated); m_trustStorage.addKeys( ns_ox, QStringLiteral("alice@example.org"), - { QStringLiteral("6850019d7ed0feb6d3823072498ceb4f616c6025586f8f666dc6b9c81ef7e0a4"), - QStringLiteral("221a4f8e228b72182b006e5ca527d3bddccf8d9e6feaf4ce96e1c451e8648020") }, + { QByteArray::fromBase64(QByteArrayLiteral("aFABnX7Q/rbTgjBySYzrT2FsYCVYb49mbca5yB734KQ=")), + QByteArray::fromBase64(QByteArrayLiteral("IhpPjiKLchgrAG5cpSfTvdzPjZ5v6vTOluHEUehkgCA=")) }, QXmppTrustStorage::Authenticated); - QMultiHash<QString, QString> automaticallyDistrustedKeys = { { QStringLiteral("alice@example.org"), - QStringLiteral("59a027a56c96d619c5a281f7a09a3d05ae5762892c9cb3de2514c08f13dbbf7f") }, - { QStringLiteral("alice@example.org"), - QStringLiteral("ff578add1d8bb633c14f77a5f1fd2ae03bf3a942527c5cb97e42a428f345358c") } }; - QMultiHash<QString, QString> manuallyDistrustedKeys = { { QStringLiteral("alice@example.org"), - QStringLiteral("6850019d7ed0feb6d3823072498ceb4f616c6025586f8f666dc6b9c81ef7e0a4") } }; - QMultiHash<QString, QString> automaticallyTrustedKeys = { { QStringLiteral("alice@example.org"), - QStringLiteral("0a27a6a7864dcd12719d10fe936f2f0227b491726bc25e08adb7c3cbb9fa3b11") }, - { QStringLiteral("bob@example.com"), - QStringLiteral("aef49705177e10808c850bd581c444409c713fe4f810199a8b89981c17c94068") } }; - QMultiHash<QString, QString> manuallyTrustedKeys = { { QStringLiteral("bob@example.com"), - QStringLiteral("b423f5088de9a924d51b31581723d850c7cc67d0a4fe6b267c3d301ff56d2413") }, - { QStringLiteral("bob@example.com"), - QStringLiteral("d9f849b6b828309c5f2c8df4f38fd891887da5aaa24a22c50d52f69b4a80817e") } }; - QMultiHash<QString, QString> authenticatedKeys = { { QStringLiteral("bob@example.com"), - QStringLiteral("623548d3835c6d33ef5cb680f7944ef381cf712bf23a0119dabe5c4f252cd02f") } }; + QMultiHash<QString, QByteArray> automaticallyDistrustedKeys = { { QStringLiteral("alice@example.org"), + QByteArray::fromBase64(QByteArrayLiteral("WaAnpWyW1hnFooH3oJo9Ba5XYoksnLPeJRTAjxPbv38=")) }, + { QStringLiteral("alice@example.org"), + QByteArray::fromBase64(QByteArrayLiteral("/1eK3R2LtjPBT3el8f0q4DvzqUJSfFy5fkKkKPNFNYw=")) } }; + QMultiHash<QString, QByteArray> manuallyDistrustedKeys = { { QStringLiteral("alice@example.org"), + QByteArray::fromBase64(QByteArrayLiteral("aFABnX7Q/rbTgjBySYzrT2FsYCVYb49mbca5yB734KQ=")) } }; + QMultiHash<QString, QByteArray> automaticallyTrustedKeys = { { QStringLiteral("alice@example.org"), + QByteArray::fromBase64(QByteArrayLiteral("Ciemp4ZNzRJxnRD+k28vAie0kXJrwl4IrbfDy7n6OxE=")) }, + { QStringLiteral("bob@example.com"), + QByteArray::fromBase64(QByteArrayLiteral("rvSXBRd+EICMhQvVgcREQJxxP+T4EBmai4mYHBfJQGg=")) } }; + QMultiHash<QString, QByteArray> manuallyTrustedKeys = { { QStringLiteral("bob@example.com"), + QByteArray::fromBase64(QByteArrayLiteral("tCP1CI3pqSTVGzFYFyPYUMfMZ9Ck/msmfD0wH/VtJBM=")) }, + { QStringLiteral("bob@example.com"), + QByteArray::fromBase64(QByteArrayLiteral("2fhJtrgoMJxfLI3084/YkYh9paqiSiLFDVL2m0qAgX4=")) } }; + QMultiHash<QString, QByteArray> authenticatedKeys = { { QStringLiteral("bob@example.com"), + QByteArray::fromBase64(QByteArrayLiteral("YjVI04NcbTPvXLaA95RO84HPcSvyOgEZ2r5cTyUs0C8=")) } }; // all OMEMO keys auto future = m_trustStorage.keys(ns_omemo); @@ -204,13 +204,13 @@ void tst_QXmppTrustMemoryStorage::testKeys() authenticatedKeys) })); m_trustStorage.removeKeys(ns_omemo, - { QStringLiteral("59a027a56c96d619c5a281f7a09a3d05ae5762892c9cb3de2514c08f13dbbf7f"), - QStringLiteral("0a27a6a7864dcd12719d10fe936f2f0227b491726bc25e08adb7c3cbb9fa3b11") }); + { QByteArray::fromBase64(QByteArrayLiteral("WaAnpWyW1hnFooH3oJo9Ba5XYoksnLPeJRTAjxPbv38=")), + QByteArray::fromBase64(QByteArrayLiteral("Ciemp4ZNzRJxnRD+k28vAie0kXJrwl4IrbfDy7n6OxE=")) }); automaticallyDistrustedKeys = { { QStringLiteral("alice@example.org"), - QStringLiteral("ff578add1d8bb633c14f77a5f1fd2ae03bf3a942527c5cb97e42a428f345358c") } }; + QByteArray::fromBase64(QByteArrayLiteral("/1eK3R2LtjPBT3el8f0q4DvzqUJSfFy5fkKkKPNFNYw=")) } }; automaticallyTrustedKeys = { { QStringLiteral("bob@example.com"), - QStringLiteral("aef49705177e10808c850bd581c444409c713fe4f810199a8b89981c17c94068") } }; + QByteArray::fromBase64(QByteArrayLiteral("rvSXBRd+EICMhQvVgcREQJxxP+T4EBmai4mYHBfJQGg=")) } }; // all OMEMO keys after removal future = m_trustStorage.keys(ns_omemo); @@ -243,9 +243,9 @@ void tst_QXmppTrustMemoryStorage::testKeys() QVERIFY(result.isEmpty()); authenticatedKeys = { { QStringLiteral("alice@example.org"), - QStringLiteral("6850019d7ed0feb6d3823072498ceb4f616c6025586f8f666dc6b9c81ef7e0a4") }, + QByteArray::fromBase64(QByteArrayLiteral("aFABnX7Q/rbTgjBySYzrT2FsYCVYb49mbca5yB734KQ=")) }, { QStringLiteral("alice@example.org"), - QStringLiteral("221a4f8e228b72182b006e5ca527d3bddccf8d9e6feaf4ce96e1c451e8648020") } }; + QByteArray::fromBase64(QByteArrayLiteral("IhpPjiKLchgrAG5cpSfTvdzPjZ5v6vTOluHEUehkgCA=")) } }; // remaining OX keys future = m_trustStorage.keys(ns_ox); @@ -271,31 +271,31 @@ void tst_QXmppTrustMemoryStorage::testTrustLevels() m_trustStorage.addKeys( ns_ox, QStringLiteral("alice@example.org"), - { QStringLiteral("019fdc1783ab50e20b28ed604017fada941ebce8412763721e75cbc0ce050d95") }, + { QByteArray::fromBase64(QByteArrayLiteral("AZ/cF4OrUOILKO1gQBf62pQevOhBJ2NyHnXLwM4FDZU=")) }, QXmppTrustStorage::AutomaticallyTrusted); m_trustStorage.addKeys( ns_omemo, QStringLiteral("alice@example.org"), - { QStringLiteral("019fdc1783ab50e20b28ed604017fada941ebce8412763721e75cbc0ce050d95"), - QStringLiteral("254e294fb22fa6282d97eed013cec192ae2bfc2fe6848d450a36395a68dbb708") }, + { QByteArray::fromBase64(QByteArrayLiteral("AZ/cF4OrUOILKO1gQBf62pQevOhBJ2NyHnXLwM4FDZU=")), + QByteArray::fromBase64(QByteArrayLiteral("JU4pT7Ivpigtl+7QE87Bkq4r/C/mhI1FCjY5Wmjbtwg=")) }, QXmppTrustStorage::AutomaticallyTrusted); m_trustStorage.addKeys( ns_omemo, QStringLiteral("alice@example.org"), - { QStringLiteral("6850019d7ed0feb6d3823072498ceb4f616c6025586f8f666dc6b9c81ef7e0a4") }, + { QByteArray::fromBase64(QByteArrayLiteral("aFABnX7Q/rbTgjBySYzrT2FsYCVYb49mbca5yB734KQ=")) }, QXmppTrustStorage::ManuallyTrusted); m_trustStorage.addKeys( ns_omemo, QStringLiteral("bob@example.com"), - { QStringLiteral("f44e75946def566527f0233bfc021c98894b3f61cf97a028d3f5527f8553fe80") }, + { QByteArray::fromBase64(QByteArrayLiteral("9E51lG3vVmUn8CM7/AIcmIlLP2HPl6Ao0/VSf4VT/oA=")) }, QXmppTrustStorage::AutomaticallyTrusted); auto future = m_trustStorage.trustLevel( ns_omemo, - QStringLiteral("019fdc1783ab50e20b28ed604017fada941ebce8412763721e75cbc0ce050d95")); + QByteArray::fromBase64(QByteArrayLiteral("AZ/cF4OrUOILKO1gQBf62pQevOhBJ2NyHnXLwM4FDZU="))); QVERIFY(future.isFinished()); auto result = future.result(); QCOMPARE(result, QXmppTrustStorage::AutomaticallyTrusted); @@ -303,21 +303,21 @@ void tst_QXmppTrustMemoryStorage::testTrustLevels() m_trustStorage.setTrustLevel( ns_omemo, { { QStringLiteral("alice@example.org"), - QStringLiteral("019fdc1783ab50e20b28ed604017fada941ebce8412763721e75cbc0ce050d95") }, + QByteArray::fromBase64(QByteArrayLiteral("AZ/cF4OrUOILKO1gQBf62pQevOhBJ2NyHnXLwM4FDZU=")) }, { QStringLiteral("bob@example.com"), - QStringLiteral("f44e75946def566527f0233bfc021c98894b3f61cf97a028d3f5527f8553fe80") } }, + QByteArray::fromBase64(QByteArrayLiteral("9E51lG3vVmUn8CM7/AIcmIlLP2HPl6Ao0/VSf4VT/oA=")) } }, QXmppTrustStorage::Authenticated); future = m_trustStorage.trustLevel( ns_omemo, - QStringLiteral("019fdc1783ab50e20b28ed604017fada941ebce8412763721e75cbc0ce050d95")); + QByteArray::fromBase64(QByteArrayLiteral("AZ/cF4OrUOILKO1gQBf62pQevOhBJ2NyHnXLwM4FDZU="))); QVERIFY(future.isFinished()); result = future.result(); QCOMPARE(result, QXmppTrustStorage::Authenticated); future = m_trustStorage.trustLevel( ns_omemo, - QStringLiteral("f44e75946def566527f0233bfc021c98894b3f61cf97a028d3f5527f8553fe80")); + QByteArray::fromBase64(QByteArrayLiteral("9E51lG3vVmUn8CM7/AIcmIlLP2HPl6Ao0/VSf4VT/oA="))); QVERIFY(future.isFinished()); result = future.result(); QCOMPARE(result, QXmppTrustStorage::Authenticated); @@ -327,12 +327,12 @@ void tst_QXmppTrustMemoryStorage::testTrustLevels() m_trustStorage.setTrustLevel( ns_omemo, { { QStringLiteral("alice@example.org"), - QStringLiteral("f70ea83e32b219200b77d807abbb0d39d380903e5b1d454e28008db3cf458e40") } }, + QByteArray::fromBase64(QByteArrayLiteral("9w6oPjKyGSALd9gHq7sNOdOAkD5bHUVOKACNs89FjkA=")) } }, QXmppTrustStorage::ManuallyTrusted); future = m_trustStorage.trustLevel( ns_omemo, - QStringLiteral("f70ea83e32b219200b77d807abbb0d39d380903e5b1d454e28008db3cf458e40")); + QByteArray::fromBase64(QByteArrayLiteral("9w6oPjKyGSALd9gHq7sNOdOAkD5bHUVOKACNs89FjkA="))); QVERIFY(future.isFinished()); result = future.result(); QCOMPARE(result, QXmppTrustStorage::ManuallyTrusted); @@ -341,7 +341,7 @@ void tst_QXmppTrustMemoryStorage::testTrustLevels() // The default value is returned. future = m_trustStorage.trustLevel( ns_omemo, - QStringLiteral("5972f81037f35066d53d05a34fda6605e882a42073619bf795401a8fe51b3f21")); + QByteArray::fromBase64(QByteArrayLiteral("WXL4EDfzUGbVPQWjT9pmBeiCpCBzYZv3lUAaj+UbPyE="))); QVERIFY(future.isFinished()); result = future.result(); QCOMPARE(result, QXmppTrustStorage::AutomaticallyDistrusted); @@ -357,14 +357,14 @@ void tst_QXmppTrustMemoryStorage::testTrustLevels() future = m_trustStorage.trustLevel( ns_omemo, - QStringLiteral("019fdc1783ab50e20b28ed604017fada941ebce8412763721e75cbc0ce050d95")); + QByteArray::fromBase64(QByteArrayLiteral("AZ/cF4OrUOILKO1gQBf62pQevOhBJ2NyHnXLwM4FDZU="))); QVERIFY(future.isFinished()); result = future.result(); QCOMPARE(result, QXmppTrustStorage::ManuallyDistrusted); future = m_trustStorage.trustLevel( ns_omemo, - QStringLiteral("f44e75946def566527f0233bfc021c98894b3f61cf97a028d3f5527f8553fe80")); + QByteArray::fromBase64(QByteArrayLiteral("9E51lG3vVmUn8CM7/AIcmIlLP2HPl6Ao0/VSf4VT/oA="))); QVERIFY(future.isFinished()); result = future.result(); QCOMPARE(result, QXmppTrustStorage::ManuallyDistrusted); @@ -372,7 +372,7 @@ void tst_QXmppTrustMemoryStorage::testTrustLevels() // Verify that the default trust level is returned for an unknown key. future = m_trustStorage.trustLevel( ns_omemo, - QStringLiteral("c04d3a1b07fc7f80ef0cb143a1a0ac1acf226dc5237fce1620e0361408cf237a")); + QByteArray::fromBase64(QByteArrayLiteral("wE06Gwf8f4DvDLFDoaCsGs8ibcUjf84WIOA2FAjPI3o="))); QVERIFY(future.isFinished()); result = future.result(); QCOMPARE(result, QXmppTrustStorage::AutomaticallyDistrusted); @@ -384,56 +384,56 @@ void tst_QXmppTrustMemoryStorage::testKeysForPostponedTrustDecisions() { QXmppTrustMessageKeyOwner keyOwnerAlice; keyOwnerAlice.setJid(QStringLiteral("alice@example.org")); - keyOwnerAlice.setTrustedKeys({ QStringLiteral("5a5e7765c85bb40b4265008744e883db45bb527293420590ae34c7015370d627"), - QStringLiteral("411d398eb69becf16448b86d773c97acf7c2aa190d0980ab9560136813137a71"), - QStringLiteral("ef2d6dd0b9e63417972646b8dd77a314f2eb2ad425485013ad89b2ef11da2985") }); - keyOwnerAlice.setDistrustedKeys({ QStringLiteral("981f7c861755a6cfbeb2452ecb84c6cbf569e914172c93b82467fce850148f27"), - QStringLiteral("ef2d6dd0b9e63417972646b8dd77a314f2eb2ad425485013ad89b2ef11da2985") }); + keyOwnerAlice.setTrustedKeys({ QByteArray::fromBase64(QByteArrayLiteral("Wl53ZchbtAtCZQCHROiD20W7UnKTQgWQrjTHAVNw1ic=")), + QByteArray::fromBase64(QByteArrayLiteral("QR05jrab7PFkSLhtdzyXrPfCqhkNCYCrlWATaBMTenE=")), + QByteArray::fromBase64(QByteArrayLiteral("7y1t0LnmNBeXJka43XejFPLrKtQlSFATrYmy7xHaKYU=")) }); + keyOwnerAlice.setDistrustedKeys({ QByteArray::fromBase64(QByteArrayLiteral("mB98hhdVps++skUuy4TGy/Vp6RQXLJO4JGf86FAUjyc=")), + QByteArray::fromBase64(QByteArrayLiteral("7y1t0LnmNBeXJka43XejFPLrKtQlSFATrYmy7xHaKYU=")) }); QXmppTrustMessageKeyOwner keyOwnerBobTrustedKeys; keyOwnerBobTrustedKeys.setJid(QStringLiteral("bob@example.com")); - keyOwnerBobTrustedKeys.setTrustedKeys({ QStringLiteral("1a04ea7912e9d4cf8c11e9f3150ca6da8a9eafd3df1ee912e1bac90d09790111") }); + keyOwnerBobTrustedKeys.setTrustedKeys({ QByteArray::fromBase64(QByteArrayLiteral("GgTqeRLp1M+MEenzFQym2oqer9PfHukS4brJDQl5ARE=")) }); - // The key ef2d6dd0b9e63417972646b8dd77a314f2eb2ad425485013ad89b2ef11da2985 + // The key 7y1t0LnmNBeXJka43XejFPLrKtQlSFATrYmy7xHaKYU= // is passed for both postponed authentication and distrusting. // Thus, it is only stored for postponed distrusting. m_trustStorage.addKeysForPostponedTrustDecisions(ns_omemo, - QStringLiteral("329e98e30385dda31c977f256ff54d6dd3c5f6e70616a4b1d9ec9a12cab21ca1"), + QByteArray::fromBase64(QByteArrayLiteral("Mp6Y4wOF3aMcl38lb/VNbdPF9ucGFqSx2eyaEsqyHKE=")), { keyOwnerAlice, keyOwnerBobTrustedKeys }); QXmppTrustMessageKeyOwner keyOwnerBobDistrustedKeys; keyOwnerBobDistrustedKeys.setJid(QStringLiteral("bob@example.com")); - keyOwnerBobDistrustedKeys.setDistrustedKeys({ QStringLiteral("b03ea296e80405e2b13ec7431325f8dcb48628729677930511d853fb8469b310"), - QStringLiteral("5f9b49d43e6b11e69e404f1eaa104a023e0a5191987b7c7e88789f693058d643") }); + keyOwnerBobDistrustedKeys.setDistrustedKeys({ QByteArray::fromBase64(QByteArrayLiteral("sD6ilugEBeKxPsdDEyX43LSGKHKWd5MFEdhT+4RpsxA=")), + QByteArray::fromBase64(QByteArrayLiteral("X5tJ1D5rEeaeQE8eqhBKAj4KUZGYe3x+iHifaTBY1kM=")) }); m_trustStorage.addKeysForPostponedTrustDecisions(ns_omemo, - QStringLiteral("20be62c03430aae1fbca36f94408883fe9ef622054b0d097b4a07c22929cf505"), + QByteArray::fromBase64(QByteArrayLiteral("IL5iwDQwquH7yjb5RAiIP+nvYiBUsNCXtKB8IpKc9QU=")), { keyOwnerBobDistrustedKeys }); QXmppTrustMessageKeyOwner keyOwnerCarol; keyOwnerCarol.setJid(QStringLiteral("carol@example.net")); - keyOwnerCarol.setTrustedKeys({ QStringLiteral("59c2fe70432911e2be769aa0dd77776a672dcf03fc87632ac17704cc57fa2e95"), - QStringLiteral("6c7dd1df5cf437decad5f5301b7f9b741ad53ee0df5e0b906a91ee7647dae671") }); - keyOwnerCarol.setDistrustedKeys({ QStringLiteral("3740764ad1ca935fec970835af3c9b4c5ce3760ec50a173eddc5e64d4feb4bc8"), - QStringLiteral("c2c10ddf65070a236362a4c6fc9eb7858e0dbbcb594f8d8d8b5171ae0c914398") }); + keyOwnerCarol.setTrustedKeys({ QByteArray::fromBase64(QByteArrayLiteral("WcL+cEMpEeK+dpqg3Xd3amctzwP8h2MqwXcEzFf6LpU=")), + QByteArray::fromBase64(QByteArrayLiteral("bH3R31z0N97K1fUwG3+bdBrVPuDfXguQapHudkfa5nE=")) }); + keyOwnerCarol.setDistrustedKeys({ QByteArray::fromBase64(QByteArrayLiteral("N0B2StHKk1/slwg1rzybTFzjdg7FChc+3cXmTU/rS8g=")), + QByteArray::fromBase64(QByteArrayLiteral("wsEN32UHCiNjYqTG/J63hY4Nu8tZT42Ni1FxrgyRQ5g=")) }); m_trustStorage.addKeysForPostponedTrustDecisions(ns_ox, - QStringLiteral("20be62c03430aae1fbca36f94408883fe9ef622054b0d097b4a07c22929cf505"), + QByteArray::fromBase64(QByteArrayLiteral("IL5iwDQwquH7yjb5RAiIP+nvYiBUsNCXtKB8IpKc9QU=")), { keyOwnerCarol }); - QMultiHash<QString, QString> trustedKeys = { { QStringLiteral("alice@example.org"), - QStringLiteral("5a5e7765c85bb40b4265008744e883db45bb527293420590ae34c7015370d627") }, - { QStringLiteral("alice@example.org"), - QStringLiteral("411d398eb69becf16448b86d773c97acf7c2aa190d0980ab9560136813137a71") }, - { QStringLiteral("bob@example.com"), - QStringLiteral("1a04ea7912e9d4cf8c11e9f3150ca6da8a9eafd3df1ee912e1bac90d09790111") } }; - QMultiHash<QString, QString> distrustedKeys = { { QStringLiteral("alice@example.org"), - QStringLiteral("981f7c861755a6cfbeb2452ecb84c6cbf569e914172c93b82467fce850148f27") }, + QMultiHash<QString, QByteArray> trustedKeys = { { QStringLiteral("alice@example.org"), + QByteArray::fromBase64(QByteArrayLiteral("Wl53ZchbtAtCZQCHROiD20W7UnKTQgWQrjTHAVNw1ic=")) }, { QStringLiteral("alice@example.org"), - QStringLiteral("ef2d6dd0b9e63417972646b8dd77a314f2eb2ad425485013ad89b2ef11da2985") } }; + QByteArray::fromBase64(QByteArrayLiteral("QR05jrab7PFkSLhtdzyXrPfCqhkNCYCrlWATaBMTenE=")) }, + { QStringLiteral("bob@example.com"), + QByteArray::fromBase64(QByteArrayLiteral("GgTqeRLp1M+MEenzFQym2oqer9PfHukS4brJDQl5ARE=")) } }; + QMultiHash<QString, QByteArray> distrustedKeys = { { QStringLiteral("alice@example.org"), + QByteArray::fromBase64(QByteArrayLiteral("mB98hhdVps++skUuy4TGy/Vp6RQXLJO4JGf86FAUjyc=")) }, + { QStringLiteral("alice@example.org"), + QByteArray::fromBase64(QByteArrayLiteral("7y1t0LnmNBeXJka43XejFPLrKtQlSFATrYmy7xHaKYU=")) } }; auto future = m_trustStorage.keysForPostponedTrustDecisions(ns_omemo, - { QStringLiteral("329e98e30385dda31c977f256ff54d6dd3c5f6e70616a4b1d9ec9a12cab21ca1") }); + { QByteArray::fromBase64(QByteArrayLiteral("Mp6Y4wOF3aMcl38lb/VNbdPF9ucGFqSx2eyaEsqyHKE=")) }); QVERIFY(future.isFinished()); auto result = future.result(); QCOMPARE( @@ -446,17 +446,17 @@ void tst_QXmppTrustMemoryStorage::testKeysForPostponedTrustDecisions() distrustedKeys) })); distrustedKeys = { { QStringLiteral("alice@example.org"), - QStringLiteral("981f7c861755a6cfbeb2452ecb84c6cbf569e914172c93b82467fce850148f27") }, + QByteArray::fromBase64(QByteArrayLiteral("mB98hhdVps++skUuy4TGy/Vp6RQXLJO4JGf86FAUjyc=")) }, { QStringLiteral("alice@example.org"), - QStringLiteral("ef2d6dd0b9e63417972646b8dd77a314f2eb2ad425485013ad89b2ef11da2985") }, + QByteArray::fromBase64(QByteArrayLiteral("7y1t0LnmNBeXJka43XejFPLrKtQlSFATrYmy7xHaKYU=")) }, { QStringLiteral("bob@example.com"), - QStringLiteral("b03ea296e80405e2b13ec7431325f8dcb48628729677930511d853fb8469b310") }, + QByteArray::fromBase64(QByteArrayLiteral("sD6ilugEBeKxPsdDEyX43LSGKHKWd5MFEdhT+4RpsxA=")) }, { QStringLiteral("bob@example.com"), - QStringLiteral("5f9b49d43e6b11e69e404f1eaa104a023e0a5191987b7c7e88789f693058d643") } }; + QByteArray::fromBase64(QByteArrayLiteral("X5tJ1D5rEeaeQE8eqhBKAj4KUZGYe3x+iHifaTBY1kM=")) } }; future = m_trustStorage.keysForPostponedTrustDecisions(ns_omemo, - { QStringLiteral("329e98e30385dda31c977f256ff54d6dd3c5f6e70616a4b1d9ec9a12cab21ca1"), - QStringLiteral("20be62c03430aae1fbca36f94408883fe9ef622054b0d097b4a07c22929cf505") }); + { QByteArray::fromBase64(QByteArrayLiteral("Mp6Y4wOF3aMcl38lb/VNbdPF9ucGFqSx2eyaEsqyHKE=")), + QByteArray::fromBase64(QByteArrayLiteral("IL5iwDQwquH7yjb5RAiIP+nvYiBUsNCXtKB8IpKc9QU=")) }); QVERIFY(future.isFinished()); result = future.result(); QCOMPARE( @@ -481,24 +481,24 @@ void tst_QXmppTrustMemoryStorage::testKeysForPostponedTrustDecisions() false, distrustedKeys) })); - keyOwnerBobTrustedKeys.setTrustedKeys({ QStringLiteral("b03ea296e80405e2b13ec7431325f8dcb48628729677930511d853fb8469b310") }); + keyOwnerBobTrustedKeys.setTrustedKeys({ QByteArray::fromBase64(QByteArrayLiteral("sD6ilugEBeKxPsdDEyX43LSGKHKWd5MFEdhT+4RpsxA=")) }); // Invert the trust in Bob's key - // b03ea296e80405e2b13ec7431325f8dcb48628729677930511d853fb8469b310 for the + // sD6ilugEBeKxPsdDEyX43LSGKHKWd5MFEdhT+4RpsxA= for the // sending endpoint with the key - // 20be62c03430aae1fbca36f94408883fe9ef622054b0d097b4a07c22929cf505. + // IL5iwDQwquH7yjb5RAiIP+nvYiBUsNCXtKB8IpKc9QU=. m_trustStorage.addKeysForPostponedTrustDecisions( ns_omemo, - QStringLiteral("20be62c03430aae1fbca36f94408883fe9ef622054b0d097b4a07c22929cf505"), + QByteArray::fromBase64(QByteArrayLiteral("IL5iwDQwquH7yjb5RAiIP+nvYiBUsNCXtKB8IpKc9QU=")), { keyOwnerBobTrustedKeys }); trustedKeys = { { QStringLiteral("bob@example.com"), - QStringLiteral("b03ea296e80405e2b13ec7431325f8dcb48628729677930511d853fb8469b310") } }; + QByteArray::fromBase64(QByteArrayLiteral("sD6ilugEBeKxPsdDEyX43LSGKHKWd5MFEdhT+4RpsxA=")) } }; distrustedKeys = { { QStringLiteral("bob@example.com"), - QStringLiteral("5f9b49d43e6b11e69e404f1eaa104a023e0a5191987b7c7e88789f693058d643") } }; + QByteArray::fromBase64(QByteArrayLiteral("X5tJ1D5rEeaeQE8eqhBKAj4KUZGYe3x+iHifaTBY1kM=")) } }; future = m_trustStorage.keysForPostponedTrustDecisions(ns_omemo, - { QStringLiteral("20be62c03430aae1fbca36f94408883fe9ef622054b0d097b4a07c22929cf505") }); + { QByteArray::fromBase64(QByteArrayLiteral("IL5iwDQwquH7yjb5RAiIP+nvYiBUsNCXtKB8IpKc9QU=")) }); QVERIFY(future.isFinished()); result = future.result(); QCOMPARE( @@ -511,7 +511,7 @@ void tst_QXmppTrustMemoryStorage::testKeysForPostponedTrustDecisions() distrustedKeys) })); m_trustStorage.removeKeysForPostponedTrustDecisions(ns_omemo, - { QStringLiteral("329e98e30385dda31c977f256ff54d6dd3c5f6e70616a4b1d9ec9a12cab21ca1") }); + { QByteArray::fromBase64(QByteArrayLiteral("Mp6Y4wOF3aMcl38lb/VNbdPF9ucGFqSx2eyaEsqyHKE=")) }); future = m_trustStorage.keysForPostponedTrustDecisions(ns_omemo); QVERIFY(future.isFinished()); @@ -526,7 +526,7 @@ void tst_QXmppTrustMemoryStorage::testKeysForPostponedTrustDecisions() distrustedKeys) })); // Remove all OMEMO keys including those stored for sender key - // 20be62c03430aae1fbca36f94408883fe9ef622054b0d097b4a07c22929cf505. + // IL5iwDQwquH7yjb5RAiIP+nvYiBUsNCXtKB8IpKc9QU=. m_trustStorage.removeKeysForPostponedTrustDecisions(ns_omemo); future = m_trustStorage.keysForPostponedTrustDecisions(ns_omemo); @@ -535,13 +535,13 @@ void tst_QXmppTrustMemoryStorage::testKeysForPostponedTrustDecisions() QVERIFY(result.isEmpty()); trustedKeys = { { QStringLiteral("carol@example.net"), - QStringLiteral("59c2fe70432911e2be769aa0dd77776a672dcf03fc87632ac17704cc57fa2e95") }, + QByteArray::fromBase64(QByteArrayLiteral("WcL+cEMpEeK+dpqg3Xd3amctzwP8h2MqwXcEzFf6LpU=")) }, { QStringLiteral("carol@example.net"), - QStringLiteral("6c7dd1df5cf437decad5f5301b7f9b741ad53ee0df5e0b906a91ee7647dae671") } }; + QByteArray::fromBase64(QByteArrayLiteral("bH3R31z0N97K1fUwG3+bdBrVPuDfXguQapHudkfa5nE=")) } }; distrustedKeys = { { QStringLiteral("carol@example.net"), - QStringLiteral("3740764ad1ca935fec970835af3c9b4c5ce3760ec50a173eddc5e64d4feb4bc8") }, + QByteArray::fromBase64(QByteArrayLiteral("N0B2StHKk1/slwg1rzybTFzjdg7FChc+3cXmTU/rS8g=")) }, { QStringLiteral("carol@example.net"), - QStringLiteral("c2c10ddf65070a236362a4c6fc9eb7858e0dbbcb594f8d8d8b5171ae0c914398") } }; + QByteArray::fromBase64(QByteArrayLiteral("wsEN32UHCiNjYqTG/J63hY4Nu8tZT42Ni1FxrgyRQ5g=")) } }; // remaining OX keys future = m_trustStorage.keysForPostponedTrustDecisions(ns_ox); diff --git a/tests/qxmpptrustmessages/tst_qxmpptrustmessages.cpp b/tests/qxmpptrustmessages/tst_qxmpptrustmessages.cpp index f8afb940..cad26410 100644 --- a/tests/qxmpptrustmessages/tst_qxmpptrustmessages.cpp +++ b/tests/qxmpptrustmessages/tst_qxmpptrustmessages.cpp @@ -47,10 +47,10 @@ void tst_QXmppTrustMessages::testIsTrustMessageKeyOwner_data() QTest::addColumn<bool>("isValid"); QTest::newRow("valid") - << QByteArrayLiteral("<key-owner xmlns=\"urn:xmpp:tm:0\"/>") + << QByteArrayLiteral("<key-owner xmlns=\"urn:xmpp:tm:1\"/>") << true; QTest::newRow("invalidTag") - << QByteArrayLiteral("<invalid xmlns=\"urn:xmpp:tm:0\"/>") + << QByteArrayLiteral("<invalid xmlns=\"urn:xmpp:tm:1\"/>") << false; QTest::newRow("invalidNamespace") << QByteArrayLiteral("<key-owner xmlns=\"invalid\"/>") @@ -69,48 +69,48 @@ void tst_QXmppTrustMessages::testTrustMessageKeyOwner_data() { QTest::addColumn<QByteArray>("xml"); QTest::addColumn<QString>("keyOwnerJid"); - QTest::addColumn<QList<QString>>("trustedKeys"); - QTest::addColumn<QList<QString>>("distrustedKeys"); + QTest::addColumn<QList<QByteArray>>("trustedKeys"); + QTest::addColumn<QList<QByteArray>>("distrustedKeys"); QTest::newRow("trustedKeys") << QByteArrayLiteral( "<key-owner jid=\"alice@example.org\">" - "<trust>6850019d7ed0feb6d3823072498ceb4f616c6025586f8f666dc6b9c81ef7e0a4</trust>" - "<trust>221a4f8e228b72182b006e5ca527d3bddccf8d9e6feaf4ce96e1c451e8648020</trust>" + "<trust>aFABnX7Q/rbTgjBySYzrT2FsYCVYb49mbca5yB734KQ=</trust>" + "<trust>IhpPjiKLchgrAG5cpSfTvdzPjZ5v6vTOluHEUehkgCA=</trust>" "</key-owner>") << QStringLiteral("alice@example.org") - << QList<QString>({ QStringLiteral("6850019d7ed0feb6d3823072498ceb4f616c6025586f8f666dc6b9c81ef7e0a4"), - QStringLiteral("221a4f8e228b72182b006e5ca527d3bddccf8d9e6feaf4ce96e1c451e8648020") }) - << QList<QString>(); + << QList<QByteArray>({ QByteArray::fromBase64(QByteArrayLiteral("aFABnX7Q/rbTgjBySYzrT2FsYCVYb49mbca5yB734KQ=")), + QByteArray::fromBase64(QByteArrayLiteral("IhpPjiKLchgrAG5cpSfTvdzPjZ5v6vTOluHEUehkgCA=")) }) + << QList<QByteArray>(); QTest::newRow("distrustedKeys") << QByteArrayLiteral( "<key-owner jid=\"bob@example.com\">" - "<distrust>b423f5088de9a924d51b31581723d850c7cc67d0a4fe6b267c3d301ff56d2413</distrust>" - "<distrust>d9f849b6b828309c5f2c8df4f38fd891887da5aaa24a22c50d52f69b4a80817e</distrust>" + "<distrust>tCP1CI3pqSTVGzFYFyPYUMfMZ9Ck/msmfD0wH/VtJBM=</distrust>" + "<distrust>2fhJtrgoMJxfLI3084/YkYh9paqiSiLFDVL2m0qAgX4=</distrust>" "</key-owner>") << QStringLiteral("bob@example.com") - << QList<QString>() - << QList<QString>({ QStringLiteral("b423f5088de9a924d51b31581723d850c7cc67d0a4fe6b267c3d301ff56d2413"), - QStringLiteral("d9f849b6b828309c5f2c8df4f38fd891887da5aaa24a22c50d52f69b4a80817e") }); + << QList<QByteArray>() + << QList<QByteArray>({ QByteArray::fromBase64(QByteArrayLiteral("tCP1CI3pqSTVGzFYFyPYUMfMZ9Ck/msmfD0wH/VtJBM=")), + QByteArray::fromBase64(QByteArrayLiteral("2fhJtrgoMJxfLI3084/YkYh9paqiSiLFDVL2m0qAgX4=")) }); QTest::newRow("trustedAndDistrustedKeys") << QByteArrayLiteral( "<key-owner jid=\"bob@example.com\">" - "<trust>623548d3835c6d33ef5cb680f7944ef381cf712bf23a0119dabe5c4f252cd02f</trust>" - "<distrust>b423f5088de9a924d51b31581723d850c7cc67d0a4fe6b267c3d301ff56d2413</distrust>" - "<distrust>d9f849b6b828309c5f2c8df4f38fd891887da5aaa24a22c50d52f69b4a80817e</distrust>" + "<trust>YjVI04NcbTPvXLaA95RO84HPcSvyOgEZ2r5cTyUs0C8=</trust>" + "<distrust>tCP1CI3pqSTVGzFYFyPYUMfMZ9Ck/msmfD0wH/VtJBM=</distrust>" + "<distrust>2fhJtrgoMJxfLI3084/YkYh9paqiSiLFDVL2m0qAgX4=</distrust>" "</key-owner>") << QStringLiteral("bob@example.com") - << QList<QString>({ QStringLiteral("623548d3835c6d33ef5cb680f7944ef381cf712bf23a0119dabe5c4f252cd02f") }) - << QList<QString>({ QStringLiteral("b423f5088de9a924d51b31581723d850c7cc67d0a4fe6b267c3d301ff56d2413"), - QStringLiteral("d9f849b6b828309c5f2c8df4f38fd891887da5aaa24a22c50d52f69b4a80817e") }); + << QList<QByteArray>({ QByteArray::fromBase64(QByteArrayLiteral("YjVI04NcbTPvXLaA95RO84HPcSvyOgEZ2r5cTyUs0C8=")) }) + << QList<QByteArray>({ QByteArray::fromBase64(QByteArrayLiteral("tCP1CI3pqSTVGzFYFyPYUMfMZ9Ck/msmfD0wH/VtJBM=")), + QByteArray::fromBase64(QByteArrayLiteral("2fhJtrgoMJxfLI3084/YkYh9paqiSiLFDVL2m0qAgX4=")) }); } void tst_QXmppTrustMessages::testTrustMessageKeyOwner() { QFETCH(QByteArray, xml); QFETCH(QString, keyOwnerJid); - QFETCH(QList<QString>, trustedKeys); - QFETCH(QList<QString>, distrustedKeys); + QFETCH(QList<QByteArray>, trustedKeys); + QFETCH(QList<QByteArray>, distrustedKeys); QXmppTrustMessageKeyOwner keyOwner1; parsePacket(keyOwner1, xml); @@ -135,10 +135,10 @@ void tst_QXmppTrustMessages::testIsTrustMessageElement_data() QTest::addColumn<bool>("isValid"); QTest::newRow("valid") - << QByteArrayLiteral("<trust-message xmlns=\"urn:xmpp:tm:0\"/>") + << QByteArrayLiteral("<trust-message xmlns=\"urn:xmpp:tm:1\"/>") << true; QTest::newRow("invalidTag") - << QByteArrayLiteral("<invalid xmlns=\"urn:xmpp:tm:0\"/>") + << QByteArrayLiteral("<invalid xmlns=\"urn:xmpp:tm:1\"/>") << false; QTest::newRow("invalidNamespace") << QByteArrayLiteral("<trust-message xmlns=\"invalid\"/>") @@ -156,7 +156,7 @@ void tst_QXmppTrustMessages::testIsTrustMessageElement() void tst_QXmppTrustMessages::testTrustMessageElement() { const QByteArray xml(QByteArrayLiteral( - "<trust-message xmlns=\"urn:xmpp:tm:0\" usage=\"urn:xmpp:atm:1\" encryption=\"urn:xmpp:omemo:1\">" + "<trust-message xmlns=\"urn:xmpp:tm:1\" usage=\"urn:xmpp:atm:1\" encryption=\"urn:xmpp:omemo:2\">" "<key-owner jid=\"alice@example.org\"/>" "<key-owner jid=\"bob@example.com\"/>" "</trust-message>")); @@ -164,7 +164,7 @@ void tst_QXmppTrustMessages::testTrustMessageElement() QXmppTrustMessageElement trustMessageElement1; parsePacket(trustMessageElement1, xml); QCOMPARE(trustMessageElement1.usage(), QStringLiteral("urn:xmpp:atm:1")); - QCOMPARE(trustMessageElement1.encryption(), QStringLiteral("urn:xmpp:omemo:1")); + QCOMPARE(trustMessageElement1.encryption(), QStringLiteral("urn:xmpp:omemo:2")); QCOMPARE(trustMessageElement1.keyOwners().at(0).jid(), QStringLiteral("alice@example.org")); QCOMPARE(trustMessageElement1.keyOwners().at(1).jid(), QStringLiteral("bob@example.com")); serializePacket(trustMessageElement1, xml); @@ -176,21 +176,21 @@ void tst_QXmppTrustMessages::testTrustMessageElement() QXmppTrustMessageElement trustMessageElement2; trustMessageElement2.setUsage(QStringLiteral("urn:xmpp:atm:1")); - trustMessageElement2.setEncryption(QStringLiteral("urn:xmpp:omemo:1")); + trustMessageElement2.setEncryption(QStringLiteral("urn:xmpp:omemo:2")); trustMessageElement2.setKeyOwners({ keyOwner1, keyOwner2 }); QCOMPARE(trustMessageElement2.usage(), QStringLiteral("urn:xmpp:atm:1")); - QCOMPARE(trustMessageElement2.encryption(), QStringLiteral("urn:xmpp:omemo:1")); + QCOMPARE(trustMessageElement2.encryption(), QStringLiteral("urn:xmpp:omemo:2")); QCOMPARE(trustMessageElement2.keyOwners().at(0).jid(), QStringLiteral("alice@example.org")); QCOMPARE(trustMessageElement2.keyOwners().at(1).jid(), QStringLiteral("bob@example.com")); serializePacket(trustMessageElement2, xml); QXmppTrustMessageElement trustMessageElement3; trustMessageElement3.setUsage(QStringLiteral("urn:xmpp:atm:1")); - trustMessageElement3.setEncryption(QStringLiteral("urn:xmpp:omemo:1")); + trustMessageElement3.setEncryption(QStringLiteral("urn:xmpp:omemo:2")); trustMessageElement3.addKeyOwner(keyOwner1); trustMessageElement3.addKeyOwner(keyOwner2); QCOMPARE(trustMessageElement3.usage(), QStringLiteral("urn:xmpp:atm:1")); - QCOMPARE(trustMessageElement3.encryption(), QStringLiteral("urn:xmpp:omemo:1")); + QCOMPARE(trustMessageElement3.encryption(), QStringLiteral("urn:xmpp:omemo:2")); QCOMPARE(trustMessageElement3.keyOwners().at(0).jid(), QStringLiteral("alice@example.org")); QCOMPARE(trustMessageElement3.keyOwners().at(1).jid(), QStringLiteral("bob@example.com")); serializePacket(trustMessageElement3, xml); |
