]> source.dussan.org Git - nextcloud-server.git/commitdiff
backport of #10778 11783/head
authorStefan Weiberg <sweiberg@suse.com>
Thu, 11 Oct 2018 18:24:36 +0000 (20:24 +0200)
committerRoeland Jago Douma <roeland@famdouma.nl>
Wed, 24 Oct 2018 07:08:03 +0000 (09:08 +0200)
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 <sweiberg@suse.com>
apps/encryption/lib/Crypto/Crypt.php

index 49b1bcb41aa8ea7344140294d7f13ed95d5312d1..70c99f808ba3189703daa34ed1d7297e1bbcf489 100644 (file)
@@ -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) {