@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | * |
| 142 | 142 | * @note This method should never be called for users using client side encryption |
| 143 | 143 | * @param array $params |
| 144 | - * @return bool |
|
| 144 | + * @return boolean|null |
|
| 145 | 145 | */ |
| 146 | 146 | public function login($params) { |
| 147 | 147 | |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | * If the password can't be changed within ownCloud, than update the key password in advance. |
| 200 | 200 | * |
| 201 | 201 | * @param array $params : uid, password |
| 202 | - * @return bool |
|
| 202 | + * @return boolean|null |
|
| 203 | 203 | */ |
| 204 | 204 | public function preSetPassphrase($params) { |
| 205 | 205 | if (App::isEnabled('encryption')) { |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | * Change a user's encryption passphrase |
| 217 | 217 | * |
| 218 | 218 | * @param array $params keys: uid, password |
| 219 | - * @return bool |
|
| 219 | + * @return boolean|null |
|
| 220 | 220 | */ |
| 221 | 221 | public function setPassphrase($params) { |
| 222 | 222 | |
@@ -34,7 +34,6 @@ |
||
| 34 | 34 | use OCP\Encryption\Exceptions\GenericEncryptionException; |
| 35 | 35 | use OCP\IConfig; |
| 36 | 36 | use OCP\ILogger; |
| 37 | -use OCP\IUser; |
|
| 38 | 37 | use OCP\IUserSession; |
| 39 | 38 | |
| 40 | 39 | class Crypt { |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | /** |
| 136 | 136 | * @param string $plainContent |
| 137 | 137 | * @param string $passPhrase |
| 138 | - * @return bool|string |
|
| 138 | + * @return false|string |
|
| 139 | 139 | * @throws GenericEncryptionException |
| 140 | 140 | */ |
| 141 | 141 | public function symmetricEncryptFileContent($plainContent, $passPhrase) { |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | /** |
| 233 | - * @param $data |
|
| 233 | + * @param string $data |
|
| 234 | 234 | * @return string |
| 235 | 235 | */ |
| 236 | 236 | private function addPadding($data) { |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | /** |
| 241 | 241 | * @param string $privateKey |
| 242 | 242 | * @param string $password |
| 243 | - * @return bool|string |
|
| 243 | + * @return false|string |
|
| 244 | 244 | */ |
| 245 | 245 | public function decryptPrivateKey($privateKey, $password = '') { |
| 246 | 246 | |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | /** |
| 281 | - * @param $keyFileContents |
|
| 281 | + * @param string $keyFileContents |
|
| 282 | 282 | * @param string $passPhrase |
| 283 | 283 | * @param string $cipher |
| 284 | 284 | * @return string |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | * remove padding |
| 301 | 301 | * |
| 302 | 302 | * @param $padded |
| 303 | - * @return bool|string |
|
| 303 | + * @return string|false |
|
| 304 | 304 | */ |
| 305 | 305 | private function removePadding($padded) { |
| 306 | 306 | if (substr($padded, -2) === 'xx') { |
@@ -312,8 +312,8 @@ discard block |
||
| 312 | 312 | /** |
| 313 | 313 | * split iv from encrypted content |
| 314 | 314 | * |
| 315 | - * @param $catFile |
|
| 316 | - * @return array |
|
| 315 | + * @param string|false $catFile |
|
| 316 | + * @return string |
|
| 317 | 317 | */ |
| 318 | 318 | private function splitIv($catFile) { |
| 319 | 319 | // Fetch encryption metadata from end of file |
@@ -333,8 +333,8 @@ discard block |
||
| 333 | 333 | } |
| 334 | 334 | |
| 335 | 335 | /** |
| 336 | - * @param $encryptedContent |
|
| 337 | - * @param $iv |
|
| 336 | + * @param string $encryptedContent |
|
| 337 | + * @param string $iv |
|
| 338 | 338 | * @param string $passPhrase |
| 339 | 339 | * @param string $cipher |
| 340 | 340 | * @return string |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | } |
| 356 | 356 | |
| 357 | 357 | /** |
| 358 | - * @param $data |
|
| 358 | + * @param string $data |
|
| 359 | 359 | * @return array |
| 360 | 360 | */ |
| 361 | 361 | private function parseHeader($data) { |
@@ -427,7 +427,7 @@ discard block |
||
| 427 | 427 | * @param $encKeyFile |
| 428 | 428 | * @param $shareKey |
| 429 | 429 | * @param $privateKey |
| 430 | - * @return mixed |
|
| 430 | + * @return string |
|
| 431 | 431 | * @throws MultiKeyDecryptException |
| 432 | 432 | */ |
| 433 | 433 | public function multiKeyDecrypt($encKeyFile, $shareKey, $privateKey) { |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | * encrypt data |
| 248 | 248 | * |
| 249 | 249 | * @param string $data you want to encrypt |
| 250 | - * @return mixed encrypted data |
|
| 250 | + * @return string encrypted data |
|
| 251 | 251 | */ |
| 252 | 252 | public function encrypt($data) { |
| 253 | 253 | |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | * decrypt data |
| 313 | 313 | * |
| 314 | 314 | * @param string $data you want to decrypt |
| 315 | - * @return mixed decrypted data |
|
| 315 | + * @return string decrypted data |
|
| 316 | 316 | * @throws DecryptionFailedException |
| 317 | 317 | */ |
| 318 | 318 | public function decrypt($data) { |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | |
| 281 | 281 | /** |
| 282 | 282 | * @param $userId |
| 283 | - * @param $key |
|
| 283 | + * @param string $key |
|
| 284 | 284 | * @return bool |
| 285 | 285 | */ |
| 286 | 286 | public function setPrivateKey($userId, $key) { |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | |
| 366 | 366 | /** |
| 367 | 367 | * @param $userId |
| 368 | - * @return mixed |
|
| 368 | + * @return string |
|
| 369 | 369 | * @throws PrivateKeyMissingException |
| 370 | 370 | */ |
| 371 | 371 | public function getPrivateKey($userId) { |
@@ -379,7 +379,7 @@ discard block |
||
| 379 | 379 | } |
| 380 | 380 | |
| 381 | 381 | /** |
| 382 | - * @param $path |
|
| 382 | + * @param string $path |
|
| 383 | 383 | * @param $uid |
| 384 | 384 | * @return string |
| 385 | 385 | */ |
@@ -412,7 +412,7 @@ discard block |
||
| 412 | 412 | /** |
| 413 | 413 | * get the encrypted file key |
| 414 | 414 | * |
| 415 | - * @param $path |
|
| 415 | + * @param string $path |
|
| 416 | 416 | * @return string |
| 417 | 417 | */ |
| 418 | 418 | public function getEncryptedFileKey($path) { |
@@ -508,7 +508,7 @@ discard block |
||
| 508 | 508 | } |
| 509 | 509 | |
| 510 | 510 | /** |
| 511 | - * @param $purpose |
|
| 511 | + * @param string $purpose |
|
| 512 | 512 | * @param bool $timestamp |
| 513 | 513 | * @param bool $includeUserKeys |
| 514 | 514 | */ |
@@ -534,13 +534,16 @@ discard block |
||
| 534 | 534 | } |
| 535 | 535 | |
| 536 | 536 | /** |
| 537 | - * @param $uid |
|
| 537 | + * @param string $uid |
|
| 538 | 538 | * @return bool |
| 539 | 539 | */ |
| 540 | 540 | private function deletePrivateKey($uid) { |
| 541 | 541 | return $this->keyStorage->deleteUserKey($uid, $this->privateKeyId, Encryption::ID); |
| 542 | 542 | } |
| 543 | 543 | |
| 544 | + /** |
|
| 545 | + * @param string $path |
|
| 546 | + */ |
|
| 544 | 547 | public function deleteAllFileKeys($path) { |
| 545 | 548 | return $this->keyStorage->deleteAllFileKeys($path); |
| 546 | 549 | } |
@@ -237,7 +237,7 @@ |
||
| 237 | 237 | /** |
| 238 | 238 | * rename system wide public key |
| 239 | 239 | * |
| 240 | - * @param $privateKey private key for which we want to rename the corresponding public key |
|
| 240 | + * @param string $privateKey private key for which we want to rename the corresponding public key |
|
| 241 | 241 | */ |
| 242 | 242 | private function renameSystemPublicKey($privateKey) { |
| 243 | 243 | $publicKey = substr($privateKey,0 , strrpos($privateKey, '.privateKey')) . '.publicKey'; |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | |
| 104 | 104 | /** |
| 105 | 105 | * @param $recoveryKeyId |
| 106 | - * @param $password |
|
| 106 | + * @param string $password |
|
| 107 | 107 | * @return bool |
| 108 | 108 | */ |
| 109 | 109 | public function enableAdminRecovery($password) { |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | /** |
| 147 | - * @param $recoveryPassword |
|
| 147 | + * @param string $recoveryPassword |
|
| 148 | 148 | * @return bool |
| 149 | 149 | */ |
| 150 | 150 | public function disableAdminRecovery($recoveryPassword) { |
@@ -212,6 +212,7 @@ discard block |
||
| 212 | 212 | |
| 213 | 213 | /** |
| 214 | 214 | * add recovery key to all encrypted files |
| 215 | + * @param string $path |
|
| 215 | 216 | */ |
| 216 | 217 | private function addRecoveryKeys($path) { |
| 217 | 218 | $dirContent = $this->view->getDirectoryContent($path); |
@@ -239,6 +240,7 @@ discard block |
||
| 239 | 240 | |
| 240 | 241 | /** |
| 241 | 242 | * remove recovery key to all encrypted files |
| 243 | + * @param string $path |
|
| 242 | 244 | */ |
| 243 | 245 | private function removeRecoveryKeys($path) { |
| 244 | 246 | $dirContent = $this->view->getDirectoryContent($path); |
@@ -62,6 +62,9 @@ discard block |
||
| 62 | 62 | $this->moduleId = \OCA\Encryption\Crypto\Encryption::ID; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | + /** |
|
| 66 | + * @param string $uid |
|
| 67 | + */ |
|
| 65 | 68 | protected function createDummyShareKeys($uid) { |
| 66 | 69 | $this->loginAsUser($uid); |
| 67 | 70 | |
@@ -89,6 +92,9 @@ discard block |
||
| 89 | 92 | } |
| 90 | 93 | } |
| 91 | 94 | |
| 95 | + /** |
|
| 96 | + * @param string $uid |
|
| 97 | + */ |
|
| 92 | 98 | protected function createDummyUserKeys($uid) { |
| 93 | 99 | $this->loginAsUser($uid); |
| 94 | 100 | |
@@ -98,6 +104,9 @@ discard block |
||
| 98 | 104 | $this->view->file_put_contents('/files_encryption/public_keys/' . $uid . '.publicKey', 'publicKey'); |
| 99 | 105 | } |
| 100 | 106 | |
| 107 | + /** |
|
| 108 | + * @param string $uid |
|
| 109 | + */ |
|
| 101 | 110 | protected function createDummyFileKeys($uid) { |
| 102 | 111 | $this->loginAsUser($uid); |
| 103 | 112 | |
@@ -111,6 +120,9 @@ discard block |
||
| 111 | 120 | $this->view->file_put_contents($uid . '/files_encryption/keys/folder2/file.2.1/fileKey' , 'data'); |
| 112 | 121 | } |
| 113 | 122 | |
| 123 | + /** |
|
| 124 | + * @param string $uid |
|
| 125 | + */ |
|
| 114 | 126 | protected function createDummyFiles($uid) { |
| 115 | 127 | $this->loginAsUser($uid); |
| 116 | 128 | |
@@ -124,6 +136,9 @@ discard block |
||
| 124 | 136 | $this->view->file_put_contents($uid . '/files/folder2/file.2.1/fileKey' , 'data'); |
| 125 | 137 | } |
| 126 | 138 | |
| 139 | + /** |
|
| 140 | + * @param string $uid |
|
| 141 | + */ |
|
| 127 | 142 | protected function createDummyFilesInTrash($uid) { |
| 128 | 143 | $this->loginAsUser($uid); |
| 129 | 144 | |
@@ -239,6 +254,9 @@ discard block |
||
| 239 | 254 | |
| 240 | 255 | } |
| 241 | 256 | |
| 257 | + /** |
|
| 258 | + * @param string $uid |
|
| 259 | + */ |
|
| 242 | 260 | protected function verifyFilesInTrash($uid) { |
| 243 | 261 | $this->loginAsUser($uid); |
| 244 | 262 | |
@@ -266,6 +284,9 @@ discard block |
||
| 266 | 284 | ); |
| 267 | 285 | } |
| 268 | 286 | |
| 287 | + /** |
|
| 288 | + * @param string $uid |
|
| 289 | + */ |
|
| 269 | 290 | protected function verifyNewKeyPath($uid) { |
| 270 | 291 | // private key |
| 271 | 292 | if ($uid !== '') { |
@@ -394,6 +415,11 @@ discard block |
||
| 394 | 415 | |
| 395 | 416 | } |
| 396 | 417 | |
| 418 | + /** |
|
| 419 | + * @param string $table |
|
| 420 | + * @param string $appid |
|
| 421 | + * @param integer $expected |
|
| 422 | + */ |
|
| 397 | 423 | public function verifyDB($table, $appid, $expected) { |
| 398 | 424 | /** @var \OCP\IDBConnection $connection */ |
| 399 | 425 | $connection = \OC::$server->getDatabaseConnection(); |
@@ -127,7 +127,7 @@ |
||
| 127 | 127 | * |
| 128 | 128 | * @NoAdminRequired |
| 129 | 129 | * |
| 130 | - * @param array|string $tagName tag name to filter by |
|
| 130 | + * @param string[] $tagName tag name to filter by |
|
| 131 | 131 | * @return DataResponse |
| 132 | 132 | */ |
| 133 | 133 | public function getFilesByTag($tagName) { |
@@ -195,7 +195,7 @@ |
||
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | /** |
| 198 | - * @return bool|string |
|
| 198 | + * @return string|false |
|
| 199 | 199 | */ |
| 200 | 200 | private function hostKeysPath() { |
| 201 | 201 | try { |