summaryrefslogtreecommitdiffstats
path: root/apps/files_encryption/lib
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2014-12-03 16:52:44 +0100
committerJoas Schilling <nickvergessen@gmx.de>2014-12-09 09:47:26 +0100
commitefac8ced90879f34919eb55055423523b146d33e (patch)
treeee2778caa0a8ddf5c181a590625d98081e0c7d63 /apps/files_encryption/lib
parent78a307995c510c0184d915fcab26baa3be815342 (diff)
downloadnextcloud-server-efac8ced90879f34919eb55055423523b146d33e.tar.gz
nextcloud-server-efac8ced90879f34919eb55055423523b146d33e.zip
Update OCA\Encryption to OCA\Files_Encryption in the encryption app itself
Diffstat (limited to 'apps/files_encryption/lib')
-rw-r--r--apps/files_encryption/lib/crypt.php10
-rw-r--r--apps/files_encryption/lib/helper.php62
-rw-r--r--apps/files_encryption/lib/hooks.php18
-rw-r--r--apps/files_encryption/lib/keymanager.php15
-rw-r--r--apps/files_encryption/lib/migration.php4
-rw-r--r--apps/files_encryption/lib/proxy.php6
-rw-r--r--apps/files_encryption/lib/session.php10
-rw-r--r--apps/files_encryption/lib/stream.php23
-rw-r--r--apps/files_encryption/lib/util.php20
9 files changed, 83 insertions, 85 deletions
diff --git a/apps/files_encryption/lib/crypt.php b/apps/files_encryption/lib/crypt.php
index 34b676dba2c..38993ba65b0 100644
--- a/apps/files_encryption/lib/crypt.php
+++ b/apps/files_encryption/lib/crypt.php
@@ -133,7 +133,7 @@ class Crypt {
* Check if a file's contents contains an IV and is symmetrically encrypted
* @param string $content
* @return boolean
- * @note see also OCA\Encryption\Util->isEncryptedPath()
+ * @note see also \OCA\Files_Encryption\Util->isEncryptedPath()
*/
public static function isCatfileContent($content) {
@@ -190,7 +190,7 @@ class Crypt {
* @param string $passphrase
* @param string $cypher used for encryption, currently we support AES-128-CFB and AES-256-CFB
* @return string encrypted file content
- * @throws \OCA\Encryption\Exception\EncryptionException
+ * @throws \OCA\Files_Encryption\Exception\EncryptionException
*/
private static function encrypt($plainContent, $iv, $passphrase = '', $cipher = Crypt::DEFAULT_CIPHER) {
@@ -379,7 +379,7 @@ class Crypt {
* @param string $plainContent content to be encrypted
* @param array $publicKeys array keys must be the userId of corresponding user
* @return array keys: keys (array, key = userId), data
- * @throws \OCA\Encryption\Exception\MultiKeyEncryptException if encryption failed
+ * @throws \OCA\Files_Encryption\Exception\MultiKeyEncryptException if encryption failed
* @note symmetricDecryptFileContent() can decrypt files created using this method
*/
public static function multiKeyEncrypt($plainContent, array $publicKeys) {
@@ -425,7 +425,7 @@ class Crypt {
* @param string $encryptedContent
* @param string $shareKey
* @param mixed $privateKey
- * @throws \OCA\Encryption\Exception\MultiKeyDecryptException if decryption failed
+ * @throws \OCA\Files_Encryption\Exception\MultiKeyDecryptException if decryption failed
* @internal param string $plainContent contains decrypted content
* @return string $plainContent decrypted string
* @note symmetricDecryptFileContent() can be used to decrypt files created using this method
@@ -554,7 +554,7 @@ class Crypt {
* get chiper from header
*
* @param array $header
- * @throws \OCA\Encryption\Exception\EncryptionException
+ * @throws \OCA\Files_Encryption\Exception\EncryptionException
*/
public static function getCipher($header) {
$cipher = isset($header['cipher']) ? $header['cipher'] : 'AES-128-CFB';
diff --git a/apps/files_encryption/lib/helper.php b/apps/files_encryption/lib/helper.php
index b1147a0eb52..6a8ea25d44e 100644
--- a/apps/files_encryption/lib/helper.php
+++ b/apps/files_encryption/lib/helper.php
@@ -27,7 +27,7 @@ namespace OCA\Files_Encryption;
/**
* Class to manage registration of hooks an various helper methods
- * @package OCA\Encryption
+ * @package OCA\Files_Encryption
*/
class Helper {
@@ -39,9 +39,9 @@ class Helper {
*/
public static function registerShareHooks() {
- \OCP\Util::connectHook('OCP\Share', 'pre_shared', 'OCA\Encryption\Hooks', 'preShared');
- \OCP\Util::connectHook('OCP\Share', 'post_shared', 'OCA\Encryption\Hooks', 'postShared');
- \OCP\Util::connectHook('OCP\Share', 'post_unshare', 'OCA\Encryption\Hooks', 'postUnshare');
+ \OCP\Util::connectHook('OCP\Share', 'pre_shared', 'OCA\Files_Encryption\Hooks', 'preShared');
+ \OCP\Util::connectHook('OCP\Share', 'post_shared', 'OCA\Files_Encryption\Hooks', 'postShared');
+ \OCP\Util::connectHook('OCP\Share', 'post_unshare', 'OCA\Files_Encryption\Hooks', 'postUnshare');
}
/**
@@ -50,12 +50,12 @@ class Helper {
*/
public static function registerUserHooks() {
- \OCP\Util::connectHook('OC_User', 'post_login', 'OCA\Encryption\Hooks', 'login');
- \OCP\Util::connectHook('OC_User', 'logout', 'OCA\Encryption\Hooks', 'logout');
- \OCP\Util::connectHook('OC_User', 'post_setPassword', 'OCA\Encryption\Hooks', 'setPassphrase');
- \OCP\Util::connectHook('OC_User', 'pre_setPassword', 'OCA\Encryption\Hooks', 'preSetPassphrase');
- \OCP\Util::connectHook('OC_User', 'post_createUser', 'OCA\Encryption\Hooks', 'postCreateUser');
- \OCP\Util::connectHook('OC_User', 'post_deleteUser', 'OCA\Encryption\Hooks', 'postDeleteUser');
+ \OCP\Util::connectHook('OC_User', 'post_login', 'OCA\Files_Encryption\Hooks', 'login');
+ \OCP\Util::connectHook('OC_User', 'logout', 'OCA\Files_Encryption\Hooks', 'logout');
+ \OCP\Util::connectHook('OC_User', 'post_setPassword', 'OCA\Files_Encryption\Hooks', 'setPassphrase');
+ \OCP\Util::connectHook('OC_User', 'pre_setPassword', 'OCA\Files_Encryption\Hooks', 'preSetPassphrase');
+ \OCP\Util::connectHook('OC_User', 'post_createUser', 'OCA\Files_Encryption\Hooks', 'postCreateUser');
+ \OCP\Util::connectHook('OC_User', 'post_deleteUser', 'OCA\Files_Encryption\Hooks', 'postDeleteUser');
}
/**
@@ -64,15 +64,15 @@ class Helper {
*/
public static function registerFilesystemHooks() {
- \OCP\Util::connectHook('OC_Filesystem', 'rename', 'OCA\Encryption\Hooks', 'preRename');
- \OCP\Util::connectHook('OC_Filesystem', 'post_rename', 'OCA\Encryption\Hooks', 'postRenameOrCopy');
- \OCP\Util::connectHook('OC_Filesystem', 'copy', 'OCA\Encryption\Hooks', 'preCopy');
- \OCP\Util::connectHook('OC_Filesystem', 'post_copy', 'OCA\Encryption\Hooks', 'postRenameOrCopy');
- \OCP\Util::connectHook('OC_Filesystem', 'post_delete', 'OCA\Encryption\Hooks', 'postDelete');
- \OCP\Util::connectHook('OC_Filesystem', 'delete', 'OCA\Encryption\Hooks', 'preDelete');
- \OCP\Util::connectHook('\OC\Core\LostPassword\Controller\LostController', 'post_passwordReset', 'OCA\Encryption\Hooks', 'postPasswordReset');
- \OCP\Util::connectHook('OC_Filesystem', 'post_umount', 'OCA\Encryption\Hooks', 'postUnmount');
- \OCP\Util::connectHook('OC_Filesystem', 'umount', 'OCA\Encryption\Hooks', 'preUnmount');
+ \OCP\Util::connectHook('OC_Filesystem', 'rename', 'OCA\Files_Encryption\Hooks', 'preRename');
+ \OCP\Util::connectHook('OC_Filesystem', 'post_rename', 'OCA\Files_Encryption\Hooks', 'postRenameOrCopy');
+ \OCP\Util::connectHook('OC_Filesystem', 'copy', 'OCA\Files_Encryption\Hooks', 'preCopy');
+ \OCP\Util::connectHook('OC_Filesystem', 'post_copy', 'OCA\Files_Encryption\Hooks', 'postRenameOrCopy');
+ \OCP\Util::connectHook('OC_Filesystem', 'post_delete', 'OCA\Files_Encryption\Hooks', 'postDelete');
+ \OCP\Util::connectHook('OC_Filesystem', 'delete', 'OCA\Files_Encryption\Hooks', 'preDelete');
+ \OCP\Util::connectHook('\OC\Core\LostPassword\Controller\LostController', 'post_passwordReset', 'OCA\Files_Encryption\Hooks', 'postPasswordReset');
+ \OCP\Util::connectHook('OC_Filesystem', 'post_umount', 'OCA\Files_Encryption\Hooks', 'postUnmount');
+ \OCP\Util::connectHook('OC_Filesystem', 'umount', 'OCA\Files_Encryption\Hooks', 'preUnmount');
}
/**
@@ -81,8 +81,8 @@ class Helper {
*/
public static function registerAppHooks() {
- \OCP\Util::connectHook('OC_App', 'pre_disable', 'OCA\Encryption\Hooks', 'preDisable');
- \OCP\Util::connectHook('OC_App', 'post_disable', 'OCA\Encryption\Hooks', 'postEnable');
+ \OCP\Util::connectHook('OC_App', 'pre_disable', 'OCA\Files_Encryption\Hooks', 'preDisable');
+ \OCP\Util::connectHook('OC_App', 'post_disable', 'OCA\Files_Encryption\Hooks', 'postEnable');
}
/**
@@ -131,8 +131,6 @@ class Helper {
*
* @param string $recoveryKeyId
* @param string $recoveryPassword
- * @internal param \OCA\Encryption\Util $util
- * @internal param string $password
* @return bool
*/
public static function adminEnableRecovery($recoveryKeyId, $recoveryPassword) {
@@ -147,13 +145,13 @@ class Helper {
if (!Keymanager::recoveryKeyExists($view)) {
- $keypair = \OCA\Encryption\Crypt::createKeypair();
+ $keypair = Crypt::createKeypair();
// Save public key
Keymanager::setPublicKey($keypair['publicKey'], $recoveryKeyId);
- $cipher = \OCA\Encryption\Helper::getCipher();
- $encryptedKey = \OCA\Encryption\Crypt::symmetricEncryptFileContent($keypair['privateKey'], $recoveryPassword, $cipher);
+ $cipher = Helper::getCipher();
+ $encryptedKey = Crypt::symmetricEncryptFileContent($keypair['privateKey'], $recoveryPassword, $cipher);
if ($encryptedKey) {
Keymanager::setPrivateSystemKey($encryptedKey, $recoveryKeyId);
// Set recoveryAdmin as enabled
@@ -162,7 +160,7 @@ class Helper {
}
} else { // get recovery key and check the password
- $util = new \OCA\Encryption\Util(new \OC\Files\View('/'), \OCP\User::getUser());
+ $util = new Util(new \OC\Files\View('/'), \OCP\User::getUser());
$return = $util->checkRecoveryPassword($recoveryPassword);
if ($return) {
$appConfig->setValue('files_encryption', 'recoveryAdminEnabled', 1);
@@ -362,14 +360,14 @@ class Helper {
if ($errorCode === null) {
$init = $session->getInitialized();
switch ($init) {
- case \OCA\Encryption\Session::INIT_EXECUTED:
- $errorCode = \OCA\Encryption\Crypt::ENCRYPTION_PRIVATE_KEY_NOT_VALID_ERROR;
+ case Session::INIT_EXECUTED:
+ $errorCode = Crypt::ENCRYPTION_PRIVATE_KEY_NOT_VALID_ERROR;
break;
- case \OCA\Encryption\Session::NOT_INITIALIZED:
- $errorCode = \OCA\Encryption\Crypt::ENCRYPTION_NOT_INITIALIZED_ERROR;
+ case Session::NOT_INITIALIZED:
+ $errorCode = Crypt::ENCRYPTION_NOT_INITIALIZED_ERROR;
break;
default:
- $errorCode = \OCA\Encryption\Crypt::ENCRYPTION_UNKNOWN_ERROR;
+ $errorCode = Crypt::ENCRYPTION_UNKNOWN_ERROR;
}
}
diff --git a/apps/files_encryption/lib/hooks.php b/apps/files_encryption/lib/hooks.php
index a22477fce9e..bddfb7b2544 100644
--- a/apps/files_encryption/lib/hooks.php
+++ b/apps/files_encryption/lib/hooks.php
@@ -59,7 +59,7 @@ class Hooks {
\OC_Util::setupFS($params['uid']);
}
- $privateKey = \OCA\Encryption\Keymanager::getPrivateKey($view, $params['uid']);
+ $privateKey = Keymanager::getPrivateKey($view, $params['uid']);
// if no private key exists, check server configuration
if (!$privateKey) {
@@ -128,7 +128,7 @@ class Hooks {
* remove keys from session during logout
*/
public static function logout() {
- $session = new \OCA\Encryption\Session(new \OC\Files\View());
+ $session = new Session(new \OC\Files\View());
$session->removeKeys();
}
@@ -182,7 +182,7 @@ class Hooks {
if (Crypt::mode() === 'server') {
$view = new \OC\Files\View('/');
- $session = new \OCA\Encryption\Session($view);
+ $session = new Session($view);
// Get existing decrypted private key
$privateKey = $session->getPrivateKey();
@@ -236,7 +236,7 @@ class Hooks {
Keymanager::setPublicKey($keypair['publicKey'], $user);
// Encrypt private key with new password
- $encryptedKey = \OCA\Encryption\Crypt::symmetricEncryptFileContent($keypair['privateKey'], $newUserPassword, Helper::getCipher());
+ $encryptedKey = Crypt::symmetricEncryptFileContent($keypair['privateKey'], $newUserPassword, Helper::getCipher());
if ($encryptedKey) {
Keymanager::setPrivateKey($encryptedKey, $user);
@@ -331,7 +331,7 @@ class Hooks {
private static function updateKeyfiles($path) {
$view = new \OC\Files\View('/');
$userId = \OCP\User::getUser();
- $session = new \OCA\Encryption\Session($view);
+ $session = new Session($view);
$util = new Util($view, $userId);
$sharingEnabled = \OCP\Share::isEnabled();
@@ -504,8 +504,8 @@ class Hooks {
\OC::$server->getConfig()->deleteAppFromAllUsers('files_encryption');
- $session = new \OCA\Encryption\Session(new \OC\Files\View('/'));
- $session->setInitialized(\OCA\Encryption\Session::NOT_INITIALIZED);
+ $session = new Session(new \OC\Files\View('/'));
+ $session->setInitialized(Session::NOT_INITIALIZED);
}
}
@@ -515,8 +515,8 @@ class Hooks {
*/
public static function postEnable($params) {
if ($params['app'] === 'files_encryption') {
- $session = new \OCA\Encryption\Session(new \OC\Files\View('/'));
- $session->setInitialized(\OCA\Encryption\Session::NOT_INITIALIZED);
+ $session = new Session(new \OC\Files\View('/'));
+ $session->setInitialized(Session::NOT_INITIALIZED);
}
}
diff --git a/apps/files_encryption/lib/keymanager.php b/apps/files_encryption/lib/keymanager.php
index 16f0610f01f..dfde3684798 100644
--- a/apps/files_encryption/lib/keymanager.php
+++ b/apps/files_encryption/lib/keymanager.php
@@ -141,7 +141,7 @@ class Keymanager {
* store file encryption key
*
* @param \OC\Files\View $view
- * @param \OCA\Encryption\Util $util
+ * @param \OCA\Files_Encryption\Util $util
* @param string $path relative path of the file, including filename
* @param string $catfile keyfile content
* @return bool true/false
@@ -158,7 +158,7 @@ class Keymanager {
* get path to key folder for a given file
*
* @param \OC\Files\View $view relative to data directory
- * @param \OCA\Encryption\Util $util
+ * @param \OCA\Files_Encryption\Util $util
* @param string $path path to the file, relative to the users file directory
* @return string
*/
@@ -186,7 +186,7 @@ class Keymanager {
* get path to file key for a given file
*
* @param \OC\Files\View $view relative to data directory
- * @param \OCA\Encryption\Util $util
+ * @param \OCA\Files_Encryption\Util $util
* @param string $path path to the file, relative to the users file directory
* @return string
*/
@@ -199,7 +199,7 @@ class Keymanager {
* get path to share key for a given user
*
* @param \OC\Files\View $view relateive to data directory
- * @param \OCA\Encryption\Util $util
+ * @param \OCA\Files_Encryption\Util $util
* @param string $path path to file relative to the users files directoy
* @param string $uid user for whom we want the share-key path
* @retrun string
@@ -243,9 +243,8 @@ class Keymanager {
/**
* retrieve keyfile for an encrypted file
* @param \OC\Files\View $view
- * @param \OCA\Encryption\Util $util
+ * @param \OCA\Files_Encryption\Util $util
* @param string|false $filePath
- * @internal param \OCA\Encryption\file $string name
* @return string file key or false
* @note The keyfile returned is asymmetrically encrypted. Decryption
* of the keyfile must be performed by client code
@@ -347,7 +346,7 @@ class Keymanager {
/**
* store multiple share keys for a single file
* @param \OC\Files\View $view
- * @param \OCA\Encryption\Util $util
+ * @param \OCA\Files_Encryption\Util $util
* @param string $path
* @param array $shareKeys
* @return bool
@@ -376,7 +375,7 @@ class Keymanager {
* retrieve shareKey for an encrypted file
* @param \OC\Files\View $view
* @param string $userId
- * @param \OCA\Encryption\Util $util
+ * @param \OCA\Files_Encryption\Util $util
* @param string $filePath
* @return string file key or false
* @note The sharekey returned is encrypted. Decryption
diff --git a/apps/files_encryption/lib/migration.php b/apps/files_encryption/lib/migration.php
index ee2e52114cf..1bab1dfe4a5 100644
--- a/apps/files_encryption/lib/migration.php
+++ b/apps/files_encryption/lib/migration.php
@@ -35,8 +35,8 @@ class Migration {
public function __construct() {
$this->view = new \OC\Files\View();
- $this->public_share_key_id = \OCA\Encryption\Helper::getPublicShareKeyId();
- $this->recovery_key_id = \OCA\Encryption\Helper::getRecoveryKeyId();
+ $this->public_share_key_id = Helper::getPublicShareKeyId();
+ $this->recovery_key_id = Helper::getRecoveryKeyId();
}
public function reorganizeFolderStructure() {
diff --git a/apps/files_encryption/lib/proxy.php b/apps/files_encryption/lib/proxy.php
index 720b88c3d71..ba78c81aa35 100644
--- a/apps/files_encryption/lib/proxy.php
+++ b/apps/files_encryption/lib/proxy.php
@@ -34,7 +34,7 @@ namespace OCA\Files_Encryption;
/**
* Class Proxy
- * @package OCA\Encryption
+ * @package OCA\Files_Encryption
*/
class Proxy extends \OC_FileProxy {
@@ -130,7 +130,7 @@ class Proxy extends \OC_FileProxy {
$view = new \OC\Files\View('/');
// get relative path
- $relativePath = \OCA\Encryption\Helper::stripUserFilesPath($path);
+ $relativePath = Helper::stripUserFilesPath($path);
if (!isset($relativePath)) {
return true;
@@ -338,7 +338,7 @@ class Proxy extends \OC_FileProxy {
}
// get relative path
- $relativePath = \OCA\Encryption\Helper::stripUserFilesPath($path);
+ $relativePath = Helper::stripUserFilesPath($path);
// if path is empty we cannot resolve anything
if (empty($relativePath)) {
diff --git a/apps/files_encryption/lib/session.php b/apps/files_encryption/lib/session.php
index e84befb6ede..4c70bc7e8fc 100644
--- a/apps/files_encryption/lib/session.php
+++ b/apps/files_encryption/lib/session.php
@@ -72,8 +72,8 @@ class Session {
Keymanager::setPublicKey($keypair['publicKey'], $publicShareKeyId);
// Encrypt private key empty passphrase
- $cipher = \OCA\Encryption\Helper::getCipher();
- $encryptedKey = \OCA\Encryption\Crypt::symmetricEncryptFileContent($keypair['privateKey'], '', $cipher);
+ $cipher = Helper::getCipher();
+ $encryptedKey = Crypt::symmetricEncryptFileContent($keypair['privateKey'], '', $cipher);
if ($encryptedKey) {
Keymanager::setPrivateSystemKey($encryptedKey, $publicShareKeyId);
} else {
@@ -82,7 +82,7 @@ class Session {
}
- if (\OCA\Encryption\Helper::isPublicAccess() && !self::getPublicSharePrivateKey()) {
+ if (Helper::isPublicAccess() && !self::getPublicSharePrivateKey()) {
// Disable encryption proxy to prevent recursive calls
$proxyStatus = \OC_FileProxy::$enabled;
\OC_FileProxy::$enabled = false;
@@ -151,7 +151,7 @@ class Session {
public function getInitialized() {
if (!is_null(\OC::$server->getSession()->get('encryptionInitialized'))) {
return \OC::$server->getSession()->get('encryptionInitialized');
- } else if (\OCA\Encryption\Helper::isPublicAccess() && self::getPublicSharePrivateKey()) {
+ } else if (Helper::isPublicAccess() && self::getPublicSharePrivateKey()) {
return self::INIT_SUCCESSFUL;
} else {
return self::NOT_INITIALIZED;
@@ -165,7 +165,7 @@ class Session {
*/
public function getPrivateKey() {
// return the public share private key if this is a public access
- if (\OCA\Encryption\Helper::isPublicAccess()) {
+ if (Helper::isPublicAccess()) {
return self::getPublicSharePrivateKey();
} else {
if (!is_null(\OC::$server->getSession()->get('privateKey'))) {
diff --git a/apps/files_encryption/lib/stream.php b/apps/files_encryption/lib/stream.php
index 430bdb595b4..17da4eb1cdc 100644
--- a/apps/files_encryption/lib/stream.php
+++ b/apps/files_encryption/lib/stream.php
@@ -31,7 +31,8 @@
*/
namespace OCA\Files_Encryption;
-use OCA\Encryption\Exception\EncryptionException;
+
+use OCA\Files_Encryption\Exception\EncryptionException;
/**
* Provides 'crypt://' stream wrapper protocol.
@@ -81,7 +82,7 @@ class Stream {
private $rootView; // a fsview object set to '/'
/**
- * @var \OCA\Encryption\Session
+ * @var \OCA\Files_Encryption\Session
*/
private $session;
private $privateKey;
@@ -92,7 +93,7 @@ class Stream {
* @param int $options
* @param string $opened_path
* @return bool
- * @throw \OCA\Encryption\Exception\EncryptionException
+ * @throw \OCA\Files_Encryption\Exception\EncryptionException
*/
public function stream_open($path, $mode, $options, &$opened_path) {
@@ -106,7 +107,7 @@ class Stream {
$this->rootView = new \OC\Files\View('/');
}
- $this->session = new \OCA\Encryption\Session($this->rootView);
+ $this->session = new Session($this->rootView);
$this->privateKey = $this->session->getPrivateKey();
if ($this->privateKey === false) {
@@ -162,7 +163,7 @@ class Stream {
if($this->privateKey === false) {
// if private key is not valid redirect user to a error page
- \OCA\Encryption\Helper::redirectToErrorPage($this->session);
+ Helper::redirectToErrorPage($this->session);
}
$this->size = $this->rootView->filesize($this->rawPath);
@@ -251,7 +252,7 @@ class Stream {
/**
* @param int $count
* @return bool|string
- * @throws \OCA\Encryption\Exception\EncryptionException
+ * @throws \OCA\Files_Encryption\Exception\EncryptionException
*/
public function stream_read($count) {
@@ -329,7 +330,7 @@ class Stream {
// Fetch and decrypt keyfile
// Fetch existing keyfile
- $util = new \OCA\Encryption\Util($this->rootView, $this->userId);
+ $util = new Util($this->rootView, $this->userId);
$this->encKeyfile = Keymanager::getFileKey($this->rootView, $util, $this->relPath);
// If a keyfile already exists
@@ -340,13 +341,13 @@ class Stream {
// if there is no valid private key return false
if ($this->privateKey === false) {
// if private key is not valid redirect user to a error page
- \OCA\Encryption\Helper::redirectToErrorPage($this->session);
+ Helper::redirectToErrorPage($this->session);
return false;
}
if ($shareKey === false) {
// if no share key is available redirect user to a error page
- \OCA\Encryption\Helper::redirectToErrorPage($this->session, \OCA\Encryption\Crypt::ENCRYPTION_NO_SHARE_KEY_FOUND);
+ Helper::redirectToErrorPage($this->session, Crypt::ENCRYPTION_NO_SHARE_KEY_FOUND);
return false;
}
@@ -367,7 +368,7 @@ class Stream {
/**
* write header at beginning of encrypted file
*
- * @throws Exception\EncryptionException
+ * @throws \OCA\Files_Encryption\Exception\EncryptionException
*/
private function writeHeader() {
@@ -589,7 +590,7 @@ class Stream {
}
// if private key is not valid redirect user to a error page
- \OCA\Encryption\Helper::redirectToErrorPage($this->session);
+ Helper::redirectToErrorPage($this->session);
}
if (
diff --git a/apps/files_encryption/lib/util.php b/apps/files_encryption/lib/util.php
index 2052a976f71..ad6948b95a6 100644
--- a/apps/files_encryption/lib/util.php
+++ b/apps/files_encryption/lib/util.php
@@ -83,7 +83,7 @@ class Util {
// make sure that the owners home is mounted
\OC\Files\Filesystem::initMountPoints($userId);
- if (\OCA\Encryption\Helper::isPublicAccess()) {
+ if (Helper::isPublicAccess()) {
$this->keyId = $this->publicShareKeyId;
$this->isPublic = true;
} else {
@@ -277,7 +277,7 @@ class Util {
if ($file !== "." && $file !== "..") {
$filePath = $directory . '/' . $this->view->getRelativePath('/' . $file);
- $relPath = \OCA\Encryption\Helper::stripUserFilesPath($filePath);
+ $relPath = Helper::stripUserFilesPath($filePath);
// If the path is a directory, search
// its contents
@@ -451,13 +451,13 @@ class Util {
}
}
fclose($stream);
- $relPath = \OCA\Encryption\Helper::stripUserFilesPath($path);
+ $relPath = Helper::stripUserFilesPath($path);
$shareKey = Keymanager::getShareKey($this->view, $this->keyId, $this, $relPath);
if($shareKey===false) {
\OC_FileProxy::$enabled = $proxyStatus;
return $result;
}
- $session = new \OCA\Encryption\Session($this->view);
+ $session = new Session($this->view);
$privateKey = $session->getPrivateKey();
$plainKeyfile = $this->decryptKeyfile($relPath, $privateKey);
$plainKey = Crypt::multiKeyDecrypt($plainKeyfile, $shareKey, $privateKey);
@@ -1040,7 +1040,7 @@ class Util {
// Make sure that a share key is generated for the owner too
list($owner, $ownerPath) = $this->getUidAndFilename($filePath);
- $ownerPath = \OCA\Encryption\Helper::stripPartialFileExtension($ownerPath);
+ $ownerPath = Helper::stripPartialFileExtension($ownerPath);
// always add owner to the list of users with access to the file
$userIds = array($owner);
@@ -1402,7 +1402,7 @@ class Util {
if ($this->view->is_dir($this->userFilesDir . '/' . $filePath)) {
$this->addRecoveryKeys($filePath . '/');
} else {
- $session = new \OCA\Encryption\Session(new \OC\Files\View('/'));
+ $session = new Session(new \OC\Files\View('/'));
$sharingEnabled = \OCP\Share::isEnabled();
$usersSharing = $this->getSharingUsersArray($sharingEnabled, $filePath);
$this->setSharedFileKeyfiles($session, $usersSharing, $filePath);
@@ -1559,10 +1559,10 @@ class Util {
*/
public function initEncryption($params) {
- $session = new \OCA\Encryption\Session($this->view);
+ $session = new Session($this->view);
// we tried to initialize the encryption app for this session
- $session->setInitialized(\OCA\Encryption\Session::INIT_EXECUTED);
+ $session->setInitialized(Session::INIT_EXECUTED);
$encryptedKey = Keymanager::getPrivateKey($this->view, $params['uid']);
@@ -1578,7 +1578,7 @@ class Util {
}
$session->setPrivateKey($privateKey);
- $session->setInitialized(\OCA\Encryption\Session::INIT_SUCCESSFUL);
+ $session->setInitialized(Session::INIT_SUCCESSFUL);
return $session;
}
@@ -1587,7 +1587,7 @@ class Util {
* remove encryption related keys from the session
*/
public function closeEncryptionSession() {
- $session = new \OCA\Encryption\Session($this->view);
+ $session = new Session($this->view);
$session->closeSession();
}