Skip to content

Commit a60d130

Browse files
mgallienbackportbot[bot]
authored andcommitted
feat(e2ee): add basic support for e2ee metadata format 2.1
add ability to use encrypted root folder with 2.1 metadata format this is lacking ability to create public encrypted share link Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
1 parent ead8d4e commit a60d130

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

src/libsync/foldermetadata.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,8 @@ void FolderMetadata::setupVersionFromExistingMetadata(const QByteArray &metadata
409409
_existingMetadataVersion = MetadataVersion::Version1_2;
410410
} else if (versionStringFromMetadata == QStringLiteral("2.0") || versionStringFromMetadata == QStringLiteral("2")) {
411411
_existingMetadataVersion = MetadataVersion::Version2_0;
412+
} else if (versionStringFromMetadata == QStringLiteral("2.1")) {
413+
_existingMetadataVersion = MetadataVersion::Version2_1;
412414
} else if (versionStringFromMetadata == QStringLiteral("1.0")
413415
|| versionStringFromMetadata == QStringLiteral("1.1")) {
414416
// We used to have an intermediate 1.1 after applying a security-vulnerability fix for metadata keys.
@@ -838,6 +840,7 @@ quint64 FolderMetadata::newCounter() const
838840
EncryptionStatusEnums::ItemEncryptionStatus FolderMetadata::fromMedataVersionToItemEncryptionStatus(const MetadataVersion metadataVersion)
839841
{
840842
switch (metadataVersion) {
843+
case FolderMetadata::MetadataVersion::Version2_1:
841844
case FolderMetadata::MetadataVersion::Version2_0:
842845
return SyncFileItem::EncryptionStatus::EncryptedMigratedV2_0;
843846
case FolderMetadata::MetadataVersion::Version1_2:

src/libsync/foldermetadata.h

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,6 @@ class OWNCLOUDSYNC_EXPORT FolderMetadata : public QObject
3636
QByteArray encryptedMetadataKey;
3737
};
3838

39-
// based on api-version and "version" key in metadata JSON
40-
enum MetadataVersion {
41-
VersionUndefined = -1,
42-
Version1,
43-
Version1_2,
44-
Version2_0,
45-
};
46-
4739
struct UserWithFileDropEntryAccess {
4840
QString userId;
4941
QByteArray decryptedFiledropKey;
@@ -90,6 +82,16 @@ class OWNCLOUDSYNC_EXPORT FolderMetadata : public QObject
9082
};
9183
Q_ENUM(CertificateType)
9284

85+
// based on api-version and "version" key in metadata JSON
86+
enum class MetadataVersion {
87+
VersionUndefined = -1,
88+
Version1,
89+
Version1_2,
90+
Version2_0,
91+
Version2_1,
92+
};
93+
Q_ENUM(MetadataVersion)
94+
9395
FolderMetadata(AccountPtr account, const QString &remoteFolderRoot, FolderType folderType = FolderType::Nested);
9496
/*
9597
* construct metadata based on RootEncryptedFolderInfo

0 commit comments

Comments
 (0)