Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F7679149
D227.1756657460.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D227.1756657460.diff
View Options
diff --git a/src/crypto/crypto.cpp b/src/crypto/crypto.cpp
--- a/src/crypto/crypto.cpp
+++ b/src/crypto/crypto.cpp
@@ -382,11 +382,11 @@
auto key = nlohmann::json::object();
if (!(cast(key, data, "algorithm", identValidate([](const auto &j) {
- return j == "m.megolm.v1.aes-sha2";
+ return j == megOlmAlgo;
})) && cast(key, data, "room_id", validateStr)
- && cast(key, data, "sender_key", validateStr)
- && cast(key, data, "session_id", validateStr)
&& cast(key, data, "session_key", validateStr)
+ && cast(key, data, "session_id", validateStr)
+ && cast(key, data, "/sender_claimed_keys/ed25519"_json_pointer, validateStr)
)) {
continue;
}
@@ -398,7 +398,7 @@
if (createInboundGroupSession(
keyOfGroupSession,
key["session_key"].template get<std::string>(),
- key["sender_key"].template get<std::string>()
+ key["sender_claimed_keys"]["ed25519"].template get<std::string>()
)) {
++count;
}
diff --git a/src/tests/crypto/key-export-test.cpp b/src/tests/crypto/key-export-test.cpp
--- a/src/tests/crypto/key-export-test.cpp
+++ b/src/tests/crypto/key-export-test.cpp
@@ -8,6 +8,7 @@
#include <catch2/catch_test_macros.hpp>
#include <key-export.hpp>
#include <crypto.hpp>
+#include <crypto-util.hpp>
using namespace Kazv;
@@ -140,7 +141,7 @@
auto exportJson = nlohmann::json{
{
{"algorithm", "m.megolm.v1.aes-sha2"},
- {"forwarding_curve25519_key_chain", {}},
+ {"forwarding_curve25519_key_chain", nlohmann::json::array()},
{"room_id", roomId},
{"sender_claimed_keys", {
{"ed25519", a.ed25519IdentityKey()},
@@ -156,6 +157,16 @@
{
auto res = b.importInboundGroupSessions(exportJson);
REQUIRE(res == 1);
+ auto encryptedEvent = nlohmann::json{
+ {"content", encryptedContent},
+ {"algorithm", CryptoConstants::megOlmAlgo},
+ {"room_id", roomId},
+ {"event_id", "!abc"},
+ {"origin_server_ts", 1000},
+ };
+ auto decrypted = b.decrypt(encryptedEvent);
+ REQUIRE(decrypted.has_value());
+ REQUIRE(nlohmann::json::parse(decrypted.value()) == plainText);
}
WHEN("importing empty array")
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Aug 31, 9:24 AM (4 h, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
435739
Default Alt Text
D227.1756657460.diff (2 KB)
Attached To
Mode
D227: Fix sender key import from key-export format
Attached
Detach File
Event Timeline
Log In to Comment