aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public
diff options
context:
space:
mode:
Diffstat (limited to 'lib/public')
-rw-r--r--lib/public/encryption/exceptions/genericencryptionexception.php35
-rw-r--r--lib/public/encryption/iencryptionmodule.php26
-rw-r--r--lib/public/encryption/ifile.php35
-rw-r--r--lib/public/encryption/imanager.php30
-rw-r--r--lib/public/encryption/keys/istorage.php43
-rw-r--r--lib/public/iservercontainer.php26
-rw-r--r--lib/public/util.php17
7 files changed, 159 insertions, 53 deletions
diff --git a/lib/public/encryption/exceptions/genericencryptionexception.php b/lib/public/encryption/exceptions/genericencryptionexception.php
new file mode 100644
index 00000000000..59ab25fd61d
--- /dev/null
+++ b/lib/public/encryption/exceptions/genericencryptionexception.php
@@ -0,0 +1,35 @@
+<?php
+/**
+ * @author Clark Tomlinson <fallen013@gmail.com>
+ * @author Thomas Müller <thomas.mueller@tmit.eu>
+ *
+ * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+namespace OCP\Encryption\Exceptions;
+
+
+class GenericEncryptionException extends \Exception {
+
+ public function __construct($message = "", $code = 0, \Exception $previous = null) {
+ if (empty($message)) {
+ $message = 'Unspecified encryption exception';
+ }
+ parent::__construct($message, $code, $previous);
+ }
+
+}
diff --git a/lib/public/encryption/iencryptionmodule.php b/lib/public/encryption/iencryptionmodule.php
index 7265fee1259..2f5f5e8a807 100644
--- a/lib/public/encryption/iencryptionmodule.php
+++ b/lib/public/encryption/iencryptionmodule.php
@@ -1,24 +1,22 @@
<?php
-
/**
- * ownCloud - public interface of ownCloud for encryption modules
- *
- * @copyright (C) 2015 ownCloud, Inc.
+ * @author Björn Schießle <schiessle@owncloud.com>
*
- * @author Bjoern Schiessle <schiessle@owncloud.com>
+ * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @license AGPL-3.0
*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or any later version.
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
*
- * This library is distributed in the hope that it will be useful,
+ * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
*
- * You should have received a copy of the GNU Affero General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
namespace OCP\Encryption;
diff --git a/lib/public/encryption/ifile.php b/lib/public/encryption/ifile.php
new file mode 100644
index 00000000000..cc1e8f426b2
--- /dev/null
+++ b/lib/public/encryption/ifile.php
@@ -0,0 +1,35 @@
+<?php
+/**
+ * @author Björn Schießle <schiessle@owncloud.com>
+ * @author Thomas Müller <thomas.mueller@tmit.eu>
+ *
+ * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+namespace OCP\Encryption;
+
+interface IFile {
+
+ /**
+ * get list of users with access to the file
+ *
+ * @param string $path to the file
+ * @return array
+ */
+ public function getAccessList($path);
+
+}
diff --git a/lib/public/encryption/imanager.php b/lib/public/encryption/imanager.php
index 9a12e401593..ec91e3580e5 100644
--- a/lib/public/encryption/imanager.php
+++ b/lib/public/encryption/imanager.php
@@ -1,30 +1,26 @@
<?php
-
/**
- * ownCloud - manage encryption modules
- *
- * @copyright (C) 2015 ownCloud, Inc.
+ * @author Björn Schießle <schiessle@owncloud.com>
*
- * @author Bjoern Schiessle <schiessle@owncloud.com>
+ * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @license AGPL-3.0
*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or any later version.
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
*
- * This library is distributed in the hope that it will be useful,
+ * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
*
- * You should have received a copy of the GNU Affero General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
namespace OCP\Encryption;
-//
-// TODO: move exceptions to OCP
-//
+
use OC\Encryption\Exceptions\ModuleDoesNotExistsException;
use OC\Encryption\Exceptions\ModuleAlreadyExistsException;
diff --git a/lib/public/encryption/keys/istorage.php b/lib/public/encryption/keys/istorage.php
index 4c2b01f4ad0..898ab81c373 100644
--- a/lib/public/encryption/keys/istorage.php
+++ b/lib/public/encryption/keys/istorage.php
@@ -1,24 +1,23 @@
<?php
-
/**
- * ownCloud
- *
- * @copyright (C) 2015 ownCloud, Inc.
+ * @author Björn Schießle <schiessle@owncloud.com>
+ * @author Thomas Müller <thomas.mueller@tmit.eu>
*
- * @author Bjoern Schiessle <schiessle@owncloud.com>
+ * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @license AGPL-3.0
*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or any later version.
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
*
- * This library is distributed in the hope that it will be useful,
+ * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
*
- * You should have received a copy of the GNU Affero General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
namespace OCP\Encryption\Keys;
@@ -122,4 +121,20 @@ interface IStorage {
*/
public function deleteSystemUserKey($keyId);
+ /**
+ * copy keys if a file was renamed
+ *
+ * @param string $source
+ * @param string $target
+ */
+ public function renameKeys($source, $target);
+
+ /**
+ * move keys if a file was renamed
+ *
+ * @param string $source
+ * @param string $target
+ */
+ public function copyKeys($source, $target);
+
}
diff --git a/lib/public/iservercontainer.php b/lib/public/iservercontainer.php
index d7df884adf8..16a680ec170 100644
--- a/lib/public/iservercontainer.php
+++ b/lib/public/iservercontainer.php
@@ -2,6 +2,7 @@
/**
* @author Bart Visscher <bartv@thisnet.nl>
* @author Bernhard Posselt <dev@bernhard-posselt.com>
+ * @author Björn Schießle <schiessle@owncloud.com>
* @author Christopher Schäpers <kondou@ts.unde.re>
* @author Jörn Friedrich Dreyer <jfd@butonic.de>
* @author Lukas Reschke <lukas@owncloud.com>
@@ -150,13 +151,19 @@ interface IServerContainer {
function getHasher();
/**
+ * Returns a SecureRandom instance
+ *
+ * @return \OCP\Security\ISecureRandom
+ */
+ function getSecureRandom();
+
+ /**
* Returns an instance of the db facade
* @deprecated use getDatabaseConnection, will be removed in ownCloud 10
* @return \OCP\IDb
*/
function getDb();
-
/**
* Returns the app config manager
*
@@ -173,6 +180,23 @@ interface IServerContainer {
function getL10N($app, $lang = null);
/**
+ * @return \OC\Encryption\Manager
+ */
+ function getEncryptionManager();
+
+ /**
+ * @return \OC\Encryption\File
+ */
+ function getEncryptionFilesHelper();
+
+ /**
+ * @param string $encryptionModuleId encryption module ID
+ *
+ * @return \OCP\Encryption\Keys\IStorage
+ */
+ function getEncryptionKeyStorage($encryptionModuleId);
+
+ /**
* Returns the URL generator
*
* @return \OCP\IURLGenerator
diff --git a/lib/public/util.php b/lib/public/util.php
index b50ce54839b..721bcaadb62 100644
--- a/lib/public/util.php
+++ b/lib/public/util.php
@@ -219,9 +219,11 @@ class Util {
/**
* check if some encrypted files are stored
* @return bool
+ *
+ * @deprecated No longer required
*/
public static function encryptedFiles() {
- return \OC_Util::encryptedFiles();
+ return false;
}
/**
@@ -392,18 +394,19 @@ class Util {
/**
* connects a function to a hook
- * @param string $signalclass class name of emitter
- * @param string $signalname name of signal
- * @param string $slotclass class name of slot
- * @param string $slotname name of slot
+ *
+ * @param string $signalClass class name of emitter
+ * @param string $signalName name of signal
+ * @param string|object $slotClass class name of slot
+ * @param string $slotName name of slot
* @return bool
*
* This function makes it very easy to connect to use hooks.
*
* TODO: write example
*/
- static public function connectHook( $signalclass, $signalname, $slotclass, $slotname ) {
- return(\OC_Hook::connect( $signalclass, $signalname, $slotclass, $slotname ));
+ static public function connectHook($signalClass, $signalName, $slotClass, $slotName ) {
+ return(\OC_Hook::connect($signalClass, $signalName, $slotClass, $slotName ));
}
/**