Esempio n. 1
0
	/**
	 * 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;
	}
Esempio n. 2
0
 /**
  * @dataProvider providesHeadersForEncryptionModule
  */
 public function testGetEncryptionModuleId($expected, $header)
 {
     $u = new Util($this->view, $this->userManager, $this->config);
     $id = $u->getEncryptionModuleId($header);
     $this->assertEquals($expected, $id);
 }
Esempio n. 3
0
 /**
  * @dataProvider providesHeadersForEncryptionModule
  */
 public function testGetEncryptionModuleId($expected, $header)
 {
     $id = $this->util->getEncryptionModuleId($header);
     $this->assertEquals($expected, $id);
 }