/** * read encryption module needed to read/write the file located at $path * * @param string $path * @return null|\OCP\Encryption\IEncryptionModule * @throws ModuleDoesNotExistsException * @throws \Exception */ protected function getEncryptionModule($path) { $encryptionModule = null; $header = $this->getHeader($path); $encryptionModuleId = $this->util->getEncryptionModuleId($header); if (!empty($encryptionModuleId)) { try { $encryptionModule = $this->encryptionManager->getEncryptionModule($encryptionModuleId); } catch (ModuleDoesNotExistsException $e) { $this->logger->critical('Encryption module defined in "' . $path . '" not loaded!'); throw $e; } } return $encryptionModule; }
/** * @dataProvider providesHeadersForEncryptionModule */ public function testGetEncryptionModuleId($expected, $header) { $u = new Util($this->view, $this->userManager, $this->config); $id = $u->getEncryptionModuleId($header); $this->assertEquals($expected, $id); }
/** * @dataProvider providesHeadersForEncryptionModule */ public function testGetEncryptionModuleId($expected, $header) { $id = $this->util->getEncryptionModuleId($header); $this->assertEquals($expected, $id); }