aboutsummaryrefslogtreecommitdiff
path: root/lib/encryptionmanager.cpp
diff options
context:
space:
mode:
authorAlexey Andreyev <aa13q@ya.ru>2019-07-08 12:45:27 +0300
committerAlexey Andreyev <aa13q@ya.ru>2019-07-08 13:00:31 +0300
commit8c49ac34c94b53f74c23f67ce3a2720673ab2fac (patch)
tree89acd6c8b659fe3e2771d2f1f912fc740b214204 /lib/encryptionmanager.cpp
parent0bfb1c1c69c02c7936cb018ead496616322a1cf7 (diff)
downloadlibquotient-8c49ac34c94b53f74c23f67ce3a2720673ab2fac.tar.gz
libquotient-8c49ac34c94b53f74c23f67ce3a2720673ab2fac.zip
E2EE: fix uploadIdentityKeys signatures generation
Diffstat (limited to 'lib/encryptionmanager.cpp')
-rw-r--r--lib/encryptionmanager.cpp30
1 files changed, 20 insertions, 10 deletions
diff --git a/lib/encryptionmanager.cpp b/lib/encryptionmanager.cpp
index a62775d9..c2e244fc 100644
--- a/lib/encryptionmanager.cpp
+++ b/lib/encryptionmanager.cpp
@@ -112,19 +112,29 @@ void EncryptionManager::uploadIdentityKeys(Connection* connection)
d->olmAccount->ed25519IdentityKey()
}
},
- /*
- * Signatures for the device key object.
- * A map from user ID, to a map from <algorithm>:<device_id> to the signature.
- * The signature is calculated using the process called Signing JSON.
- */
+ /* signatures should be provided after the unsigned deviceKeys generation */
+ {}
+ };
+
+ QJsonObject deviceKeysJsonObject = toJson(deviceKeys);
+ /* additionally removing signatures key,
+ * since we could not initialize deviceKeys
+ * without an empty signatures value:
+ */
+ deviceKeysJsonObject.remove(QStringLiteral("signatures"));
+ /*
+ * Signatures for the device key object.
+ * A map from user ID, to a map from <algorithm>:<device_id> to the signature.
+ * The signature is calculated using the process called Signing JSON.
+ */
+ deviceKeys.signatures =
+ {
{
+ connection->userId(),
{
- connection->userId(),
{
- {
- ed25519Name + QStringLiteral(":") + connection->deviceId(),
- d->olmAccount->sign(toJson(deviceKeys))
- }
+ ed25519Name + QStringLiteral(":") + connection->deviceId(),
+ d->olmAccount->sign(deviceKeysJsonObject)
}
}
}