@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | |
110 | 110 | if (!$keyManager->recoveryKeyExists()) { |
111 | 111 | $keyPair = $this->crypt->createKeyPair(); |
112 | - if(!is_array($keyPair)) { |
|
112 | + if (!is_array($keyPair)) { |
|
113 | 113 | return false; |
114 | 114 | } |
115 | 115 | |
@@ -134,13 +134,13 @@ discard block |
||
134 | 134 | public function changeRecoveryKeyPassword($newPassword, $oldPassword) { |
135 | 135 | $recoveryKey = $this->keyManager->getSystemPrivateKey($this->keyManager->getRecoveryKeyId()); |
136 | 136 | $decryptedRecoveryKey = $this->crypt->decryptPrivateKey($recoveryKey, $oldPassword); |
137 | - if($decryptedRecoveryKey === false) { |
|
137 | + if ($decryptedRecoveryKey === false) { |
|
138 | 138 | return false; |
139 | 139 | } |
140 | 140 | $encryptedRecoveryKey = $this->crypt->encryptPrivateKey($decryptedRecoveryKey, $newPassword); |
141 | 141 | $header = $this->crypt->generateHeader(); |
142 | 142 | if ($encryptedRecoveryKey) { |
143 | - $this->keyManager->setSystemPrivateKey($this->keyManager->getRecoveryKeyId(), $header . $encryptedRecoveryKey); |
|
143 | + $this->keyManager->setSystemPrivateKey($this->keyManager->getRecoveryKeyId(), $header.$encryptedRecoveryKey); |
|
144 | 144 | return true; |
145 | 145 | } |
146 | 146 | return false; |
@@ -202,9 +202,9 @@ discard block |
||
202 | 202 | $value); |
203 | 203 | |
204 | 204 | if ($value === '1') { |
205 | - $this->addRecoveryKeys('/' . $this->user->getUID() . '/files/'); |
|
205 | + $this->addRecoveryKeys('/'.$this->user->getUID().'/files/'); |
|
206 | 206 | } else { |
207 | - $this->removeRecoveryKeys('/' . $this->user->getUID() . '/files/'); |
|
207 | + $this->removeRecoveryKeys('/'.$this->user->getUID().'/files/'); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | return true; |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | foreach ($dirContent as $item) { |
223 | 223 | $filePath = $item->getPath(); |
224 | 224 | if ($item['type'] === 'dir') { |
225 | - $this->addRecoveryKeys($filePath . '/'); |
|
225 | + $this->addRecoveryKeys($filePath.'/'); |
|
226 | 226 | } else { |
227 | 227 | $fileKey = $this->keyManager->getFileKey($filePath, $this->user->getUID()); |
228 | 228 | if (!empty($fileKey)) { |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | foreach ($dirContent as $item) { |
251 | 251 | $filePath = $item->getPath(); |
252 | 252 | if ($item['type'] === 'dir') { |
253 | - $this->removeRecoveryKeys($filePath . '/'); |
|
253 | + $this->removeRecoveryKeys($filePath.'/'); |
|
254 | 254 | } else { |
255 | 255 | $this->keyManager->deleteShareKey($filePath, $this->keyManager->getRecoveryKeyId()); |
256 | 256 | } |
@@ -267,8 +267,8 @@ discard block |
||
267 | 267 | $encryptedKey = $this->keyManager->getSystemPrivateKey($this->keyManager->getRecoveryKeyId()); |
268 | 268 | |
269 | 269 | $privateKey = $this->crypt->decryptPrivateKey($encryptedKey, $recoveryPassword); |
270 | - if($privateKey !== false) { |
|
271 | - $this->recoverAllFiles('/' . $user . '/files/', $privateKey, $user); |
|
270 | + if ($privateKey !== false) { |
|
271 | + $this->recoverAllFiles('/'.$user.'/files/', $privateKey, $user); |
|
272 | 272 | } |
273 | 273 | } |
274 | 274 | |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | // Get relative path from encryption/keyfiles |
287 | 287 | $filePath = $item->getPath(); |
288 | 288 | if ($this->view->is_dir($filePath)) { |
289 | - $this->recoverAllFiles($filePath . '/', $privateKey, $uid); |
|
289 | + $this->recoverAllFiles($filePath.'/', $privateKey, $uid); |
|
290 | 290 | } else { |
291 | 291 | $this->recoverFile($filePath, $privateKey, $uid); |
292 | 292 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | $output->writeln("Reorganize system folder structure"); |
99 | 99 | $migration->reorganizeSystemFolderStructure(); |
100 | 100 | $migration->updateDB(); |
101 | - foreach($this->userManager->getBackends() as $backend) { |
|
101 | + foreach ($this->userManager->getBackends() as $backend) { |
|
102 | 102 | $name = get_class($backend); |
103 | 103 | |
104 | 104 | if ($backend instanceof IUserBackend) { |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | $migration->reorganizeFolderStructureForUser($user); |
117 | 117 | } |
118 | 118 | $offset += $limit; |
119 | - } while(count($users) >= $limit); |
|
119 | + } while (count($users) >= $limit); |
|
120 | 120 | } |
121 | 121 | } |
122 | 122 |
@@ -68,7 +68,7 @@ |
||
68 | 68 | |
69 | 69 | $isAlreadyEnabled = $this->util->isMasterKeyEnabled(); |
70 | 70 | |
71 | - if($isAlreadyEnabled) { |
|
71 | + if ($isAlreadyEnabled) { |
|
72 | 72 | $output->writeln('Master key already enabled'); |
73 | 73 | } else { |
74 | 74 | $question = new ConfirmationQuestion( |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | // Save private key |
277 | 277 | if ($encryptedPrivateKey) { |
278 | 278 | $this->keyManager->setPrivateKey($this->user->getUser()->getUID(), |
279 | - $this->crypt->generateHeader() . $encryptedPrivateKey); |
|
279 | + $this->crypt->generateHeader().$encryptedPrivateKey); |
|
280 | 280 | } else { |
281 | 281 | $this->logger->error('Encryption could not update users encryption password'); |
282 | 282 | } |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | $encryptedKey = $this->crypt->encryptPrivateKey($keyPair['privateKey'], $newUserPassword, $user); |
314 | 314 | |
315 | 315 | if ($encryptedKey) { |
316 | - $this->keyManager->setPrivateKey($user, $this->crypt->generateHeader() . $encryptedKey); |
|
316 | + $this->keyManager->setPrivateKey($user, $this->crypt->generateHeader().$encryptedKey); |
|
317 | 317 | |
318 | 318 | if ($recoveryPassword) { // if recovery key is set we can re-encrypt the key files |
319 | 319 | $this->recovery->recoverUsersFiles($recoveryPassword, $user); |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | $this->input = $input; |
134 | 134 | $this->output = $output; |
135 | 135 | |
136 | - $headline = 'Encrypt all files with the ' . Encryption::DISPLAY_NAME; |
|
136 | + $headline = 'Encrypt all files with the '.Encryption::DISPLAY_NAME; |
|
137 | 137 | $this->output->writeln("\n"); |
138 | 138 | $this->output->writeln($headline); |
139 | 139 | $this->output->writeln(str_pad('', strlen($headline), '=')); |
@@ -179,14 +179,14 @@ discard block |
||
179 | 179 | $progress->setFormat(" %message% \n [%bar%]"); |
180 | 180 | $progress->start(); |
181 | 181 | |
182 | - foreach($this->userManager->getBackends() as $backend) { |
|
182 | + foreach ($this->userManager->getBackends() as $backend) { |
|
183 | 183 | $limit = 500; |
184 | 184 | $offset = 0; |
185 | 185 | do { |
186 | 186 | $users = $backend->getUsers('', $limit, $offset); |
187 | 187 | foreach ($users as $user) { |
188 | 188 | if ($this->keyManager->userHasKeys($user) === false) { |
189 | - $progress->setMessage('Create key-pair for ' . $user); |
|
189 | + $progress->setMessage('Create key-pair for '.$user); |
|
190 | 190 | $progress->advance(); |
191 | 191 | $this->setupUserFS($user); |
192 | 192 | $password = $this->generateOneTimePassword($user); |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | } |
199 | 199 | } |
200 | 200 | $offset += $limit; |
201 | - } while(count($users) >= $limit); |
|
201 | + } while (count($users) >= $limit); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | $progress->setMessage('Key-pair created for all users'); |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | */ |
237 | 237 | protected function encryptAllUserFilesWithMasterKey(ProgressBar $progress) { |
238 | 238 | $userNo = 1; |
239 | - foreach($this->userManager->getBackends() as $backend) { |
|
239 | + foreach ($this->userManager->getBackends() as $backend) { |
|
240 | 240 | $limit = 500; |
241 | 241 | $offset = 0; |
242 | 242 | do { |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | $userNo++; |
248 | 248 | } |
249 | 249 | $offset += $limit; |
250 | - } while(count($users) >= $limit); |
|
250 | + } while (count($users) >= $limit); |
|
251 | 251 | } |
252 | 252 | } |
253 | 253 | |
@@ -262,19 +262,19 @@ discard block |
||
262 | 262 | |
263 | 263 | $this->setupUserFS($uid); |
264 | 264 | $directories = array(); |
265 | - $directories[] = '/' . $uid . '/files'; |
|
265 | + $directories[] = '/'.$uid.'/files'; |
|
266 | 266 | |
267 | - while($root = array_pop($directories)) { |
|
267 | + while ($root = array_pop($directories)) { |
|
268 | 268 | $content = $this->rootView->getDirectoryContent($root); |
269 | 269 | foreach ($content as $file) { |
270 | - $path = $root . '/' . $file['name']; |
|
270 | + $path = $root.'/'.$file['name']; |
|
271 | 271 | if ($this->rootView->is_dir($path)) { |
272 | 272 | $directories[] = $path; |
273 | 273 | continue; |
274 | 274 | } else { |
275 | 275 | $progress->setMessage("encrypt files for user $userCount: $path"); |
276 | 276 | $progress->advance(); |
277 | - if($this->encryptFile($path) === false) { |
|
277 | + if ($this->encryptFile($path) === false) { |
|
278 | 278 | $progress->setMessage("encrypt files for user $userCount: $path (already encrypted)"); |
279 | 279 | $progress->advance(); |
280 | 280 | } |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | protected function encryptFile($path) { |
293 | 293 | |
294 | 294 | $source = $path; |
295 | - $target = $path . '.encrypted.' . time(); |
|
295 | + $target = $path.'.encrypted.'.time(); |
|
296 | 296 | |
297 | 297 | try { |
298 | 298 | $this->rootView->copy($source, $target); |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | continue; |
415 | 415 | } |
416 | 416 | |
417 | - $subject = (string)$this->l->t('one-time password for server-side-encryption'); |
|
417 | + $subject = (string) $this->l->t('one-time password for server-side-encryption'); |
|
418 | 418 | list($htmlBody, $textBody) = $this->createMailBody($password); |
419 | 419 | |
420 | 420 | // send it out now |
@@ -462,11 +462,11 @@ discard block |
||
462 | 462 | protected function createMailBody($password) { |
463 | 463 | |
464 | 464 | $html = new \OC_Template("encryption", "mail", ""); |
465 | - $html->assign ('password', $password); |
|
465 | + $html->assign('password', $password); |
|
466 | 466 | $htmlMail = $html->fetchPage(); |
467 | 467 | |
468 | 468 | $plainText = new \OC_Template("encryption", "altmail", ""); |
469 | - $plainText->assign ('password', $password); |
|
469 | + $plainText->assign('password', $password); |
|
470 | 470 | $plainTextMail = $plainText->fetchPage(); |
471 | 471 | |
472 | 472 | return [$htmlMail, $plainTextMail]; |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | ['app' => 'encryption']); |
118 | 118 | |
119 | 119 | if (openssl_error_string()) { |
120 | - $log->error('Encryption library openssl_pkey_new() fails: ' . openssl_error_string(), |
|
120 | + $log->error('Encryption library openssl_pkey_new() fails: '.openssl_error_string(), |
|
121 | 121 | ['app' => 'encryption']); |
122 | 122 | } |
123 | 123 | } elseif (openssl_pkey_export($res, |
@@ -132,10 +132,10 @@ discard block |
||
132 | 132 | 'privateKey' => $privateKey |
133 | 133 | ]; |
134 | 134 | } |
135 | - $log->error('Encryption library couldn\'t export users private key, please check your servers OpenSSL configuration.' . $this->user, |
|
135 | + $log->error('Encryption library couldn\'t export users private key, please check your servers OpenSSL configuration.'.$this->user, |
|
136 | 136 | ['app' => 'encryption']); |
137 | 137 | if (openssl_error_string()) { |
138 | - $log->error('Encryption Library:' . openssl_error_string(), |
|
138 | + $log->error('Encryption Library:'.openssl_error_string(), |
|
139 | 139 | ['app' => 'encryption']); |
140 | 140 | } |
141 | 141 | |
@@ -210,15 +210,15 @@ discard block |
||
210 | 210 | public function generateHeader($keyFormat = 'hash') { |
211 | 211 | |
212 | 212 | if (in_array($keyFormat, $this->supportedKeyFormats, true) === false) { |
213 | - throw new \InvalidArgumentException('key format "' . $keyFormat . '" is not supported'); |
|
213 | + throw new \InvalidArgumentException('key format "'.$keyFormat.'" is not supported'); |
|
214 | 214 | } |
215 | 215 | |
216 | 216 | $cipher = $this->getCipher(); |
217 | 217 | |
218 | 218 | $header = self::HEADER_START |
219 | - . ':cipher:' . $cipher |
|
220 | - . ':keyFormat:' . $keyFormat |
|
221 | - . ':' . self::HEADER_END; |
|
219 | + . ':cipher:'.$cipher |
|
220 | + . ':keyFormat:'.$keyFormat |
|
221 | + . ':'.self::HEADER_END; |
|
222 | 222 | |
223 | 223 | return $header; |
224 | 224 | } |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | |
241 | 241 | if (!$encryptedContent) { |
242 | 242 | $error = 'Encryption (symmetric) of content failed'; |
243 | - $this->logger->error($error . openssl_error_string(), |
|
243 | + $this->logger->error($error.openssl_error_string(), |
|
244 | 244 | ['app' => 'encryption']); |
245 | 245 | throw new EncryptionFailedException($error); |
246 | 246 | } |
@@ -268,8 +268,8 @@ discard block |
||
268 | 268 | } |
269 | 269 | |
270 | 270 | // Workaround for OpenSSL 0.9.8. Fallback to an old cipher that should work. |
271 | - if(OPENSSL_VERSION_NUMBER < 0x1000101f) { |
|
272 | - if($cipher === 'AES-256-CTR' || $cipher === 'AES-128-CTR') { |
|
271 | + if (OPENSSL_VERSION_NUMBER < 0x1000101f) { |
|
272 | + if ($cipher === 'AES-256-CTR' || $cipher === 'AES-128-CTR') { |
|
273 | 273 | $cipher = self::LEGACY_CIPHER; |
274 | 274 | } |
275 | 275 | } |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | * @throws \InvalidArgumentException |
286 | 286 | */ |
287 | 287 | protected function getKeySize($cipher) { |
288 | - if(isset($this->supportedCiphersAndKeySize[$cipher])) { |
|
288 | + if (isset($this->supportedCiphersAndKeySize[$cipher])) { |
|
289 | 289 | return $this->supportedCiphersAndKeySize[$cipher]; |
290 | 290 | } |
291 | 291 | |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | * @return string |
313 | 313 | */ |
314 | 314 | private function concatIV($encryptedContent, $iv) { |
315 | - return $encryptedContent . '00iv00' . $iv; |
|
315 | + return $encryptedContent.'00iv00'.$iv; |
|
316 | 316 | } |
317 | 317 | |
318 | 318 | /** |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | * @return string |
322 | 322 | */ |
323 | 323 | private function concatSig($encryptedContent, $signature) { |
324 | - return $encryptedContent . '00sig00' . $signature; |
|
324 | + return $encryptedContent.'00sig00'.$signature; |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | /** |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | * @return string |
334 | 334 | */ |
335 | 335 | private function addPadding($data) { |
336 | - return $data . 'xxx'; |
|
336 | + return $data.'xxx'; |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | /** |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | protected function generatePasswordHash($password, $cipher, $uid = '') { |
348 | 348 | $instanceId = $this->config->getSystemValue('instanceid'); |
349 | 349 | $instanceSecret = $this->config->getSystemValue('secret'); |
350 | - $salt = hash('sha256', $uid . $instanceId . $instanceSecret, true); |
|
350 | + $salt = hash('sha256', $uid.$instanceId.$instanceSecret, true); |
|
351 | 351 | $keySize = $this->getKeySize($cipher); |
352 | 352 | |
353 | 353 | $hash = hash_pbkdf2( |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | * @return string |
494 | 494 | */ |
495 | 495 | private function createSignature($data, $passPhrase) { |
496 | - $passPhrase = hash('sha512', $passPhrase . 'a', true); |
|
496 | + $passPhrase = hash('sha512', $passPhrase.'a', true); |
|
497 | 497 | $signature = hash_hmac('sha256', $data, $passPhrase); |
498 | 498 | return $signature; |
499 | 499 | } |
@@ -585,7 +585,7 @@ discard block |
||
585 | 585 | if ($plainContent) { |
586 | 586 | return $plainContent; |
587 | 587 | } else { |
588 | - throw new DecryptionFailedException('Encryption library: Decryption (symmetric) of content failed: ' . openssl_error_string()); |
|
588 | + throw new DecryptionFailedException('Encryption library: Decryption (symmetric) of content failed: '.openssl_error_string()); |
|
589 | 589 | } |
590 | 590 | } |
591 | 591 | |
@@ -651,7 +651,7 @@ discard block |
||
651 | 651 | if (openssl_open($encKeyFile, $plainContent, $shareKey, $privateKey)) { |
652 | 652 | return $plainContent; |
653 | 653 | } else { |
654 | - throw new MultiKeyDecryptException('multikeydecrypt with share key failed:' . openssl_error_string()); |
|
654 | + throw new MultiKeyDecryptException('multikeydecrypt with share key failed:'.openssl_error_string()); |
|
655 | 655 | } |
656 | 656 | } |
657 | 657 | |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | 'data' => $sealed |
688 | 688 | ]; |
689 | 689 | } else { |
690 | - throw new MultiKeyEncryptException('multikeyencryption failed ' . openssl_error_string()); |
|
690 | + throw new MultiKeyEncryptException('multikeyencryption failed '.openssl_error_string()); |
|
691 | 691 | } |
692 | 692 | } |
693 | 693 | } |
@@ -83,10 +83,10 @@ discard block |
||
83 | 83 | |
84 | 84 | $question = new Question('Please enter the recovery key password: '); |
85 | 85 | |
86 | - if($this->util->isMasterKeyEnabled()) { |
|
86 | + if ($this->util->isMasterKeyEnabled()) { |
|
87 | 87 | $output->writeln('Use master key to decrypt all files'); |
88 | 88 | $user = $this->keyManager->getMasterKeyId(); |
89 | - $password =$this->keyManager->getMasterKeyPassword(); |
|
89 | + $password = $this->keyManager->getMasterKeyPassword(); |
|
90 | 90 | } else { |
91 | 91 | $recoveryKeyId = $this->keyManager->getRecoveryKeyId(); |
92 | 92 | if (!empty($user)) { |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | if ($useLoginPassword) { |
102 | 102 | $question = new Question('Please enter the user\'s login password: '); |
103 | 103 | } else if ($this->util->isRecoveryEnabledForUser($user) === false) { |
104 | - $output->writeln('No recovery key available for user ' . $user); |
|
104 | + $output->writeln('No recovery key available for user '.$user); |
|
105 | 105 | return false; |
106 | 106 | } else { |
107 | 107 | $user = $recoveryKeyId; |
@@ -92,8 +92,8 @@ |
||
92 | 92 | /** @var Node $node */ |
93 | 93 | $node = array_shift($nodes); |
94 | 94 | $path = $node->getPath(); |
95 | - if (strpos($path, '/' . $owner . '/files/') === 0) { |
|
96 | - $path = substr($path, strlen('/' . $owner . '/files')); |
|
95 | + if (strpos($path, '/'.$owner.'/files/') === 0) { |
|
96 | + $path = substr($path, strlen('/'.$owner.'/files')); |
|
97 | 97 | } |
98 | 98 | // Get all users that have access to the mount point |
99 | 99 | $users = array_merge($users, Share::getUsersSharingFile($path, $owner, true, true)); |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | <label for="select_all_trash"> |
28 | 28 | <span class="hidden-visually"><?php p($l->t('Select all'))?></span> |
29 | 29 | </label> |
30 | - <a class="name sort columntitle" data-sort="name"><span><?php p($l->t( 'Name' )); ?></span><span class="sort-indicator"></span></a> |
|
30 | + <a class="name sort columntitle" data-sort="name"><span><?php p($l->t('Name')); ?></span><span class="sort-indicator"></span></a> |
|
31 | 31 | <span id="selectedActionsList" class='selectedActions'> |
32 | 32 | <a href="" class="undelete"> |
33 | 33 | <span class="icon icon-history"></span> |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | </div> |
38 | 38 | </th> |
39 | 39 | <th id="headerDate" class="hidden column-mtime"> |
40 | - <a id="modified" class="columntitle" data-sort="mtime"><span><?php p($l->t( 'Deleted' )); ?></span><span class="sort-indicator"></span></a> |
|
40 | + <a id="modified" class="columntitle" data-sort="mtime"><span><?php p($l->t('Deleted')); ?></span><span class="sort-indicator"></span></a> |
|
41 | 41 | <span class="selectedActions"> |
42 | 42 | <a href="" class="delete-selected"> |
43 | 43 | <span><?php p($l->t('Delete'))?></span> |