Skip to content

Commit a16a9c0

Browse files
mgallienbackportbot[bot]
authored andcommitted
fix(e2ee): fix certificate migration
ensure we do store in the metadata file the properly encrypted metadata key ensure we would update the user own certificate before eventually encrypting again the metadata key do this before we would try to write the metadata file and ensure it is writtent with updated values instead of getting a copy of the old values (before the certificate change) Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com> [skip ci]
1 parent 40fe086 commit a16a9c0

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/libsync/foldermetadata.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,16 @@ QByteArray FolderMetadata::encryptedMetadata()
602602
return {};
603603
}
604604

605+
if (_isRootEncryptedFolder) {
606+
for (auto &folderUser : _folderUsers) {
607+
if (folderUser.userId == _account->davUser()) {
608+
folderUser.certificatePem = _account->e2e()->getCertificate().toPem();
609+
}
610+
}
611+
612+
updateUsersEncryptedMetadataKey();
613+
}
614+
605615
QJsonObject files, folders;
606616
for (auto it = _files.constBegin(), end = _files.constEnd(); it != end; ++it) {
607617
const auto file = convertFileToJsonObject(&(*it));

0 commit comments

Comments
 (0)