diff options
Diffstat (limited to 'apps/files_encryption/lib/util.php')
-rw-r--r-- | apps/files_encryption/lib/util.php | 16 |
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 |