Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Schießle <schiessle@owncloud.com>2013-06-03 16:19:31 +0400
committerBjörn Schießle <schiessle@owncloud.com>2013-06-03 16:19:31 +0400
commit471d2b732c504d7231aa7f343f5cda8a701fa447 (patch)
tree4aba6d147e98cccf6ba91aec216247fe8886eb84 /apps/files_encryption/hooks
parenta134ffcf2cce4dcd2c41ccd49a5b6306260bb0f3 (diff)
introduce decryptPrivateKey() method which also checks if the result is a valid private key to avoid additional checks on various places
Diffstat (limited to 'apps/files_encryption/hooks')
-rw-r--r--apps/files_encryption/hooks/hooks.php13
1 files changed, 1 insertions, 12 deletions
diff --git a/apps/files_encryption/hooks/hooks.php b/apps/files_encryption/hooks/hooks.php
index c52d739eaa8..47e240769bc 100644
--- a/apps/files_encryption/hooks/hooks.php
+++ b/apps/files_encryption/hooks/hooks.php
@@ -55,18 +55,7 @@ class Hooks {
$encryptedKey = Keymanager::getPrivateKey($view, $params['uid']);
- $privateKey = Crypt::symmetricDecryptFileContent($encryptedKey, $params['password']);
-
- // check if this a valid private key
- $res = openssl_pkey_get_private($privateKey);
- if(is_resource($res)) {
- $sslInfo = openssl_pkey_get_details($res);
- if(!isset($sslInfo['key'])) {
- $privateKey = false;
- }
- } else {
- $privateKey = false;
- }
+ $privateKey = Crypt::decryptPrivateKey($encryptedKey, $params['password']);
if($privateKey === false) {
\OCP\Util::writeLog('Encryption library', 'Private key for user "' . $params['uid'] . '" is not valid! Maybe the user password was changed from outside if so please change it back to gain access', \OCP\Util::ERROR);