Skip to content
Snippets Groups Projects
Commit 66b46162 authored by Sam Tuke's avatar Sam Tuke
Browse files

Started implementation of new encyryption classes into the encryption proxy

parent 6d1ed388
Branches
No related tags found
No related merge requests found
...@@ -30,19 +30,21 @@ class Hooks { ...@@ -30,19 +30,21 @@ class Hooks {
public static function login( $params ){ 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() ) { if ( !$storage->ready() ) {
return $storage->setup( $params['password'] ); return $storage->setup( $params['password'] );
} else { }
$_SESSION['enckey'] = OC_Crypt::decrypt($key, $password);
return true; return true;
}
} }
} }
......
...@@ -27,7 +27,9 @@ ...@@ -27,7 +27,9 @@
*/ */
class OC_FileProxy_Encryption extends OC_FileProxy { class OC_FileProxy_Encryption extends OC_FileProxy {
private static $blackList = null; //mimetypes blacklisted from encryption private static $blackList = null; //mimetypes blacklisted from encryption
private static $enableEncryption = null; private static $enableEncryption = null;
/** /**
...@@ -97,7 +99,7 @@ class OC_FileProxy_Encryption extends OC_FileProxy{ ...@@ -97,7 +99,7 @@ class OC_FileProxy_Encryption extends OC_FileProxy{
$size = strlen( $data ); $size = strlen( $data );
$data = Crypt::blockEncrypt( $data ); $data = OCA_Encryption\Crypt::symmetricEncryptFileContent( $data, '', $cached['size'] );
OC_FileCache::put( $path, array( 'encrypted'=>true, 'size' => $size ), '' ); OC_FileCache::put( $path, array( 'encrypted'=>true, 'size' => $size ), '' );
...@@ -106,10 +108,15 @@ class OC_FileProxy_Encryption extends OC_FileProxy{ ...@@ -106,10 +108,15 @@ class OC_FileProxy_Encryption extends OC_FileProxy{
} }
public function postFile_get_contents( $path, $data ) { public function postFile_get_contents( $path, $data ) {
if ( self::isEncrypted( $path ) ) { if ( self::isEncrypted( $path ) ) {
$cached = OC_FileCache_Cached::get( $path, '' ); $cached = OC_FileCache_Cached::get( $path, '' );
$data=OC_Crypt::blockDecrypt($data,'',$cached['size']);
$data = OCA_Encryption\Crypt::symmetricDecryptFileContent( $data, '' );
} }
return $data; return $data;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment