Started implementation of new encyryption classes into the encryption proxy
This commit is contained in:
parent
6d1ed388c0
commit
66b461629b
|
@ -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 {
|
||||
}
|
||||
|
||||
$_SESSION['enckey'] = OC_Crypt::decrypt($key, $password);
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue