always save key file, the key doesn't change but the encrypted keyfile change always the same way like the share-keys change

This commit is contained in:
Björn Schießle 2013-04-18 15:42:28 +02:00
parent a646a1169f
commit bd3024242f
1 changed files with 3 additions and 12 deletions

View File

@ -113,8 +113,6 @@ class Proxy extends \OC_FileProxy {
// Check if there is an existing key we can reuse // Check if there is an existing key we can reuse
if ( $encKeyfile = Keymanager::getFileKey( $rootView, $fileOwner, $filePath ) ) { if ( $encKeyfile = Keymanager::getFileKey( $rootView, $fileOwner, $filePath ) ) {
$keyPreExists = true;
// Fetch shareKey // Fetch shareKey
$shareKey = Keymanager::getShareKey( $rootView, $userId, $filePath ); $shareKey = Keymanager::getShareKey( $rootView, $userId, $filePath );
@ -127,8 +125,6 @@ class Proxy extends \OC_FileProxy {
} else { } else {
$keyPreExists = false;
// Make a new key // Make a new key
$plainKey = Crypt::generateKey(); $plainKey = Crypt::generateKey();
@ -157,14 +153,9 @@ class Proxy extends \OC_FileProxy {
// Set encrypted keyfile as common varname // Set encrypted keyfile as common varname
$encKey = $multiEncrypted['data']; $encKey = $multiEncrypted['data'];
// Save the key if its new // Save keyfile for newly encrypted file in parallel directory tree
if ( ! $keyPreExists ) { Keymanager::setFileKey( $rootView, $filePath, $fileOwner, $encKey );
// Save keyfile for newly encrypted file in parallel directory tree
Keymanager::setFileKey( $rootView, $filePath, $fileOwner, $encKey );
}
// Replace plain content with encrypted content by reference // Replace plain content with encrypted content by reference
$data = $encData; $data = $encData;