@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types = 1); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | namespace Sop\AESKW; |
6 | 6 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types = 1); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | namespace Sop\AESKW; |
6 | 6 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | // let the ciphertext be: |
145 | 145 | // C[0] | C[1] = ENC(K, A | P[1]). |
146 | 146 | if (8 === strlen($key)) { |
147 | - return $this->_encrypt($kek, $aiv . $key); |
|
147 | + return $this->_encrypt($kek, $aiv.$key); |
|
148 | 148 | } |
149 | 149 | // build plaintext blocks and apply normal wrapping with AIV as an |
150 | 150 | // initial value |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | // For i = 1 to n |
245 | 245 | for ($i = 1; $i <= $n; ++$i) { |
246 | 246 | // B = AES(K, A | R[i]) |
247 | - $B = $this->_encrypt($kek, $A . $R[$i]); |
|
247 | + $B = $this->_encrypt($kek, $A.$R[$i]); |
|
248 | 248 | // A = MSB(64, B) ^ t where t = (n*j)+i |
249 | 249 | $t = $n * $j + $i; |
250 | 250 | $A = $this->_msb64($B) ^ $this->_uint64($t); |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | // if key consists of only one block, recover AIV and padded key as: |
280 | 280 | // A | P[1] = DEC(K, C[0] | C[1]) |
281 | 281 | if (1 === $n) { |
282 | - $P = str_split($this->_decrypt($kek, $C[0] . $C[1]), 8); |
|
282 | + $P = str_split($this->_decrypt($kek, $C[0].$C[1]), 8); |
|
283 | 283 | $A = $P[0]; |
284 | 284 | unset($P[0]); |
285 | 285 | } else { |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | for ($i = $n; $i >= 1; --$i) { |
325 | 325 | // B = AES-1(K, (A ^ t) | R[i]) where t = n*j+i |
326 | 326 | $t = $n * $j + $i; |
327 | - $B = $this->_decrypt($kek, ($A ^ $this->_uint64($t)) . $R[$i]); |
|
327 | + $B = $this->_decrypt($kek, ($A ^ $this->_uint64($t)).$R[$i]); |
|
328 | 328 | // A = MSB(64, B) |
329 | 329 | $A = $this->_msb64($B); |
330 | 330 | // R[i] = LSB(64, B) |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | } |
351 | 351 | // compute AIV |
352 | 352 | $mli = pack('N', $len); |
353 | - $aiv = self::AIV_HI . $mli; |
|
353 | + $aiv = self::AIV_HI.$mli; |
|
354 | 354 | return [$key, $aiv]; |
355 | 355 | } |
356 | 356 | |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING); |
419 | 419 | if (false === $str) { |
420 | 420 | throw new \RuntimeException( |
421 | - 'openssl_encrypt() failed: ' . $this->_getLastOpenSSLError()); |
|
421 | + 'openssl_encrypt() failed: '.$this->_getLastOpenSSLError()); |
|
422 | 422 | } |
423 | 423 | return $str; |
424 | 424 | } |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING); |
440 | 440 | if (false === $str) { |
441 | 441 | throw new \RuntimeException( |
442 | - 'openssl_decrypt() failed: ' . $this->_getLastOpenSSLError()); |
|
442 | + 'openssl_decrypt() failed: '.$this->_getLastOpenSSLError()); |
|
443 | 443 | } |
444 | 444 | return $str; |
445 | 445 | } |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | { |
495 | 495 | // truncate on 32 bit hosts |
496 | 496 | if (PHP_INT_SIZE < 8) { |
497 | - return "\0\0\0\0" . pack('N', $num); |
|
497 | + return "\0\0\0\0".pack('N', $num); |
|
498 | 498 | } |
499 | 499 | return pack('J', $num); |
500 | 500 | } |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types = 1); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | namespace Sop\AESKW; |
6 | 6 |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types = 1); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | namespace Sop\AESKW; |
6 | 6 |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types = 1); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | namespace Sop\AESKW; |
6 | 6 |