Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3102350
D12913.id42866.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D12913.id42866.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
@@ -77,9 +77,6 @@
encrypt(const std::string &targetDeviceId, const std::string &content);
std::string
decrypt(const std::string &targetDeviceId, EncryptedData &encryptedData);
- std::string decryptSequential(
- const std::string &targetDeviceId,
- EncryptedData &encryptedData);
std::string signMessage(const std::string &message);
static void verifySignature(
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
@@ -414,16 +414,6 @@
return this->sessions.at(targetDeviceId)->decrypt(encryptedData);
}
-std::string CryptoModule::decryptSequential(
- const std::string &targetDeviceId,
- EncryptedData &encryptedData) {
- if (!this->hasSessionFor(targetDeviceId)) {
- throw std::runtime_error{
- "error decrypt sequential => uninitialized session"};
- }
- return this->sessions.at(targetDeviceId)->decryptSequential(encryptedData);
-}
-
std::string CryptoModule::signMessage(const std::string &message) {
OlmBuffer signature;
signature.resize(::olm_account_signature_length(this->getOlmAccount()));
diff --git a/native/cpp/CommonCpp/CryptoTools/Session.h b/native/cpp/CommonCpp/CryptoTools/Session.h
--- a/native/cpp/CommonCpp/CryptoTools/Session.h
+++ b/native/cpp/CommonCpp/CryptoTools/Session.h
@@ -33,7 +33,6 @@
restoreFromB64(const std::string &secretKey, OlmBuffer &b64);
OlmSession *getOlmSession();
std::string decrypt(EncryptedData &encryptedData);
- std::string decryptSequential(EncryptedData &encryptedData);
int getVersion();
void setVersion(int newVersion);
};
diff --git a/native/cpp/CommonCpp/CryptoTools/Session.cpp b/native/cpp/CommonCpp/CryptoTools/Session.cpp
--- a/native/cpp/CommonCpp/CryptoTools/Session.cpp
+++ b/native/cpp/CommonCpp/CryptoTools/Session.cpp
@@ -179,51 +179,6 @@
return std::string{(char *)decryptedMessage.data(), decryptedSize};
}
-std::string Session::decryptSequential(EncryptedData &encryptedData) {
- OlmSession *session = this->getOlmSession();
-
- OlmBuffer utilityBuffer(::olm_utility_size());
- OlmUtility *olmUtility = ::olm_utility(utilityBuffer.data());
-
- OlmBuffer messageHashBuffer(::olm_sha256_length(olmUtility));
- ::olm_sha256(
- olmUtility,
- encryptedData.message.data(),
- encryptedData.message.size(),
- messageHashBuffer.data(),
- messageHashBuffer.size());
-
- OlmBuffer tmpEncryptedMessage(encryptedData.message);
- size_t maxSize = ::olm_decrypt_max_plaintext_length(
- session,
- encryptedData.messageType,
- tmpEncryptedMessage.data(),
- tmpEncryptedMessage.size());
-
- if (maxSize == -1) {
- throw std::runtime_error{
- "error decrypt_max_plaintext_length => " +
- std::string{::olm_session_last_error(session)} + ". Hash: " +
- std::string{messageHashBuffer.begin(), messageHashBuffer.end()}};
- }
-
- OlmBuffer decryptedMessage(maxSize);
- size_t decryptedSize = ::olm_decrypt_sequential(
- session,
- encryptedData.messageType,
- encryptedData.message.data(),
- encryptedData.message.size(),
- decryptedMessage.data(),
- decryptedMessage.size());
- if (decryptedSize == -1) {
- throw std::runtime_error{
- "error decrypt_sequential => " +
- std::string{::olm_session_last_error(session)} + ". Hash: " +
- std::string{messageHashBuffer.begin(), messageHashBuffer.end()}};
- }
- return std::string{(char *)decryptedMessage.data(), decryptedSize};
-}
-
int Session::getVersion() {
return this->version;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Oct 31, 10:33 AM (20 h, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2391252
Default Alt Text
D12913.id42866.diff (3 KB)
Attached To
Mode
D12913: [CryptoModule] remove `decryptSequential` API
Attached
Detach File
Event Timeline
Log In to Comment