summaryrefslogtreecommitdiffstats
path: root/apps/files_encryption/ajax/changeRecoveryPassword.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_encryption/ajax/changeRecoveryPassword.php')
-rw-r--r--apps/files_encryption/ajax/changeRecoveryPassword.php11
1 files changed, 6 insertions, 5 deletions
diff --git a/apps/files_encryption/ajax/changeRecoveryPassword.php b/apps/files_encryption/ajax/changeRecoveryPassword.php
index 0cb010d3b56..99cc7b3cdde 100644
--- a/apps/files_encryption/ajax/changeRecoveryPassword.php
+++ b/apps/files_encryption/ajax/changeRecoveryPassword.php
@@ -35,11 +35,12 @@ $encryptedRecoveryKey = $view->file_get_contents($keyPath);
$decryptedRecoveryKey = \OCA\Encryption\Crypt::decryptPrivateKey($encryptedRecoveryKey, $oldPassword);
if ($decryptedRecoveryKey) {
-
- $encryptedRecoveryKey = \OCA\Encryption\Crypt::symmetricEncryptFileContent($decryptedRecoveryKey, $newPassword);
- $view->file_put_contents($keyPath, $encryptedRecoveryKey);
-
- $return = true;
+ $cipher = \OCA\Encryption\Helper::getCipher();
+ $encryptedKey = \OCA\Encryption\Crypt::symmetricEncryptFileContent($decryptedRecoveryKey, $newPassword, $cipher);
+ if ($encryptedKey) {
+ \OCA\Encryption\Keymanager::setPrivateSystemKey($encryptedKey, $keyId . '.private.key');
+ $return = true;
+ }
}
\OC_FileProxy::$enabled = $proxyStatus;