diff --git a/apps/files_encryption/hooks/hooks.php b/apps/files_encryption/hooks/hooks.php
index 89d526b70447e87926d62b7f6450fe21de673bfe..a8304261e479cf94b507ce3b75307fc573784636 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 3f9b86b988b66d482eb4c6fee8308f37d83cd4d7..080fd04cd7c5cb34e7491160aa2ed8110e95bc86 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;
 	}