aboutsummaryrefslogtreecommitdiff
path: root/lib/events/encryptedfile.cpp
diff options
context:
space:
mode:
authorTobias Fella <fella@posteo.de>2022-03-10 21:19:49 +0100
committerTobias Fella <fella@posteo.de>2022-03-10 21:41:11 +0100
commit71eed90fdea8689d237da8de1bf385202b85cffd (patch)
treee267e137e09c5d0461c7e95e90a98b4c5ac36f0d /lib/events/encryptedfile.cpp
parent7ba17e2b9b6d76aeea250f37c833ad7eed2f61da (diff)
downloadlibquotient-71eed90fdea8689d237da8de1bf385202b85cffd.tar.gz
libquotient-71eed90fdea8689d237da8de1bf385202b85cffd.zip
More work; Update olm pickle & timestamps in database; Remove TODOs
Diffstat (limited to 'lib/events/encryptedfile.cpp')
-rw-r--r--lib/events/encryptedfile.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/events/encryptedfile.cpp b/lib/events/encryptedfile.cpp
index e90be428..bb4e26c7 100644
--- a/lib/events/encryptedfile.cpp
+++ b/lib/events/encryptedfile.cpp
@@ -56,6 +56,7 @@ QByteArray EncryptedFile::decryptFile(const QByteArray& ciphertext) const
std::pair<EncryptedFile, QByteArray> EncryptedFile::encryptFile(const QByteArray &plainText)
{
+#ifdef Quotient_E2EE_ENABLED
QByteArray k = getRandom(32);
auto kBase64 = k.toBase64();
QByteArray iv = getRandom(16);
@@ -73,6 +74,9 @@ std::pair<EncryptedFile, QByteArray> EncryptedFile::encryptFile(const QByteArray
auto ivBase64 = iv.toBase64();
EncryptedFile file = {{}, key, ivBase64.left(ivBase64.indexOf('=')), {{QStringLiteral("sha256"), hash.left(hash.indexOf('='))}}, "v2"_ls};
return {file, cipherText};
+#else
+ return {{}, {}};
+#endif
}
void JsonObjectConverter<EncryptedFile>::dumpTo(QJsonObject& jo,