summaryrefslogtreecommitdiffstats
path: root/apps/files_encryption/ajax
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2014-11-14 17:30:38 +0100
committerBjoern Schiessle <schiessle@owncloud.com>2014-11-26 10:57:47 +0100
commita90606fb14adc0aa149a87528d4f1ce61d0250e9 (patch)
tree314b9edadf1e00211a65578c6f913eb23ab8b44d /apps/files_encryption/ajax
parent266f1a2afa890a7e2750a51fa3d6da98240751fe (diff)
downloadnextcloud-server-a90606fb14adc0aa149a87528d4f1ce61d0250e9.tar.gz
nextcloud-server-a90606fb14adc0aa149a87528d4f1ce61d0250e9.zip
change private/public key names for consistency reasons
Diffstat (limited to 'apps/files_encryption/ajax')
-rw-r--r--apps/files_encryption/ajax/changeRecoveryPassword.php7
-rw-r--r--apps/files_encryption/ajax/updatePrivateKeyPassword.php6
2 files changed, 5 insertions, 8 deletions
diff --git a/apps/files_encryption/ajax/changeRecoveryPassword.php b/apps/files_encryption/ajax/changeRecoveryPassword.php
index bf647f2c8fa..01b76a969b6 100644
--- a/apps/files_encryption/ajax/changeRecoveryPassword.php
+++ b/apps/files_encryption/ajax/changeRecoveryPassword.php
@@ -55,16 +55,15 @@ $proxyStatus = \OC_FileProxy::$enabled;
\OC_FileProxy::$enabled = false;
$keyId = $util->getRecoveryKeyId();
-$keyPath = '/owncloud_private_key/' . $keyId . '.private.key';
-$encryptedRecoveryKey = $view->file_get_contents($keyPath);
-$decryptedRecoveryKey = \OCA\Encryption\Crypt::decryptPrivateKey($encryptedRecoveryKey, $oldPassword);
+$encryptedRecoveryKey = Encryption\Keymanager::getPrivateSystemKey($keyId);
+$decryptedRecoveryKey = $encryptedRecoveryKey ? \OCA\Encryption\Crypt::decryptPrivateKey($encryptedRecoveryKey, $oldPassword) : false;
if ($decryptedRecoveryKey) {
$cipher = \OCA\Encryption\Helper::getCipher();
$encryptedKey = \OCA\Encryption\Crypt::symmetricEncryptFileContent($decryptedRecoveryKey, $newPassword, $cipher);
if ($encryptedKey) {
- \OCA\Encryption\Keymanager::setPrivateSystemKey($encryptedKey, $keyId . '.private.key');
+ \OCA\Encryption\Keymanager::setPrivateSystemKey($encryptedKey, $keyId);
$return = true;
}
}
diff --git a/apps/files_encryption/ajax/updatePrivateKeyPassword.php b/apps/files_encryption/ajax/updatePrivateKeyPassword.php
index fa5e279b21b..97da3811a0f 100644
--- a/apps/files_encryption/ajax/updatePrivateKeyPassword.php
+++ b/apps/files_encryption/ajax/updatePrivateKeyPassword.php
@@ -36,10 +36,8 @@ if ($passwordCorrect !== false) {
$proxyStatus = \OC_FileProxy::$enabled;
\OC_FileProxy::$enabled = false;
-$keyPath = '/' . $user . '/files_encryption/' . $user . '.private.key';
-
-$encryptedKey = $view->file_get_contents($keyPath);
-$decryptedKey = \OCA\Encryption\Crypt::decryptPrivateKey($encryptedKey, $oldPassword);
+$encryptedKey = Encryption\Keymanager::getPrivateKey($view, $user);
+$decryptedKey = $encryptedKey ? \OCA\Encryption\Crypt::decryptPrivateKey($encryptedKey, $oldPassword) : false;
if ($decryptedKey) {
$cipher = \OCA\Encryption\Helper::getCipher();