Passed
Push — master ( ad6a42...15d708 )
by Morris
11:59 queued 11s
created
apps/encryption/lib/Crypto/Crypt.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
@@ -206,15 +206,15 @@  discard block
 block discarded – undo
206 206
 	 */
207 207
 	public function generateHeader($keyFormat = 'hash') {
208 208
 		if (in_array($keyFormat, $this->supportedKeyFormats, true) === false) {
209
-			throw new \InvalidArgumentException('key format "' . $keyFormat . '" is not supported');
209
+			throw new \InvalidArgumentException('key format "'.$keyFormat.'" is not supported');
210 210
 		}
211 211
 
212 212
 		$cipher = $this->getCipher();
213 213
 
214 214
 		$header = self::HEADER_START
215
-			. ':cipher:' . $cipher
216
-			. ':keyFormat:' . $keyFormat
217
-			. ':' . self::HEADER_END;
215
+			. ':cipher:'.$cipher
216
+			. ':keyFormat:'.$keyFormat
217
+			. ':'.self::HEADER_END;
218 218
 
219 219
 		return $header;
220 220
 	}
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 
237 237
 		if (!$encryptedContent) {
238 238
 			$error = 'Encryption (symmetric) of content failed';
239
-			$this->logger->error($error . openssl_error_string(),
239
+			$this->logger->error($error.openssl_error_string(),
240 240
 				['app' => 'encryption']);
241 241
 			throw new EncryptionFailedException($error);
242 242
 		}
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
 	 * @return string
309 309
 	 */
310 310
 	private function concatIV($encryptedContent, $iv) {
311
-		return $encryptedContent . '00iv00' . $iv;
311
+		return $encryptedContent.'00iv00'.$iv;
312 312
 	}
313 313
 
314 314
 	/**
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 	 * @return string
318 318
 	 */
319 319
 	private function concatSig($encryptedContent, $signature) {
320
-		return $encryptedContent . '00sig00' . $signature;
320
+		return $encryptedContent.'00sig00'.$signature;
321 321
 	}
322 322
 
323 323
 	/**
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
 	 * @return string
330 330
 	 */
331 331
 	private function addPadding($data) {
332
-		return $data . 'xxx';
332
+		return $data.'xxx';
333 333
 	}
334 334
 
335 335
 	/**
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
 	protected function generatePasswordHash($password, $cipher, $uid = '') {
344 344
 		$instanceId = $this->config->getSystemValue('instanceid');
345 345
 		$instanceSecret = $this->config->getSystemValue('secret');
346
-		$salt = hash('sha256', $uid . $instanceId . $instanceSecret, true);
346
+		$salt = hash('sha256', $uid.$instanceId.$instanceSecret, true);
347 347
 		$keySize = $this->getKeySize($cipher);
348 348
 
349 349
 		$hash = hash_pbkdf2(
@@ -462,10 +462,10 @@  discard block
 block discarded – undo
462 462
 		if ($catFile['signature'] !== false) {
463 463
 			try {
464 464
 				// First try the new format
465
-				$this->checkSignature($catFile['encrypted'], $passPhrase . '_' . $version . '_' . $position, $catFile['signature']);
465
+				$this->checkSignature($catFile['encrypted'], $passPhrase.'_'.$version.'_'.$position, $catFile['signature']);
466 466
 			} catch (GenericEncryptionException $e) {
467 467
 				// For compatibility with old files check the version without _
468
-				$this->checkSignature($catFile['encrypted'], $passPhrase . $version . $position, $catFile['signature']);
468
+				$this->checkSignature($catFile['encrypted'], $passPhrase.$version.$position, $catFile['signature']);
469 469
 			}
470 470
 		}
471 471
 
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
 	 * @return string
505 505
 	 */
506 506
 	private function createSignature($data, $passPhrase) {
507
-		$passPhrase = hash('sha512', $passPhrase . 'a', true);
507
+		$passPhrase = hash('sha512', $passPhrase.'a', true);
508 508
 		return hash_hmac('sha256', $data, $passPhrase);
509 509
 	}
510 510
 
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
 		if ($plainContent) {
598 598
 			return $plainContent;
599 599
 		} else {
600
-			throw new DecryptionFailedException('Encryption library: Decryption (symmetric) of content failed: ' . openssl_error_string());
600
+			throw new DecryptionFailedException('Encryption library: Decryption (symmetric) of content failed: '.openssl_error_string());
601 601
 		}
602 602
 	}
603 603
 
@@ -663,7 +663,7 @@  discard block
 block discarded – undo
663 663
 		if (openssl_open($encKeyFile, $plainContent, $shareKey, $privateKey)) {
664 664
 			return $plainContent;
665 665
 		} else {
666
-			throw new MultiKeyDecryptException('multikeydecrypt with share key failed:' . openssl_error_string());
666
+			throw new MultiKeyDecryptException('multikeydecrypt with share key failed:'.openssl_error_string());
667 667
 		}
668 668
 	}
669 669
 
@@ -699,7 +699,7 @@  discard block
 block discarded – undo
699 699
 				'data' => $sealed
700 700
 			];
701 701
 		} else {
702
-			throw new MultiKeyEncryptException('multikeyencryption failed ' . openssl_error_string());
702
+			throw new MultiKeyEncryptException('multikeyencryption failed '.openssl_error_string());
703 703
 		}
704 704
 	}
705 705
 }
Please login to merge, or discard this patch.