summaryrefslogtreecommitdiffstats
path: root/lib/public
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2015-01-14 20:39:23 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2015-04-07 13:30:27 +0200
commit63e7fe608a5f507c5d2b417c45cf26589d091ebc (patch)
tree11f877d63137b31cbcc0c1548e1826ec4ea99482 /lib/public
parent2b6e13d088b56ea3d201e24ace049f1a6656043a (diff)
downloadnextcloud-server-63e7fe608a5f507c5d2b417c45cf26589d091ebc.tar.gz
nextcloud-server-63e7fe608a5f507c5d2b417c45cf26589d091ebc.zip
create basic interfaces and wrapper to make encryption more modular
Diffstat (limited to 'lib/public')
-rw-r--r--lib/public/encryption/ikeystorage.php87
1 files changed, 87 insertions, 0 deletions
diff --git a/lib/public/encryption/ikeystorage.php b/lib/public/encryption/ikeystorage.php
new file mode 100644
index 00000000000..cf94d56e59b
--- /dev/null
+++ b/lib/public/encryption/ikeystorage.php
@@ -0,0 +1,87 @@
+<?php
+
+/**
+ * ownCloud
+ *
+ * @copyright (C) 2015 ownCloud, Inc.
+ *
+ * @author Bjoern Schiessle <schiessle@owncloud.com>
+ *
+ * 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 library 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 along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+namespace OCP\Encryption;
+
+interface IKeyStorage {
+
+ /**
+ * get user specific key
+ *
+ * @param string $uid ID if the user for whom we want the key
+ * @param string $keyid id of the key
+ *
+ * @return mixed key
+ */
+ public function getUserKey($uid, $keyid);
+
+ /**
+ * get file specific key
+ *
+ * @param string $path path to file
+ * @param string $keyid id of the key
+ *
+ * @return mixed key
+ */
+ public function getFileKey($path, $keyid);
+
+ /**
+ * get system-wide encryption keys not related to a specific user,
+ * e.g something like a key for public link shares
+ *
+ * @param string $keyid id of the key
+ *
+ * @return mixed key
+ */
+ public function getSystemUserKey($uid, $keyid);
+
+ /**
+ * set user specific key
+ *
+ * @param string $uid ID if the user for whom we want the key
+ * @param string $keyid id of the key
+ * @param mixed $key
+ */
+ public function setUserKey($uid, $keyid, $key);
+
+ /**
+ * set file specific key
+ *
+ * @param string $path path to file
+ * @param string $keyid id of the key
+ * @param mixed $key
+ */
+ public function setFileKey($path, $keyid, $key);
+
+ /**
+ * set system-wide encryption keys not related to a specific user,
+ * e.g something like a key for public link shares
+ *
+ * @param string $keyid id of the key
+ * @param mixed $key
+ *
+ * @return mixed key
+ */
+ public function setSystemUserKey($uid, $keyid, $key);
+
+}