aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_encryption
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2012-07-31 15:03:28 +0200
committerBjoern Schiessle <schiessle@owncloud.com>2012-07-31 15:03:28 +0200
commit9bab06537c8d455c1a93b167193ec7cdebe89ffe (patch)
treec3827a3fcd67af385cc3487babda6db39f9b506a /apps/files_encryption
parentee15c40b1416507abbe6d0fb568bde77bb94e5f4 (diff)
downloadnextcloud-server-9bab06537c8d455c1a93b167193ec7cdebe89ffe.tar.gz
nextcloud-server-9bab06537c8d455c1a93b167193ec7cdebe89ffe.zip
update file encryption key over webdav properties for client side encryption
Diffstat (limited to 'apps/files_encryption')
-rw-r--r--apps/files_encryption/appinfo/app.php1
-rw-r--r--apps/files_encryption/hooks/hooks.php12
2 files changed, 13 insertions, 0 deletions
diff --git a/apps/files_encryption/appinfo/app.php b/apps/files_encryption/appinfo/app.php
index 1a4021e9395..2047bdbb1fb 100644
--- a/apps/files_encryption/appinfo/app.php
+++ b/apps/files_encryption/appinfo/app.php
@@ -10,6 +10,7 @@ OC::$CLASSPATH['OCA_Encryption\Proxy'] = 'apps/files_encryption/lib/proxy.php';
OC_FileProxy::register(new OCA_Encryption\Proxy());
OCP\Util::connectHook('OC_User','post_login','OCA_Encryption\Hooks','login');
+OCP\Util::connectHook('OC_Webdav_Properties', 'update', 'OCA_Encryption\Hooks', 'updateKeyfile');
stream_wrapper_register('crypt','OC_CryptStream');
diff --git a/apps/files_encryption/hooks/hooks.php b/apps/files_encryption/hooks/hooks.php
index 80daf50a24d..35e14e28106 100644
--- a/apps/files_encryption/hooks/hooks.php
+++ b/apps/files_encryption/hooks/hooks.php
@@ -58,6 +58,18 @@ class Hooks {
}
+
+ /**
+ * @brief update the encryption key of the file uploaded by the client
+ */
+ public static function updateKeyfile( $params ) {
+ if (Crypt::mode(\OCP\User::getUser()) == 'client')
+ if (isset($params['properties']['key'])) {
+ Keymanager::setFileKey(\OCP\User::getUser(), $params['path'], $params['properties']['key']);
+ } else {
+ error_log("Client side encryption is enabled but the client doesn't provide a encryption key for the file!");
+ }
+ }
}
?> \ No newline at end of file