2015-01-14 22:39:23 +03:00
|
|
|
<?php
|
|
|
|
/**
|
2016-07-21 18:07:57 +03:00
|
|
|
* @copyright Copyright (c) 2016, ownCloud, Inc.
|
|
|
|
*
|
2016-05-26 20:56:05 +03:00
|
|
|
* @author Björn Schießle <bjoern@schiessle.org>
|
2016-07-21 18:07:57 +03:00
|
|
|
* @author Joas Schilling <coding@schilljs.com>
|
2015-06-25 12:43:55 +03:00
|
|
|
* @author Morris Jobke <hey@morrisjobke.de>
|
2019-12-03 21:57:53 +03:00
|
|
|
* @author Roeland Jago Douma <roeland@famdouma.nl>
|
2015-01-14 22:39:23 +03:00
|
|
|
*
|
2015-04-07 18:02:49 +03:00
|
|
|
* @license AGPL-3.0
|
2015-01-14 22:39:23 +03:00
|
|
|
*
|
2015-04-07 18:02:49 +03:00
|
|
|
* 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.
|
2015-01-14 22:39:23 +03:00
|
|
|
*
|
2015-04-07 18:02:49 +03:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
2015-01-14 22:39:23 +03:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2015-04-07 18:02:49 +03:00
|
|
|
* 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,
|
2019-12-03 21:57:53 +03:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
2015-01-14 22:39:23 +03:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace OCP\Encryption;
|
2015-03-31 17:23:31 +03:00
|
|
|
|
2015-01-14 22:39:23 +03:00
|
|
|
use OC\Encryption\Exceptions\ModuleAlreadyExistsException;
|
2019-11-22 22:52:10 +03:00
|
|
|
use OC\Encryption\Exceptions\ModuleDoesNotExistsException;
|
2015-01-14 22:39:23 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This class provides access to files encryption apps.
|
|
|
|
*
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 8.1.0
|
2015-01-14 22:39:23 +03:00
|
|
|
*/
|
|
|
|
interface IManager {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Check if encryption is available (at least one encryption module needs to be enabled)
|
|
|
|
*
|
|
|
|
* @return bool true if enabled, false if not
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 8.1.0
|
2015-01-14 22:39:23 +03:00
|
|
|
*/
|
2015-04-20 12:14:40 +03:00
|
|
|
public function isEnabled();
|
2015-01-14 22:39:23 +03:00
|
|
|
|
|
|
|
/**
|
2015-04-14 17:48:39 +03:00
|
|
|
* Registers an callback function which must return an encryption module instance
|
2015-01-14 22:39:23 +03:00
|
|
|
*
|
2015-04-14 17:48:39 +03:00
|
|
|
* @param string $id
|
|
|
|
* @param string $displayName
|
|
|
|
* @param callable $callback
|
2015-01-14 22:39:23 +03:00
|
|
|
* @throws ModuleAlreadyExistsException
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 8.1.0
|
2015-01-14 22:39:23 +03:00
|
|
|
*/
|
2015-04-20 12:14:40 +03:00
|
|
|
public function registerEncryptionModule($id, $displayName, callable $callback);
|
2015-01-14 22:39:23 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Unregisters an encryption module
|
|
|
|
*
|
2015-04-14 17:48:39 +03:00
|
|
|
* @param string $moduleId
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 8.1.0
|
2015-01-14 22:39:23 +03:00
|
|
|
*/
|
2015-04-20 12:14:40 +03:00
|
|
|
public function unregisterEncryptionModule($moduleId);
|
2015-01-14 22:39:23 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* get a list of all encryption modules
|
|
|
|
*
|
2015-04-14 17:48:39 +03:00
|
|
|
* @return array [id => ['id' => $id, 'displayName' => $displayName, 'callback' => callback]]
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 8.1.0
|
2015-01-14 22:39:23 +03:00
|
|
|
*/
|
2015-04-20 12:14:40 +03:00
|
|
|
public function getEncryptionModules();
|
2015-01-14 22:39:23 +03:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* get a specific encryption module
|
|
|
|
*
|
2015-04-20 12:14:40 +03:00
|
|
|
* @param string $moduleId Empty to get the default module
|
2015-01-14 22:39:23 +03:00
|
|
|
* @return IEncryptionModule
|
|
|
|
* @throws ModuleDoesNotExistsException
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 8.1.0
|
2015-01-14 22:39:23 +03:00
|
|
|
*/
|
2015-04-20 12:14:40 +03:00
|
|
|
public function getEncryptionModule($moduleId = '');
|
2015-01-14 22:39:23 +03:00
|
|
|
|
|
|
|
/**
|
2015-04-20 12:11:52 +03:00
|
|
|
* get default encryption module Id
|
2015-01-14 22:39:23 +03:00
|
|
|
*
|
2015-04-20 12:11:52 +03:00
|
|
|
* @return string
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 8.1.0
|
2015-01-14 22:39:23 +03:00
|
|
|
*/
|
2015-04-20 12:11:52 +03:00
|
|
|
public function getDefaultEncryptionModuleId();
|
2015-01-14 22:39:23 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* set default encryption module Id
|
|
|
|
*
|
|
|
|
* @param string $moduleId
|
|
|
|
* @return string
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 8.1.0
|
2015-01-14 22:39:23 +03:00
|
|
|
*/
|
|
|
|
public function setDefaultEncryptionModule($moduleId);
|
|
|
|
}
|