aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_encryption/lib/util.php
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2014-09-19 16:40:19 +0200
committerLukas Reschke <lukas@owncloud.com>2014-09-19 16:40:19 +0200
commitfb033cce980ba58b64eed0cd0882c31021f43df0 (patch)
tree7dc40e73fb8bf0ede1746b18b001ef8cb36bc753 /apps/files_encryption/lib/util.php
parente94ec409aea074add6b1402b899ad549c1d3db7f (diff)
parenta280859bf888b0573e24f47b335ba3d65b9212ae (diff)
downloadnextcloud-server-fb033cce980ba58b64eed0cd0882c31021f43df0.tar.gz
nextcloud-server-fb033cce980ba58b64eed0cd0882c31021f43df0.zip
Merge pull request #11104 from owncloud/enc_create_backup_on_recovery
[encryption] create backup from all keys before recovery
Diffstat (limited to 'apps/files_encryption/lib/util.php')
-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