summaryrefslogtreecommitdiffstats
path: root/apps/files_encryption
diff options
context:
space:
mode:
authorSam Tuke <samtuke@owncloud.com>2013-02-01 19:31:15 +0000
committerSam Tuke <samtuke@owncloud.com>2013-02-01 19:31:15 +0000
commit0677d56ee226b0ba884f3e175c86540dbab643a5 (patch)
tree4e37214c8f97867f192e0830ec70266f2bd3009c /apps/files_encryption
parent06847f609b09f118b552d70e6f837a92008db570 (diff)
downloadnextcloud-server-0677d56ee226b0ba884f3e175c86540dbab643a5.tar.gz
nextcloud-server-0677d56ee226b0ba884f3e175c86540dbab643a5.zip
Added debugging output relating to recrypting legacy files
Diffstat (limited to 'apps/files_encryption')
-rwxr-xr-xapps/files_encryption/lib/crypt.php8
-rw-r--r--apps/files_encryption/lib/util.php11
2 files changed, 16 insertions, 3 deletions
diff --git a/apps/files_encryption/lib/crypt.php b/apps/files_encryption/lib/crypt.php
index 6fbbd412b89..231bfd9826b 100755
--- a/apps/files_encryption/lib/crypt.php
+++ b/apps/files_encryption/lib/crypt.php
@@ -186,8 +186,14 @@ class Crypt {
*/
public static function isLegacyEncryptedContent( $data, $path ) {
+ $trimmed = ltrim( $path, '/' );
+
+// trigger_error( "DATA = ".var_export($data, 1). " CATFILE?: ".var_export( self::isCatfile( $data ), 1));
+
// Fetch all file metadata from DB
- $metadata = \OC\Files\Filesystem::getFileInfo( $path, '' );
+ $metadata = \OC\Files\Filesystem::getFileInfo( $trimmed, '' );
+
+ trigger_error("PATH = ". var_export($trimmed, 1)." METADATA = ".var_export($metadata['encrypted'], 1));
// If a file is flagged with encryption in DB, but isn't a
// valid content + IV combination, it's probably using the
diff --git a/apps/files_encryption/lib/util.php b/apps/files_encryption/lib/util.php
index b1c128cf8c4..7e396a9145b 100644
--- a/apps/files_encryption/lib/util.php
+++ b/apps/files_encryption/lib/util.php
@@ -268,10 +268,15 @@ class Util {
$data = $this->view->file_get_contents( $filePath );
+// trigger_error("HAKE \n".var_export($this->view->file_get_contents( $filePath ), 1)." \nfilepath = ".var_export($filePath, 1 ));
+
// If the file is encrypted
// NOTE: If the userId is
// empty or not set, file will
// detected as plain
+ // NOTE: This is inefficient;
+ // scanning every file like this
+ // will eat server resources :(
if (
Keymanager::getFileKey( $this->view, $this->userId, $file )
&& Crypt::isCatfile( $filePath )
@@ -346,6 +351,8 @@ class Util {
if ( $found = $this->findFiles( $dirPath ) ) {
+// trigger_error("FOUND = ".print_r($found, 1));
+
// Disable proxy to prevent file being encrypted twice
\OC_FileProxy::$enabled = false;
@@ -384,13 +391,13 @@ class Util {
&& ! empty( $newPassphrase )
) {
- trigger_error("LEGACY FOUND");
-
foreach ( $found['legacy'] as $legacyFilePath ) {
// Fetch data from file
$legacyData = $this->view->file_get_contents( $legacyFilePath );
+ trigger_error("\n\nlegdata = ".var_export($legacyData).' \n\npassphrase = '.var_export($legacyPassphrase).' \n\npublickey = '.var_export($publicKey).' \n\nnewpass = '.var_export($newPassphrase));
+
// Recrypt data, generate catfile
$recrypted = Crypt::legacyKeyRecryptKeyfile( $legacyData, $legacyPassphrase, $publicKey, $newPassphrase );