summaryrefslogtreecommitdiffstats
path: root/apps/files_encryption/lib
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2014-09-16 15:16:27 +0200
committerBjoern Schiessle <schiessle@owncloud.com>2014-09-19 11:47:18 +0200
commit2ee14c47347f9300e8042097f0ec7cbcbfcc4981 (patch)
tree60a51a1a8e9d8d39083295cd6ed6689d6a765079 /apps/files_encryption/lib
parent06eb3b62c6fac31e3d816746d9945c7c0a889323 (diff)
downloadnextcloud-server-2ee14c47347f9300e8042097f0ec7cbcbfcc4981.tar.gz
nextcloud-server-2ee14c47347f9300e8042097f0ec7cbcbfcc4981.zip
create backup from all keys before recovery
Diffstat (limited to 'apps/files_encryption/lib')
-rw-r--r--apps/files_encryption/lib/util.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/apps/files_encryption/lib/util.php b/apps/files_encryption/lib/util.php
index 087dada7f1b..33c2f88b0fd 100644
--- a/apps/files_encryption/lib/util.php
+++ b/apps/files_encryption/lib/util.php
@@ -1478,6 +1478,22 @@ class Util {
}
/**
+ * create a backup of all keys from the user
+ *
+ * @param string $purpose (optional) define the purpose of the backup, will be part of the backup folder
+ */
+ public function backupAllKeys($purpose = '') {
+ $this->userId;
+ $backupDir = $this->encryptionDir . '/backup.';
+ $backupDir .= ($purpose === '') ? date("Y-m-d_H-i-s") . '/' : $purpose . '.' . date("Y-m-d_H-i-s") . '/';
+ $this->view->mkdir($backupDir);
+ $this->view->copy($this->shareKeysPath, $backupDir . 'share-keys/');
+ $this->view->copy($this->keyfilesPath, $backupDir . 'keyfiles/');
+ $this->view->copy($this->privateKeyPath, $backupDir . $this->userId . '.private.key');
+ $this->view->copy($this->publicKeyPath, $backupDir . $this->userId . '.public.key');
+ }
+
+ /**
* check if the file is stored on a system wide mount point
* @param string $path relative to /data/user with leading '/'
* @return boolean