diff --git a/apps/files_encryption/hooks/hooks.php b/apps/files_encryption/hooks/hooks.php index 89d526b704..a8304261e4 100644 --- a/apps/files_encryption/hooks/hooks.php +++ b/apps/files_encryption/hooks/hooks.php @@ -30,19 +30,21 @@ class Hooks { public static function login( $params ){ - $view = new \OC_FilesystemView( '/' . $params['uid'] ); + $view = new \OC_FilesystemView( '/' ); - $storage = new Storage( $view ); + $storage = new Storage( $view, $params['uid'] ); if ( !$storage->ready() ) { return $storage->setup( $params['password'] ); - } else { - - return true; - } + + $_SESSION['enckey'] = OC_Crypt::decrypt($key, $password); + + return true; + + } } diff --git a/apps/files_encryption/lib/proxy.php b/apps/files_encryption/lib/proxy.php index 3f9b86b988..080fd04cd7 100644 --- a/apps/files_encryption/lib/proxy.php +++ b/apps/files_encryption/lib/proxy.php @@ -26,9 +26,11 @@ * transparent encryption */ -class OC_FileProxy_Encryption extends OC_FileProxy{ - private static $blackList=null; //mimetypes blacklisted from encryption - private static $enableEncryption=null; +class OC_FileProxy_Encryption extends OC_FileProxy { + + private static $blackList = null; //mimetypes blacklisted from encryption + + private static $enableEncryption = null; /** * Check if a file requires encryption @@ -97,7 +99,7 @@ class OC_FileProxy_Encryption extends OC_FileProxy{ $size = strlen( $data ); - $data = Crypt::blockEncrypt( $data ); + $data = OCA_Encryption\Crypt::symmetricEncryptFileContent( $data, '', $cached['size'] ); OC_FileCache::put( $path, array( 'encrypted'=>true, 'size' => $size ), '' ); @@ -105,11 +107,16 @@ class OC_FileProxy_Encryption extends OC_FileProxy{ } } - public function postFile_get_contents($path,$data){ - if(self::isEncrypted($path)){ - $cached=OC_FileCache_Cached::get($path,''); - $data=OC_Crypt::blockDecrypt($data,'',$cached['size']); + public function postFile_get_contents( $path, $data ) { + + if ( self::isEncrypted( $path ) ) { + + $cached = OC_FileCache_Cached::get( $path, '' ); + + $data = OCA_Encryption\Crypt::symmetricDecryptFileContent( $data, '' ); + } + return $data; }