aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_encryption
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2014-12-17 11:12:37 +0100
committerMorris Jobke <hey@morrisjobke.de>2014-12-17 11:12:37 +0100
commitd41082f4d625ae5aa053e6f038fa498517e45ef0 (patch)
tree5d8dd7c9e8699daa4a7dbf57fa2fe57bc444a83f /apps/files_encryption
parent5b9c453071fe900529cd26b88fbc681d8b153b43 (diff)
downloadnextcloud-server-d41082f4d625ae5aa053e6f038fa498517e45ef0.tar.gz
nextcloud-server-d41082f4d625ae5aa053e6f038fa498517e45ef0.zip
first step to drop \OCP\Config:: in favour of IConfig
Diffstat (limited to 'apps/files_encryption')
-rw-r--r--apps/files_encryption/lib/helper.php4
-rwxr-xr-xapps/files_encryption/tests/crypt.php19
2 files changed, 14 insertions, 9 deletions
diff --git a/apps/files_encryption/lib/helper.php b/apps/files_encryption/lib/helper.php
index 6a8ea25d44e..b9d45f67363 100644
--- a/apps/files_encryption/lib/helper.php
+++ b/apps/files_encryption/lib/helper.php
@@ -427,7 +427,7 @@ class Helper {
*/
public static function getOpenSSLConfig() {
$config = array('private_key_bits' => 4096);
- $config = array_merge(\OCP\Config::getSystemValue('openssl', array()), $config);
+ $config = array_merge(\OC::$server->getConfig()->getSystemValue('openssl', array()), $config);
return $config;
}
@@ -460,7 +460,7 @@ class Helper {
*/
public static function getCipher() {
- $cipher = \OCP\Config::getSystemValue('cipher', Crypt::DEFAULT_CIPHER);
+ $cipher = \OC::$server->getConfig()->getSystemValue('cipher', Crypt::DEFAULT_CIPHER);
if ($cipher !== 'AES-256-CFB' && $cipher !== 'AES-128-CFB') {
\OCP\Util::writeLog('files_encryption',
diff --git a/apps/files_encryption/tests/crypt.php b/apps/files_encryption/tests/crypt.php
index 451fa62fe57..3165279c558 100755
--- a/apps/files_encryption/tests/crypt.php
+++ b/apps/files_encryption/tests/crypt.php
@@ -30,6 +30,9 @@ class Crypt extends TestCase {
public $genPrivateKey;
public $genPublicKey;
+ /** @var \OCP\IConfig */
+ private $config;
+
public static function setUpBeforeClass() {
parent::setUpBeforeClass();
@@ -65,6 +68,8 @@ class Crypt extends TestCase {
// we don't want to tests with app files_trashbin enabled
\OC_App::disable('files_trashbin');
+
+ $this->config = \OC::$server->getConfig();
}
protected function tearDown() {
@@ -76,7 +81,7 @@ class Crypt extends TestCase {
}
$this->assertTrue(\OC_FileProxy::$enabled);
- \OCP\Config::deleteSystemValue('cipher');
+ $this->config->deleteSystemValue('cipher');
parent::tearDown();
}
@@ -198,14 +203,14 @@ class Crypt extends TestCase {
$filename = 'tmp-' . $this->getUniqueID() . '.test';
- \OCP\Config::setSystemValue('cipher', 'AES-128-CFB');
+ $this->config->setSystemValue('cipher', 'AES-128-CFB');
$cryptedFile = file_put_contents('crypt:///' . $this->userId . '/files/'. $filename, $this->dataShort);
// Test that data was successfully written
$this->assertTrue(is_int($cryptedFile));
- \OCP\Config::deleteSystemValue('cipher');
+ $this->config->deleteSystemValue('cipher');
// Disable encryption proxy to prevent recursive calls
$proxyStatus = \OC_FileProxy::$enabled;
@@ -282,7 +287,7 @@ class Crypt extends TestCase {
// Generate a a random filename
$filename = 'tmp-' . $this->getUniqueID() . '.test';
- \OCP\Config::setSystemValue('cipher', 'AES-128-CFB');
+ $this->config->setSystemValue('cipher', 'AES-128-CFB');
// Save long data as encrypted file using stream wrapper
$cryptedFile = file_put_contents('crypt:///' . $this->userId . '/files/' . $filename, $this->dataLong . $this->dataLong);
@@ -294,7 +299,7 @@ class Crypt extends TestCase {
$proxyStatus = \OC_FileProxy::$enabled;
\OC_FileProxy::$enabled = false;
- \OCP\Config::deleteSystemValue('cipher');
+ $this->config->deleteSystemValue('cipher');
// Get file contents without using any wrapper to get it's actual contents on disk
$retreivedCryptedFile = $this->view->file_get_contents($this->userId . '/files/' . $filename);
@@ -326,12 +331,12 @@ class Crypt extends TestCase {
// Generate a a random filename
$filename = 'tmp-' . $this->getUniqueID() . '.test';
- \OCP\Config::setSystemValue('cipher', 'AES-128-CFB');
+ $this->config->setSystemValue('cipher', 'AES-128-CFB');
// Save long data as encrypted file using stream wrapper
$cryptedFile = file_put_contents('crypt:///' . $this->userId . '/files/' . $filename, $this->dataLong . $this->dataLong);
- \OCP\Config::deleteSystemValue('cipher');
+ $this->config->deleteSystemValue('cipher');
// Test that data was successfully written
$this->assertTrue(is_int($cryptedFile));