Ejemplo n.º 1
0
 /**
  * check if encrypted file contain a encryption header
  *
  * @param string $path
  * @return boolean
  */
 private function containHeader($path)
 {
     // Disable encryption proxy to read the raw data
     $proxyStatus = \OC_FileProxy::$enabled;
     \OC_FileProxy::$enabled = false;
     $isHeader = false;
     $handle = $this->view->fopen($path, 'r');
     if (is_resource($handle)) {
         $firstBlock = fread($handle, Crypt::BLOCKSIZE);
         $isHeader = Crypt::isHeader($firstBlock);
     }
     \OC_FileProxy::$enabled = $proxyStatus;
     return $isHeader;
 }