Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33150552
D14618.1768511713.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D14618.1768511713.diff
View Options
diff --git a/native/cpp/CommonCpp/CryptoTools/CryptoModule.h b/native/cpp/CommonCpp/CryptoTools/CryptoModule.h
--- a/native/cpp/CommonCpp/CryptoTools/CryptoModule.h
+++ b/native/cpp/CommonCpp/CryptoTools/CryptoModule.h
@@ -83,7 +83,7 @@
std::string signMessage(const std::string &message);
static void verifySignature(
const std::string &publicKey,
- const std::string &message,
+ const OlmBuffer &message,
const std::string &signature);
std::optional<std::string> validatePrekey();
};
diff --git a/native/cpp/CommonCpp/CryptoTools/CryptoModule.cpp b/native/cpp/CommonCpp/CryptoTools/CryptoModule.cpp
--- a/native/cpp/CommonCpp/CryptoTools/CryptoModule.cpp
+++ b/native/cpp/CommonCpp/CryptoTools/CryptoModule.cpp
@@ -449,7 +449,7 @@
void CryptoModule::verifySignature(
const std::string &publicKey,
- const std::string &message,
+ const OlmBuffer &message,
const std::string &signature) {
OlmBuffer utilityBuffer;
utilityBuffer.resize(::olm_utility_size());
@@ -458,8 +458,8 @@
olmUtility,
(uint8_t *)publicKey.data(),
publicKey.length(),
- (uint8_t *)message.data(),
- message.length(),
+ message.data(),
+ message.size(),
(uint8_t *)signature.data(),
signature.length());
if (verificationResult == -1) {
@@ -470,7 +470,7 @@
std::optional<std::string> CryptoModule::validatePrekey() {
static const uint64_t maxPrekeyPublishTime = 30 * 24 * 60 * 60; // 30 days
- static const uint64_t maxOldPrekeyAge = 24 * 60 * 60; // 24 hours
+ static const uint64_t maxOldPrekeyAge = 24 * 60 * 60; // 24 hours
std::optional<std::string> maybeNewPrekey;
bool prekeyDoesntExist = this->prekeyDoesntExist();
diff --git a/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp b/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp
--- a/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp
+++ b/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp
@@ -2073,8 +2073,10 @@
taskType job = [=, &innerRt]() {
std::string error;
try {
+ crypto::OlmBuffer messageBuffer(
+ messageStr.begin(), messageStr.end());
crypto::CryptoModule::verifySignature(
- keyStr, messageStr, signatureStr);
+ keyStr, messageBuffer, signatureStr);
} catch (const std::exception &e) {
error = "verifying signature failed with: " + std::string(e.what());
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jan 15, 9:15 PM (8 h, 25 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5940081
Default Alt Text
D14618.1768511713.diff (2 KB)
Attached To
Mode
D14618: [native] Make CryptoModule::verifySignature accept OlmBuffer message
Attached
Detach File
Event Timeline
Log In to Comment