From e8db4017b8640762880212197dc489b5ff4389bc Mon Sep 17 00:00:00 2001 From: Stefan Weiberg Date: Thu, 11 Oct 2018 20:24:36 +0200 Subject: [PATCH] backport of #10778 Adding a check to see if keyFileContents is empty: * this fixes a download error and an exception if the data content for encryption is empty * #3958: for recovering encrypted files with a damaged signature this is necessary in addition to turning the signature check off Signed-off-by: Stefan Weiberg --- apps/encryption/lib/Crypto/Crypt.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apps/encryption/lib/Crypto/Crypt.php b/apps/encryption/lib/Crypto/Crypt.php index 49b1bcb41aa..70c99f808ba 100644 --- a/apps/encryption/lib/Crypto/Crypt.php +++ b/apps/encryption/lib/Crypto/Crypt.php @@ -457,6 +457,10 @@ class Crypt { * @throws DecryptionFailedException */ public function symmetricDecryptFileContent($keyFileContents, $passPhrase, $cipher = self::DEFAULT_CIPHER, $version = 0, $position = 0) { + if ($keyFileContents == '') { + return ''; + } + $catFile = $this->splitMetaData($keyFileContents, $cipher); if ($catFile['signature'] !== false) {