diff --git a/apps/files_encryption/hooks/hooks.php b/apps/files_encryption/hooks/hooks.php
index 8fae901fe63202e113d12eb17fb9f51b8e1d8457..d1ee4a97d15a3d06105851bff2865a2ad9e76a93 100644
--- a/apps/files_encryption/hooks/hooks.php
+++ b/apps/files_encryption/hooks/hooks.php
@@ -99,12 +99,14 @@ class Hooks {
 
 			// Set legacy encryption key if it exists, to support
 			// depreciated encryption system
-			$encLegacyKey = $userView->file_get_contents('encryption.key');
-			if ($encLegacyKey) {
+			if ($userView->file_exists('encryption.key')) {
+				$encLegacyKey = $userView->file_get_contents('encryption.key');
+				if ($encLegacyKey) {
 
-				$plainLegacyKey = Crypt::legacyDecrypt($encLegacyKey, $params['password']);
+					$plainLegacyKey = Crypt::legacyDecrypt($encLegacyKey, $params['password']);
 
-				$session->setLegacyKey($plainLegacyKey);
+					$session->setLegacyKey($plainLegacyKey);
+				}
 			}
 
 			// Encrypt existing user files