diff options
author | Robin Appelman <icewind1991@gmail.com> | 2011-10-21 19:02:11 +0400 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2012-02-21 23:48:47 +0400 |
commit | 3d67cd51c2f42029435343004b3ebe608bcba375 (patch) | |
tree | d1b6a031f577da075be25857c9b520e4078e62ea /lib | |
parent | abc749feeb14c49d483135f879195b70ee89654f (diff) |
encryption proxy wip
Diffstat (limited to 'lib')
-rw-r--r-- | lib/crypt.php | 39 | ||||
-rw-r--r-- | lib/fileproxy.php | 8 | ||||
-rw-r--r-- | lib/filestorage/local.php | 2 | ||||
-rw-r--r-- | lib/filesystemview.php | 2 |
4 files changed, 37 insertions, 14 deletions
diff --git a/lib/crypt.php b/lib/crypt.php index 60020679480..3e6fa05b85d 100644 --- a/lib/crypt.php +++ b/lib/crypt.php @@ -113,14 +113,13 @@ class OC_Crypt { return($bf->encrypt($contents)); } - - /** - * @brief encryption of a file - * @param $filename - * @param $key the encryption key - * - * This function encrypts a file - */ + /** + * @brief encryption of a file + * @param $filename + * @param $key the encryption key + * + * This function encrypts a file + */ public static function encryptfile( $filename, $key) { $handleread = fopen($filename, "rb"); if($handleread<>FALSE) { @@ -158,6 +157,30 @@ class OC_Crypt { } fclose($handleread); } + + /** + * encrypt data in 8192b sized blocks + */ + public static function blockEncrypt($data){ + $result=''; + while(strlen($data)){ + $result=self::encrypt(substr($data,0,8192)); + $data=substr($data,8192); + } + return $result; + } + + /** + * decrypt data in 8192b sized blocks + */ + public static function blockDecrypt($data){ + $result=''; + while(strlen($data)){ + $result=self::decrypt(substr($data,0,8192)); + $data=substr($data,8192); + } + return $result; + } diff --git a/lib/fileproxy.php b/lib/fileproxy.php index 1fb22bd1139..796fd95cb38 100644 --- a/lib/fileproxy.php +++ b/lib/fileproxy.php @@ -83,16 +83,16 @@ class OC_FileProxy{ return $proxies; } - public static function runPreProxies($operation,$filepath,$filepath2=null){ + public static function runPreProxies($operation,&$filepath,&$filepath2=null){ $proxies=self::getProxies($operation,false); $operation='pre'.$operation; foreach($proxies as $proxy){ - if($filepath2){ - if(!$proxy->$operation(&$filepath,&$filepath2)){ + if(!is_null($filepath2)){ + if($proxy->$operation($filepath,$filepath2)===false){ return false; } }else{ - if(!$proxy->$operation(&$filepath)){ + if($proxy->$operation($filepath)===false){ return false; } } diff --git a/lib/filestorage/local.php b/lib/filestorage/local.php index dcb516a3afb..ee4b267bcd4 100644 --- a/lib/filestorage/local.php +++ b/lib/filestorage/local.php @@ -74,7 +74,7 @@ class OC_Filestorage_Local extends OC_Filestorage{ public function file_get_contents($path){ return file_get_contents($this->datadir.$path); } - public function file_put_contents($path,$data){ + public function file_put_contents($path,$data=null){ if($return=file_put_contents($this->datadir.$path,$data)){ } } diff --git a/lib/filesystemview.php b/lib/filesystemview.php index 91c6cd17720..a78f3f652ad 100644 --- a/lib/filesystemview.php +++ b/lib/filesystemview.php @@ -302,7 +302,7 @@ class OC_FilesystemView { } } if($run){ - if($extraParam){ + if(!is_null($extraParam)){ $result=$storage->$operation($interalPath,$extraParam); }else{ $result=$storage->$operation($interalPath); |