summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/encryption/lib/crypto/crypt.php11
-rw-r--r--apps/encryption/lib/crypto/encryption.php4
-rw-r--r--apps/encryption_dummy/lib/dummymodule.php6
-rw-r--r--lib/public/encryption/exceptions/genericencryptionexception.php7
-rw-r--r--lib/public/encryption/iencryptionmodule.php4
-rw-r--r--lib/public/encryption/imanager.php2
-rw-r--r--tests/lib/files/storage/wrapper/encryption.php2
-rw-r--r--tests/lib/files/stream/encryption.php2
8 files changed, 25 insertions, 13 deletions
diff --git a/apps/encryption/lib/crypto/crypt.php b/apps/encryption/lib/crypto/crypt.php
index f2ae8e6db26..974e0038afc 100644
--- a/apps/encryption/lib/crypto/crypt.php
+++ b/apps/encryption/lib/crypto/crypt.php
@@ -75,7 +75,7 @@ class Crypt {
$res = $this->getOpenSSLPKey();
if (!$res) {
- $log->error("Encryption Library could'nt generate users key-pair for {$this->user->getUID()}",
+ $log->error("Encryption Library couldn't generate users key-pair for {$this->user->getUID()}",
['app' => 'encryption']);
if (openssl_error_string()) {
@@ -94,7 +94,7 @@ class Crypt {
'privateKey' => $privateKey
];
}
- $log->error('Encryption library couldn\'t export users private key, please check your servers openSSL configuration.' . $this->user->getUID(),
+ $log->error('Encryption library couldn\'t export users private key, please check your servers OpenSSL configuration.' . $this->user->getUID(),
['app' => 'encryption']);
if (openssl_error_string()) {
$log->error('Encryption Library:' . openssl_error_string(),
@@ -379,8 +379,11 @@ class Crypt {
}
/**
- * Generate a pseudo random 256-bit ASCII key, used as file key
+ * Generate a cryptographically secure pseudo-random base64 encoded 256-bit
+ * ASCII key, used as file key
+ *
* @return string
+ * @throws \Exception
*/
public static function generateFileKey() {
// Generate key
@@ -438,7 +441,7 @@ class Crypt {
}
/**
- * @param $plainContent
+ * @param string $plainContent
* @param array $keyFiles
* @return array
* @throws MultiKeyEncryptException
diff --git a/apps/encryption/lib/crypto/encryption.php b/apps/encryption/lib/crypto/encryption.php
index adf57d35e80..13beda196ce 100644
--- a/apps/encryption/lib/crypto/encryption.php
+++ b/apps/encryption/lib/crypto/encryption.php
@@ -107,7 +107,7 @@ class Encryption implements IEncryptionModule {
* written to the header, in case of a write operation
* or if no additional data is needed return a empty array
*/
- public function begin($path, $user, $header, $accessList) {
+ public function begin($path, $user, array $header, array $accessList) {
if (isset($header['cipher'])) {
$this->cipher = $header['cipher'];
@@ -246,7 +246,7 @@ class Encryption implements IEncryptionModule {
* @param array $accessList who has access to the file contains the key 'users' and 'public'
* @return boolean
*/
- public function update($path, $uid, $accessList) {
+ public function update($path, $uid, array $accessList) {
$fileKey = $this->keyManager->getFileKey($path, $uid);
$publicKeys = array();
foreach ($accessList['users'] as $user) {
diff --git a/apps/encryption_dummy/lib/dummymodule.php b/apps/encryption_dummy/lib/dummymodule.php
index 8cec9dfaf4c..b4dfe34a9bf 100644
--- a/apps/encryption_dummy/lib/dummymodule.php
+++ b/apps/encryption_dummy/lib/dummymodule.php
@@ -56,11 +56,11 @@ class DummyModule implements IEncryptionModule {
* @param array $header contains the header data read from the file
* @param array $accessList who has access to the file contains the key 'users' and 'public'
*
- * $return array $header contain data as key-value pairs which should be
+ * @return array $header contain data as key-value pairs which should be
* written to the header, in case of a write operation
* or if no additional data is needed return a empty array
*/
- public function begin($path, $user, $header, $accessList) {
+ public function begin($path, $user, array $header, array $accessList) {
return array();
}
@@ -141,7 +141,7 @@ class DummyModule implements IEncryptionModule {
* @param array $accessList who has access to the file contains the key 'users' and 'public'
* @return boolean
*/
- public function update($path, $uid, $accessList) {
+ public function update($path, $uid, array $accessList) {
return true;
}
}
diff --git a/lib/public/encryption/exceptions/genericencryptionexception.php b/lib/public/encryption/exceptions/genericencryptionexception.php
index 59ab25fd61d..c488d4df162 100644
--- a/lib/public/encryption/exceptions/genericencryptionexception.php
+++ b/lib/public/encryption/exceptions/genericencryptionexception.php
@@ -25,7 +25,12 @@ namespace OCP\Encryption\Exceptions;
class GenericEncryptionException extends \Exception {
- public function __construct($message = "", $code = 0, \Exception $previous = null) {
+ /**
+ * @param string $message
+ * @param int $code
+ * @param \Exception $previous
+ */
+ public function __construct($message = '', $code = 0, \Exception $previous = null) {
if (empty($message)) {
$message = 'Unspecified encryption exception';
}
diff --git a/lib/public/encryption/iencryptionmodule.php b/lib/public/encryption/iencryptionmodule.php
index 2f5f5e8a807..c1ce7d99d78 100644
--- a/lib/public/encryption/iencryptionmodule.php
+++ b/lib/public/encryption/iencryptionmodule.php
@@ -49,7 +49,7 @@ interface IEncryptionModule {
* written to the header, in case of a write operation
* or if no additional data is needed return a empty array
*/
- public function begin($path, $user, $header, $accessList);
+ public function begin($path, $user, array $header, array $accessList);
/**
* last chunk received. This is the place where you can perform some final
@@ -86,7 +86,7 @@ interface IEncryptionModule {
* @param array $accessList who has access to the file contains the key 'users' and 'public'
* @return boolean
*/
- public function update($path, $uid, $accessList);
+ public function update($path, $uid, array $accessList);
/**
* should the file be encrypted or not
diff --git a/lib/public/encryption/imanager.php b/lib/public/encryption/imanager.php
index ec91e3580e5..3dcdbf5d03a 100644
--- a/lib/public/encryption/imanager.php
+++ b/lib/public/encryption/imanager.php
@@ -73,7 +73,7 @@ interface IManager {
* get default encryption module
*
* @return \OCP\Encryption\IEncryptionModule
- * @throws Exceptions\ModuleDoesNotExistsException
+ * @throws ModuleDoesNotExistsException
*/
public function getDefaultEncryptionModule();
diff --git a/tests/lib/files/storage/wrapper/encryption.php b/tests/lib/files/storage/wrapper/encryption.php
index bf4464f0eb9..4f7a9e851c1 100644
--- a/tests/lib/files/storage/wrapper/encryption.php
+++ b/tests/lib/files/storage/wrapper/encryption.php
@@ -44,7 +44,9 @@ class Encryption extends \Test\Files\Storage\Storage {
$file = $this->getMockBuilder('\OC\Encryption\File')
->disableOriginalConstructor()
+ ->setMethods(['getAccessList'])
->getMock();
+ $file->expects($this->any())->method('getAccessList')->willReturn([]);
$logger = $this->getMock('\OC\Log');
diff --git a/tests/lib/files/stream/encryption.php b/tests/lib/files/stream/encryption.php
index 84156337ad7..53727a2213d 100644
--- a/tests/lib/files/stream/encryption.php
+++ b/tests/lib/files/stream/encryption.php
@@ -29,7 +29,9 @@ class Encryption extends \Test\TestCase {
->getMock();
$file = $this->getMockBuilder('\OC\Encryption\File')
->disableOriginalConstructor()
+ ->setMethods(['getAccessList'])
->getMock();
+ $file->expects($this->any())->method('getAccessList')->willReturn([]);
$util = $this->getMock('\OC\Encryption\Util', ['getUidAndFilename'], [new View(), new \OC\User\Manager(), $config]);
$util->expects($this->any())
->method('getUidAndFilename')