* @note The keyfile returned is asymmetrically encrypted. Decryption\r
* of the keyfile must be performed by client code\r
*/\r
- public static function getFileKey( $view, $userId, $filePath ) {\r
+ public static function getFileKey( \OC_FilesystemView $view, $userId, $filePath ) {\r
\r
$filePath_f = ltrim( $filePath, '/' );\r
\r
// $keypath = str_replace( '/' . $userId . '/files/', '', $keypath );\r
// \r
// }\r
- \r
- return $this->view->file_get_contents( '/' . $userId . '/files_encryption/keyfiles/' . $filePath_f );\r
+// trigger_error(var_export($view, 1));\r
+ return $view->file_get_contents( '/' . $userId . '/files_encryption/keyfiles/' . $filePath_f . '.key' );\r
\r
}\r
\r
//$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();
# 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();
// Get keyfile
- $encryptedKeyfile = Encryption\Keymanager::getFileKey( $filename );
+ $encryptedKeyfile = Encryption\Keymanager::getFileKey( $this->view, $this->userId, $filename );
$decryptedKeyfile = Encryption\Crypt::keyDecrypt( $encryptedKeyfile, $decryptedPrivateKey );
// Get keyfile
- $encryptedKeyfile = Encryption\Keymanager::getFileKey( $filename );
+ $encryptedKeyfile = Encryption\Keymanager::getFileKey( $this->view, $this->userId, $filename );
$decryptedKeyfile = Encryption\Crypt::keyDecrypt( $encryptedKeyfile, $decryptedPrivateKey );