From 864b4b2646f8f5daaaeb0810e4668ba6700071fa Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Fri, 8 Apr 2022 05:11:24 +0200 Subject: [PATCH] Fix SSSS if another client used the wrong base64 format --- CMakeLists.txt | 2 +- io.github.NhekoReborn.Nheko.yaml | 2 +- src/ChatPage.cpp | 8 ++++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a4b72e98..6b16f008 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -401,7 +401,7 @@ if(USE_BUNDLED_MTXCLIENT) FetchContent_Declare( MatrixClient GIT_REPOSITORY https://github.com/Nheko-Reborn/mtxclient.git - GIT_TAG c5e8def06f0fc64aa150f30d5c9c366e876120e1 + GIT_TAG 8781d1a13b8ac3771d39d402449c5c06bf68b73a ) set(BUILD_LIB_EXAMPLES OFF CACHE INTERNAL "") set(BUILD_LIB_TESTS OFF CACHE INTERNAL "") diff --git a/io.github.NhekoReborn.Nheko.yaml b/io.github.NhekoReborn.Nheko.yaml index 78096ef3..732a9bc9 100644 --- a/io.github.NhekoReborn.Nheko.yaml +++ b/io.github.NhekoReborn.Nheko.yaml @@ -176,7 +176,7 @@ modules: buildsystem: cmake-ninja name: mtxclient sources: - - commit: c5e8def06f0fc64aa150f30d5c9c366e876120e1 + - commit: 8781d1a13b8ac3771d39d402449c5c06bf68b73a #tag: v0.7.0 type: git url: https://github.com/Nheko-Reborn/mtxclient.git diff --git a/src/ChatPage.cpp b/src/ChatPage.cpp index 0550c7f3..5425d527 100644 --- a/src/ChatPage.cpp +++ b/src/ChatPage.cpp @@ -1155,8 +1155,8 @@ ChatPage::decryptDownloadedSecrets(mtx::secret_storage::AesHmacSha2KeyDescriptio stripped.remove(' '); stripped.remove('\n'); stripped.remove('\t'); - auto decryptionKey = mtx::crypto::key_from_recoverykey(stripped.toStdString(), keyDesc); + auto decryptionKey = mtx::crypto::key_from_recoverykey(stripped.toStdString(), keyDesc); if (!decryptionKey && keyDesc.passphrase) { try { decryptionKey = mtx::crypto::key_from_passphrase(text.toStdString(), keyDesc); @@ -1180,6 +1180,8 @@ ChatPage::decryptDownloadedSecrets(mtx::secret_storage::AesHmacSha2KeyDescriptio for (const auto &[secretName, encryptedSecret] : secrets) { auto decrypted = mtx::crypto::decrypt(encryptedSecret, *decryptionKey, secretName); + nhlog::crypto()->debug("Secret {} decrypted: {}", secretName, !decrypted.empty()); + if (!decrypted.empty()) { cache::storeSecret(secretName, decrypted); @@ -1222,7 +1224,8 @@ ChatPage::decryptDownloadedSecrets(mtx::secret_storage::AesHmacSha2KeyDescriptio } } - if (!req.signatures.empty()) + if (!req.signatures.empty()) { + nhlog::crypto()->debug("Uploading new signatures: {}", json(req).dump(2)); http::client()->keys_signatures_upload( req, [](const mtx::responses::KeySignaturesUpload &res, mtx::http::RequestErr err) { if (err) { @@ -1240,6 +1243,7 @@ ChatPage::decryptDownloadedSecrets(mtx::secret_storage::AesHmacSha2KeyDescriptio mtx::errors::to_string(e.errcode), e.error); }); + } } void