From 6870add18f92d94ec520671dfa94021b340d7a4f Mon Sep 17 00:00:00 2001 From: Sam Tuke Date: Wed, 6 Feb 2013 15:08:36 +0000 Subject: [PATCH] Development snapshot --- apps/files_encryption/hooks/hooks.php | 6 ++++-- apps/files_encryption/lib/crypt.php | 18 ------------------ apps/files_encryption/lib/keymanager.php | 2 +- 3 files changed, 5 insertions(+), 21 deletions(-) diff --git a/apps/files_encryption/hooks/hooks.php b/apps/files_encryption/hooks/hooks.php index 2d7bd73487..9a4aef7946 100644 --- a/apps/files_encryption/hooks/hooks.php +++ b/apps/files_encryption/hooks/hooks.php @@ -107,14 +107,16 @@ class Hooks { * @param array $params keys: uid, password */ public static function setPassphrase( $params ) { - + trigger_error("HOSH"); // Only attempt to change passphrase if server-side encryption // is in use (client-side encryption does not have access to // the necessary keys) if ( Crypt::mode() == 'server' ) { + $session = new Session(); + // Get existing decrypted private key - $privateKey = $_SESSION['privateKey']; + $privateKey = $session->getPrivateKey(); // Encrypt private key with new user pwd as passphrase $encryptedPrivateKey = Crypt::symmetricEncryptFileContent( $privateKey, $params['password'] ); diff --git a/apps/files_encryption/lib/crypt.php b/apps/files_encryption/lib/crypt.php index 136c776045..d00f71b614 100755 --- a/apps/files_encryption/lib/crypt.php +++ b/apps/files_encryption/lib/crypt.php @@ -45,24 +45,6 @@ class Crypt { * @return string 'client' or 'server' */ public static function mode( $user = null ) { - -// $mode = \OC_Appconfig::getValue( 'files_encryption', 'mode', 'none' ); -// -// if ( $mode == 'user') { -// if ( !$user ) { -// $user = \OCP\User::getUser(); -// } -// $mode = 'none'; -// if ( $user ) { -// $query = \OC_DB::prepare( "SELECT mode FROM *PREFIX*encryption WHERE uid = ?" ); -// $result = $query->execute(array($user)); -// if ($row = $result->fetchRow()){ -// $mode = $row['mode']; -// } -// } -// } -// -// return $mode; return 'server'; diff --git a/apps/files_encryption/lib/keymanager.php b/apps/files_encryption/lib/keymanager.php index 43af70dacc..65efd38781 100755 --- a/apps/files_encryption/lib/keymanager.php +++ b/apps/files_encryption/lib/keymanager.php @@ -206,7 +206,7 @@ class Keymanager { * as no encryption takes place here */ public static function setPrivateKey( $key ) { - + trigger_error("MOSH"); $user = \OCP\User::getUser(); $view = new \OC_FilesystemView( '/' . $user . '/files_encryption' );