diff --git a/lib/private/Repair/NC20/EncryptionLegacyCipher.php b/lib/private/Repair/NC20/EncryptionLegacyCipher.php
index 0be34679fcba94c1fb907034beed7bd0f084adff..f887feefc9806464ae4369f011c3493fd3aa4a85 100644
--- a/lib/private/Repair/NC20/EncryptionLegacyCipher.php
+++ b/lib/private/Repair/NC20/EncryptionLegacyCipher.php
@@ -58,7 +58,8 @@ class EncryptionLegacyCipher implements IRepairStep {
 			return;
 		}
 
-		if ($this->manager->isEnabled()) {
+		$masterKeyId = $this->config->getAppValue('encryption', 'masterKeyId');
+		if ($this->manager->isEnabled() || !empty($masterKeyId)) {
 			if ($this->config->getSystemValue('encryption.legacy_format_support', '') === '') {
 				$this->config->setSystemValue('encryption.legacy_format_support', true);
 			}
diff --git a/lib/private/Repair/NC20/EncryptionMigration.php b/lib/private/Repair/NC20/EncryptionMigration.php
index 1eba09f413a1e4e4bb4b1c93d37bf2af2fa8f5b0..d5879073d590805cf25d7f089745c85fd3b44c01 100644
--- a/lib/private/Repair/NC20/EncryptionMigration.php
+++ b/lib/private/Repair/NC20/EncryptionMigration.php
@@ -58,7 +58,8 @@ class EncryptionMigration implements IRepairStep {
 			return;
 		}
 
-		if ($this->manager->isEnabled()) {
+		$masterKeyId = $this->config->getAppValue('encryption', 'masterKeyId');
+		if ($this->manager->isEnabled() || !empty($masterKeyId)) {
 			if ($this->config->getSystemValue('encryption.key_storage_migrated', '') === '') {
 				$this->config->setSystemValue('encryption.key_storage_migrated', false);
 			}