diff --git a/apps/files_encryption/lib/util.php b/apps/files_encryption/lib/util.php
index 3cf83703295841627ae751993e43d110730aa01e..410d3dd125553f05ff766626325eaf19dcf93942 100644
--- a/apps/files_encryption/lib/util.php
+++ b/apps/files_encryption/lib/util.php
@@ -398,7 +398,8 @@ class Util {
 			// we set the cipher
 			// and we update the size
 			if ($this->containHeader($path)) {
-				$header = fread($stream,Crypt::BLOCKSIZE);
+				$data = fread($stream,Crypt::BLOCKSIZE);
+				$header = Crypt::parseHeader($data);
 				$cipher = Crypt::getCipher($header);
 				$size -= Crypt::BLOCKSIZE;
 			}