@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | $this->recoveryKeyId = $this->config->getAppValue('encryption', |
| 140 | 140 | 'recoveryKeyId'); |
| 141 | 141 | if (empty($this->recoveryKeyId)) { |
| 142 | - $this->recoveryKeyId = 'recoveryKey_' . substr(md5(time()), 0, 8); |
|
| 142 | + $this->recoveryKeyId = 'recoveryKey_'.substr(md5(time()), 0, 8); |
|
| 143 | 143 | $this->config->setAppValue('encryption', |
| 144 | 144 | 'recoveryKeyId', |
| 145 | 145 | $this->recoveryKeyId); |
@@ -148,14 +148,14 @@ discard block |
||
| 148 | 148 | $this->publicShareKeyId = $this->config->getAppValue('encryption', |
| 149 | 149 | 'publicShareKeyId'); |
| 150 | 150 | if (empty($this->publicShareKeyId)) { |
| 151 | - $this->publicShareKeyId = 'pubShare_' . substr(md5(time()), 0, 8); |
|
| 151 | + $this->publicShareKeyId = 'pubShare_'.substr(md5(time()), 0, 8); |
|
| 152 | 152 | $this->config->setAppValue('encryption', 'publicShareKeyId', $this->publicShareKeyId); |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | $this->masterKeyId = $this->config->getAppValue('encryption', |
| 156 | 156 | 'masterKeyId'); |
| 157 | 157 | if (empty($this->masterKeyId)) { |
| 158 | - $this->masterKeyId = 'master_' . substr(md5(time()), 0, 8); |
|
| 158 | + $this->masterKeyId = 'master_'.substr(md5(time()), 0, 8); |
|
| 159 | 159 | $this->config->setAppValue('encryption', 'masterKeyId', $this->masterKeyId); |
| 160 | 160 | } |
| 161 | 161 | |
@@ -175,13 +175,13 @@ discard block |
||
| 175 | 175 | |
| 176 | 176 | // Save public key |
| 177 | 177 | $this->keyStorage->setSystemUserKey( |
| 178 | - $this->publicShareKeyId . '.' . $this->publicKeyId, $keyPair['publicKey'], |
|
| 178 | + $this->publicShareKeyId.'.'.$this->publicKeyId, $keyPair['publicKey'], |
|
| 179 | 179 | Encryption::ID); |
| 180 | 180 | |
| 181 | 181 | // Encrypt private key empty passphrase |
| 182 | 182 | $encryptedKey = $this->crypt->encryptPrivateKey($keyPair['privateKey'], ''); |
| 183 | 183 | $header = $this->crypt->generateHeader(); |
| 184 | - $this->setSystemPrivateKey($this->publicShareKeyId, $header . $encryptedKey); |
|
| 184 | + $this->setSystemPrivateKey($this->publicShareKeyId, $header.$encryptedKey); |
|
| 185 | 185 | } catch (\Throwable $e) { |
| 186 | 186 | $this->lockingProvider->releaseLock('encryption-generateSharedKey', ILockingProvider::LOCK_EXCLUSIVE); |
| 187 | 187 | throw $e; |
@@ -211,13 +211,13 @@ discard block |
||
| 211 | 211 | |
| 212 | 212 | // Save public key |
| 213 | 213 | $this->keyStorage->setSystemUserKey( |
| 214 | - $this->masterKeyId . '.' . $this->publicKeyId, $keyPair['publicKey'], |
|
| 214 | + $this->masterKeyId.'.'.$this->publicKeyId, $keyPair['publicKey'], |
|
| 215 | 215 | Encryption::ID); |
| 216 | 216 | |
| 217 | 217 | // Encrypt private key with system password |
| 218 | 218 | $encryptedKey = $this->crypt->encryptPrivateKey($keyPair['privateKey'], $this->getMasterKeyPassword(), $this->masterKeyId); |
| 219 | 219 | $header = $this->crypt->generateHeader(); |
| 220 | - $this->setSystemPrivateKey($this->masterKeyId, $header . $encryptedKey); |
|
| 220 | + $this->setSystemPrivateKey($this->masterKeyId, $header.$encryptedKey); |
|
| 221 | 221 | } catch (\Throwable $e) { |
| 222 | 222 | $this->lockingProvider->releaseLock('encryption-generateMasterKey', ILockingProvider::LOCK_EXCLUSIVE); |
| 223 | 223 | throw $e; |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | * @return string |
| 256 | 256 | */ |
| 257 | 257 | public function getRecoveryKey() { |
| 258 | - return $this->keyStorage->getSystemUserKey($this->recoveryKeyId . '.' . $this->publicKeyId, Encryption::ID); |
|
| 258 | + return $this->keyStorage->getSystemUserKey($this->recoveryKeyId.'.'.$this->publicKeyId, Encryption::ID); |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | /** |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | * @return bool |
| 273 | 273 | */ |
| 274 | 274 | public function checkRecoveryPassword($password) { |
| 275 | - $recoveryKey = $this->keyStorage->getSystemUserKey($this->recoveryKeyId . '.' . $this->privateKeyId, Encryption::ID); |
|
| 275 | + $recoveryKey = $this->keyStorage->getSystemUserKey($this->recoveryKeyId.'.'.$this->privateKeyId, Encryption::ID); |
|
| 276 | 276 | $decryptedRecoveryKey = $this->crypt->decryptPrivateKey($recoveryKey, $password); |
| 277 | 277 | |
| 278 | 278 | if ($decryptedRecoveryKey) { |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | $header = $this->crypt->generateHeader(); |
| 297 | 297 | |
| 298 | 298 | if ($encryptedKey) { |
| 299 | - $this->setPrivateKey($uid, $header . $encryptedKey); |
|
| 299 | + $this->setPrivateKey($uid, $header.$encryptedKey); |
|
| 300 | 300 | return true; |
| 301 | 301 | } |
| 302 | 302 | return false; |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | public function setRecoveryKey($password, $keyPair) { |
| 311 | 311 | // Save Public Key |
| 312 | 312 | $this->keyStorage->setSystemUserKey($this->getRecoveryKeyId(). |
| 313 | - '.' . $this->publicKeyId, |
|
| 313 | + '.'.$this->publicKeyId, |
|
| 314 | 314 | $keyPair['publicKey'], |
| 315 | 315 | Encryption::ID); |
| 316 | 316 | |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | $header = $this->crypt->generateHeader(); |
| 319 | 319 | |
| 320 | 320 | if ($encryptedKey) { |
| 321 | - $this->setSystemPrivateKey($this->getRecoveryKeyId(), $header . $encryptedKey); |
|
| 321 | + $this->setSystemPrivateKey($this->getRecoveryKeyId(), $header.$encryptedKey); |
|
| 322 | 322 | return true; |
| 323 | 323 | } |
| 324 | 324 | return false; |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | * @return boolean |
| 379 | 379 | */ |
| 380 | 380 | public function setShareKey($path, $uid, $key) { |
| 381 | - $keyId = $uid . '.' . $this->shareKeyId; |
|
| 381 | + $keyId = $uid.'.'.$this->shareKeyId; |
|
| 382 | 382 | return $this->keyStorage->setFileKey($path, $keyId, $key, Encryption::ID); |
| 383 | 383 | } |
| 384 | 384 | |
@@ -407,7 +407,7 @@ discard block |
||
| 407 | 407 | return false; |
| 408 | 408 | } catch (\Exception $e) { |
| 409 | 409 | $this->log->logException($e, [ |
| 410 | - 'message' => 'Could not decrypt the private key from user "' . $uid . '"" during login. Assume password change on the user back-end.', |
|
| 410 | + 'message' => 'Could not decrypt the private key from user "'.$uid.'"" during login. Assume password change on the user back-end.', |
|
| 411 | 411 | 'level' => ILogger::WARN, |
| 412 | 412 | 'app' => 'encryption', |
| 413 | 413 | ]); |
@@ -468,7 +468,7 @@ discard block |
||
| 468 | 468 | // use public share key for public links |
| 469 | 469 | $uid = $this->getPublicShareKeyId(); |
| 470 | 470 | $shareKey = $this->getShareKey($path, $uid); |
| 471 | - $privateKey = $this->keyStorage->getSystemUserKey($this->publicShareKeyId . '.' . $this->privateKeyId, Encryption::ID); |
|
| 471 | + $privateKey = $this->keyStorage->getSystemUserKey($this->publicShareKeyId.'.'.$this->privateKeyId, Encryption::ID); |
|
| 472 | 472 | $privateKey = $this->crypt->decryptPrivateKey($privateKey); |
| 473 | 473 | } else { |
| 474 | 474 | $shareKey = $this->getShareKey($path, $uid); |
@@ -507,7 +507,7 @@ discard block |
||
| 507 | 507 | * @param View $view |
| 508 | 508 | */ |
| 509 | 509 | public function setVersion($path, $version, View $view) { |
| 510 | - $fileInfo= $view->getFileInfo($path); |
|
| 510 | + $fileInfo = $view->getFileInfo($path); |
|
| 511 | 511 | |
| 512 | 512 | if ($fileInfo !== false) { |
| 513 | 513 | $cache = $fileInfo->getStorage()->getCache(); |
@@ -538,7 +538,7 @@ discard block |
||
| 538 | 538 | public function deleteShareKey($path, $keyId) { |
| 539 | 539 | return $this->keyStorage->deleteFileKey( |
| 540 | 540 | $path, |
| 541 | - $keyId . '.' . $this->shareKeyId, |
|
| 541 | + $keyId.'.'.$this->shareKeyId, |
|
| 542 | 542 | Encryption::ID); |
| 543 | 543 | } |
| 544 | 544 | |
@@ -549,7 +549,7 @@ discard block |
||
| 549 | 549 | * @return mixed |
| 550 | 550 | */ |
| 551 | 551 | public function getShareKey($path, $uid) { |
| 552 | - $keyId = $uid . '.' . $this->shareKeyId; |
|
| 552 | + $keyId = $uid.'.'.$this->shareKeyId; |
|
| 553 | 553 | return $this->keyStorage->getFileKey($path, $keyId, Encryption::ID); |
| 554 | 554 | } |
| 555 | 555 | |
@@ -611,7 +611,7 @@ discard block |
||
| 611 | 611 | * @return string |
| 612 | 612 | */ |
| 613 | 613 | public function getPublicShareKey() { |
| 614 | - return $this->keyStorage->getSystemUserKey($this->publicShareKeyId . '.' . $this->publicKeyId, Encryption::ID); |
|
| 614 | + return $this->keyStorage->getSystemUserKey($this->publicShareKeyId.'.'.$this->publicKeyId, Encryption::ID); |
|
| 615 | 615 | } |
| 616 | 616 | |
| 617 | 617 | /** |
@@ -680,7 +680,7 @@ discard block |
||
| 680 | 680 | * @return string returns openssl key |
| 681 | 681 | */ |
| 682 | 682 | public function getSystemPrivateKey($keyId) { |
| 683 | - return $this->keyStorage->getSystemUserKey($keyId . '.' . $this->privateKeyId, Encryption::ID); |
|
| 683 | + return $this->keyStorage->getSystemUserKey($keyId.'.'.$this->privateKeyId, Encryption::ID); |
|
| 684 | 684 | } |
| 685 | 685 | |
| 686 | 686 | /** |
@@ -690,7 +690,7 @@ discard block |
||
| 690 | 690 | */ |
| 691 | 691 | public function setSystemPrivateKey($keyId, $key) { |
| 692 | 692 | return $this->keyStorage->setSystemUserKey( |
| 693 | - $keyId . '.' . $this->privateKeyId, |
|
| 693 | + $keyId.'.'.$this->privateKeyId, |
|
| 694 | 694 | $key, |
| 695 | 695 | Encryption::ID); |
| 696 | 696 | } |
@@ -751,7 +751,7 @@ discard block |
||
| 751 | 751 | * @return string |
| 752 | 752 | */ |
| 753 | 753 | public function getPublicMasterKey() { |
| 754 | - return $this->keyStorage->getSystemUserKey($this->masterKeyId . '.' . $this->publicKeyId, Encryption::ID); |
|
| 754 | + return $this->keyStorage->getSystemUserKey($this->masterKeyId.'.'.$this->publicKeyId, Encryption::ID); |
|
| 755 | 755 | } |
| 756 | 756 | |
| 757 | 757 | /** |
@@ -760,6 +760,6 @@ discard block |
||
| 760 | 760 | * @return string |
| 761 | 761 | */ |
| 762 | 762 | public function getPrivateMasterKey() { |
| 763 | - return $this->keyStorage->getSystemUserKey($this->masterKeyId . '.' . $this->privateKeyId, Encryption::ID); |
|
| 763 | + return $this->keyStorage->getSystemUserKey($this->masterKeyId.'.'.$this->privateKeyId, Encryption::ID); |
|
| 764 | 764 | } |
| 765 | 765 | } |