diff options
author | Sam Tuke <samtuke@owncloud.com> | 2013-01-14 15:39:04 +0000 |
---|---|---|
committer | Sam Tuke <samtuke@owncloud.com> | 2013-01-14 15:39:04 +0000 |
commit | e9f3c5feea94833d686dbc1b99e01b7a06fdaaed (patch) | |
tree | 1d17a05721c5330759117683150c4e0988f48ace | |
parent | 3fbf362ba2f60917023833800e9e2dc47e190af1 (diff) | |
download | nextcloud-server-e9f3c5feea94833d686dbc1b99e01b7a06fdaaed.tar.gz nextcloud-server-e9f3c5feea94833d686dbc1b99e01b7a06fdaaed.zip |
Added creation of dir for shared file env encryption keys
Added comment to use multiKeyEncrypt
-rwxr-xr-x | apps/files_encryption/lib/crypt.php | 2 | ||||
-rw-r--r-- | apps/files_encryption/lib/util.php | 15 |
2 files changed, 14 insertions, 3 deletions
diff --git a/apps/files_encryption/lib/crypt.php b/apps/files_encryption/lib/crypt.php index fddc89dae54..642187b9103 100755 --- a/apps/files_encryption/lib/crypt.php +++ b/apps/files_encryption/lib/crypt.php @@ -390,6 +390,8 @@ class Crypt { */
public static function multiKeyEncrypt( $plainContent, array $publicKeys ) {
+ // Set empty vars to be set by openssl by reference
+ $sealed = '';
$envKeys = array();
if( openssl_seal( $plainContent, $sealed, $envKeys, $publicKeys ) ) {
diff --git a/apps/files_encryption/lib/util.php b/apps/files_encryption/lib/util.php index cd46d23108a..56e4d572c24 100644 --- a/apps/files_encryption/lib/util.php +++ b/apps/files_encryption/lib/util.php @@ -96,9 +96,10 @@ class Util { private $view; // OC_FilesystemView object for filesystem operations private $pwd; // User Password private $client; // Client side encryption mode flag - private $publicKeyDir; // Directory containing all public user keys - private $encryptionDir; // Directory containing user's files_encryption - private $keyfilesPath; // Directory containing user's keyfiles + private $publicKeyDir; // Dir containing all public user keys + private $encryptionDir; // Dir containing user's files_encryption + private $keyfilesPath; // Dir containing user's keyfiles + private $shareKeysPath; // Dir containing env keys for shared files private $publicKeyPath; // Path to user's public key private $privateKeyPath; // Path to user's private key @@ -110,6 +111,7 @@ class Util { $this->publicKeyDir = '/' . 'public-keys'; $this->encryptionDir = '/' . $this->userId . '/' . 'files_encryption'; $this->keyfilesPath = $this->encryptionDir . '/' . 'keyfiles'; + $this->shareKeysPath = $this->encryptionDir . '/' . 'share-keys'; $this->publicKeyPath = $this->publicKeyDir . '/' . $this->userId . '.public.key'; // e.g. data/public-keys/admin.public.key $this->privateKeyPath = $this->encryptionDir . '/' . $this->userId . '.private.key'; // e.g. data/admin/admin.private.key @@ -159,6 +161,13 @@ class Util { $this->view->mkdir( $this->keyfilesPath ); } + + // Create mirrored share env keys directory + if( !$this->view->file_exists( $this->shareKeysPath ) ) { + + $this->view->mkdir( $this->shareKeysPath ); + + } // Create user keypair if ( |