@@ -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 | |
@@ -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 |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | // For i = 1 to n |
| 247 | 247 | for ($i = 1; $i <= $n; ++$i) { |
| 248 | 248 | // B = AES(K, A | R[i]) |
| 249 | - $B = $this->_encrypt($kek, $A . $R[$i]); |
|
| 249 | + $B = $this->_encrypt($kek, $A.$R[$i]); |
|
| 250 | 250 | // A = MSB(64, B) ^ t where t = (n*j)+i |
| 251 | 251 | $t = $n * $j + $i; |
| 252 | 252 | $A = $this->_msb64($B) ^ $this->_uint64($t); |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | // if key consists of only one block, recover AIV and padded key as: |
| 282 | 282 | // A | P[1] = DEC(K, C[0] | C[1]) |
| 283 | 283 | if (1 == $n) { |
| 284 | - $P = str_split($this->_decrypt($kek, $C[0] . $C[1]), 8); |
|
| 284 | + $P = str_split($this->_decrypt($kek, $C[0].$C[1]), 8); |
|
| 285 | 285 | $A = $P[0]; |
| 286 | 286 | unset($P[0]); |
| 287 | 287 | } else { |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | for ($i = $n; $i >= 1; --$i) { |
| 329 | 329 | // B = AES-1(K, (A ^ t) | R[i]) where t = n*j+i |
| 330 | 330 | $t = $n * $j + $i; |
| 331 | - $B = $this->_decrypt($kek, ($A ^ $this->_uint64($t)) . $R[$i]); |
|
| 331 | + $B = $this->_decrypt($kek, ($A ^ $this->_uint64($t)).$R[$i]); |
|
| 332 | 332 | // A = MSB(64, B) |
| 333 | 333 | $A = $this->_msb64($B); |
| 334 | 334 | // R[i] = LSB(64, B) |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | } |
| 355 | 355 | // compute AIV |
| 356 | 356 | $mli = pack('N', $len); |
| 357 | - $aiv = self::AIV_HI . $mli; |
|
| 357 | + $aiv = self::AIV_HI.$mli; |
|
| 358 | 358 | return [$key, $aiv]; |
| 359 | 359 | } |
| 360 | 360 | |
@@ -423,7 +423,7 @@ discard block |
||
| 423 | 423 | OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING); |
| 424 | 424 | if (false === $str) { |
| 425 | 425 | throw new \RuntimeException( |
| 426 | - 'openssl_encrypt() failed: ' . $this->_getLastOpenSSLError()); |
|
| 426 | + 'openssl_encrypt() failed: '.$this->_getLastOpenSSLError()); |
|
| 427 | 427 | } |
| 428 | 428 | return $str; |
| 429 | 429 | } |
@@ -444,7 +444,7 @@ discard block |
||
| 444 | 444 | OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING); |
| 445 | 445 | if (false === $str) { |
| 446 | 446 | throw new \RuntimeException( |
| 447 | - 'openssl_decrypt() failed: ' . $this->_getLastOpenSSLError()); |
|
| 447 | + 'openssl_decrypt() failed: '.$this->_getLastOpenSSLError()); |
|
| 448 | 448 | } |
| 449 | 449 | return $str; |
| 450 | 450 | } |
@@ -499,7 +499,7 @@ discard block |
||
| 499 | 499 | { |
| 500 | 500 | // truncate on 32 bit hosts |
| 501 | 501 | if (PHP_INT_SIZE < 8) { |
| 502 | - return "\0\0\0\0" . pack('N', $num); |
|
| 502 | + return "\0\0\0\0".pack('N', $num); |
|
| 503 | 503 | } |
| 504 | 504 | return pack('J', $num); |
| 505 | 505 | } |
@@ -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 | |