diff options
Diffstat (limited to 'lib/private/encryption/util.php')
-rw-r--r-- | lib/private/encryption/util.php | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/private/encryption/util.php b/lib/private/encryption/util.php index e7cf607c7b1..2eed2f7ca35 100644 --- a/lib/private/encryption/util.php +++ b/lib/private/encryption/util.php @@ -24,6 +24,7 @@ namespace OC\Encryption; use OC\Encryption\Exceptions\EncryptionHeaderKeyExistsException; use OC\Encryption\Exceptions\EncryptionHeaderToLargeException; +use OC\Encryption\Exceptions\ModuleDoesNotExistsException; use OC\Files\View; use OCP\Encryption\IEncryptionModule; use OCP\IConfig; @@ -92,6 +93,7 @@ class Util { * * @param array $header * @return string + * @throws ModuleDoesNotExistsException */ public function getEncryptionModuleId(array $header = null) { $id = ''; @@ -99,6 +101,14 @@ class Util { if (isset($header[$encryptionModuleKey])) { $id = $header[$encryptionModuleKey]; + } elseif (isset($header['cipher'])) { + if (class_exists('\OCA\Encryption\Crypto\Encryption')) { + // fall back to default encryption if the user migrated from + // ownCloud <= 8.0 with the old encryption + $id = \OCA\Encryption\Crypto\Encryption::ID; + } else { + throw new ModuleDoesNotExistsException('ownCloud default encryption module missing'); + } } return $id; |