Made Keymanager::getFileKey() dependencies explicit, fixed client code and tests accordingly
This commit is contained in:
parent
69e86c0213
commit
b024db9f98
|
@ -149,7 +149,7 @@ class Keymanager {
|
|||
* @note The keyfile returned is asymmetrically encrypted. Decryption
|
||||
* of the keyfile must be performed by client code
|
||||
*/
|
||||
public static function getFileKey( $view, $userId, $filePath ) {
|
||||
public static function getFileKey( \OC_FilesystemView $view, $userId, $filePath ) {
|
||||
|
||||
$filePath_f = ltrim( $filePath, '/' );
|
||||
|
||||
|
@ -166,8 +166,8 @@ class Keymanager {
|
|||
// $keypath = str_replace( '/' . $userId . '/files/', '', $keypath );
|
||||
//
|
||||
// }
|
||||
|
||||
return $this->view->file_get_contents( '/' . $userId . '/files_encryption/keyfiles/' . $filePath_f );
|
||||
// trigger_error(var_export($view, 1));
|
||||
return $view->file_get_contents( '/' . $userId . '/files_encryption/keyfiles/' . $filePath_f . '.key' );
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -156,7 +156,11 @@ class Proxy extends \OC_FileProxy {
|
|||
|
||||
//$cached = \OC_FileCache_Cached::get( $path, '' );
|
||||
|
||||
$encryptedKeyfile = Keymanager::getFileKey( $filePath );
|
||||
$view = new \OC_FilesystemView( '' );
|
||||
|
||||
$userId = \OCP\USER::getUser();
|
||||
|
||||
$encryptedKeyfile = Keymanager::getFileKey( $view, $userId, $filePath );
|
||||
|
||||
$session = new Session();
|
||||
|
||||
|
|
|
@ -267,7 +267,7 @@ class Stream {
|
|||
# TODO: add error handling for when file exists but no keyfile
|
||||
|
||||
// Fetch existing keyfile
|
||||
$this->encKeyfile = Keymanager::getFileKey( $this->rawPath );
|
||||
$this->encKeyfile = Keymanager::getFileKey( $this->rootView, $this->userId, $this->rawPath );
|
||||
|
||||
$this->getUser();
|
||||
|
||||
|
|
|
@ -242,7 +242,7 @@ class Test_Crypt extends \PHPUnit_Framework_TestCase {
|
|||
|
||||
|
||||
// Get keyfile
|
||||
$encryptedKeyfile = Encryption\Keymanager::getFileKey( $filename );
|
||||
$encryptedKeyfile = Encryption\Keymanager::getFileKey( $this->view, $this->userId, $filename );
|
||||
|
||||
$decryptedKeyfile = Encryption\Crypt::keyDecrypt( $encryptedKeyfile, $decryptedPrivateKey );
|
||||
|
||||
|
@ -298,7 +298,7 @@ class Test_Crypt extends \PHPUnit_Framework_TestCase {
|
|||
|
||||
|
||||
// Get keyfile
|
||||
$encryptedKeyfile = Encryption\Keymanager::getFileKey( $filename );
|
||||
$encryptedKeyfile = Encryption\Keymanager::getFileKey( $this->view, $this->userId, $filename );
|
||||
|
||||
$decryptedKeyfile = Encryption\Crypt::keyDecrypt( $encryptedKeyfile, $decryptedPrivateKey );
|
||||
|
||||
|
|
Loading…
Reference in New Issue