From a90606fb14adc0aa149a87528d4f1ce61d0250e9 Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Fri, 14 Nov 2014 17:30:38 +0100 Subject: change private/public key names for consistency reasons --- apps/files_encryption/ajax/changeRecoveryPassword.php | 7 +++---- apps/files_encryption/ajax/updatePrivateKeyPassword.php | 6 ++---- 2 files changed, 5 insertions(+), 8 deletions(-) (limited to 'apps/files_encryption/ajax') 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(); -- cgit v1.2.3