summaryrefslogtreecommitdiffstats
path: root/apps/files_encryption
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2013-08-12 16:19:08 +0200
committerBjoern Schiessle <schiessle@owncloud.com>2013-08-12 16:19:08 +0200
commit7b1067c2a09c6c312bf63ae5d8948c0c151f1891 (patch)
tree67505dcf1184f0d16d04bd3775a0ceec5b793098 /apps/files_encryption
parent44d201a526d89f30de2d6a5f5410f96dd3fff2b2 (diff)
downloadnextcloud-server-7b1067c2a09c6c312bf63ae5d8948c0c151f1891.tar.gz
nextcloud-server-7b1067c2a09c6c312bf63ae5d8948c0c151f1891.zip
change decryptUnknownKeyfile() to decryptKeyfile(), we always use openssl_seal
Diffstat (limited to 'apps/files_encryption')
-rw-r--r--apps/files_encryption/lib/util.php36
1 files changed, 6 insertions, 30 deletions
diff --git a/apps/files_encryption/lib/util.php b/apps/files_encryption/lib/util.php
index 61685e59c6a..c6fc134fe42 100644
--- a/apps/files_encryption/lib/util.php
+++ b/apps/files_encryption/lib/util.php
@@ -815,46 +815,22 @@ class Util {
}
/**
- * @brief Decrypt a keyfile without knowing how it was encrypted
+ * @brief Decrypt a keyfile
* @param string $filePath
- * @param string $fileOwner
* @param string $privateKey
* @return bool|string
- * @note Checks whether file was encrypted with openssl_seal or
- * openssl_encrypt, and decrypts accrdingly
- * @note This was used when 2 types of encryption for keyfiles was used,
- * but now we've switched to exclusively using openssl_seal()
*/
- public function decryptUnknownKeyfile($filePath, $fileOwner, $privateKey) {
+ private function decryptKeyfile($filePath, $privateKey) {
// Get the encrypted keyfile
- // NOTE: the keyfile format depends on how it was encrypted! At
- // this stage we don't know how it was encrypted
$encKeyfile = Keymanager::getFileKey($this->view, $this->userId, $filePath);
- // We need to decrypt the keyfile
- // Has the file been shared yet?
- if (
- $this->userId === $fileOwner
- && !Keymanager::getShareKey($this->view, $this->userId, $filePath) // NOTE: we can't use isShared() here because it's a post share hook so it always returns true
- ) {
-
- // The file has no shareKey, and its keyfile must be
- // decrypted conventionally
- $plainKeyfile = Crypt::keyDecrypt($encKeyfile, $privateKey);
-
-
- } else {
+ // The file has a shareKey and must use it for decryption
+ $shareKey = Keymanager::getShareKey($this->view, $this->userId, $filePath);
- // The file has a shareKey and must use it for decryption
- $shareKey = Keymanager::getShareKey($this->view, $this->userId, $filePath);
-
- $plainKeyfile = Crypt::multiKeyDecrypt($encKeyfile, $shareKey, $privateKey);
-
- }
+ $plainKeyfile = Crypt::multiKeyDecrypt($encKeyfile, $shareKey, $privateKey);
return $plainKeyfile;
-
}
/**
@@ -893,7 +869,7 @@ class Util {
$fileOwner = \OC\Files\Filesystem::getOwner($filePath);
// Decrypt keyfile
- $plainKeyfile = $this->decryptUnknownKeyfile($filePath, $fileOwner, $privateKey);
+ $plainKeyfile = $this->decryptKeyfile($filePath, $privateKey);
// Re-enc keyfile to (additional) sharekeys
$multiEncKey = Crypt::multiKeyEncrypt($plainKeyfile, $userPubKeys);