@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | "JWK Set must have a 'keys' member."); |
| 66 | 66 | } |
| 67 | 67 | $jwks = array_map( |
| 68 | - function ($jwkdata) { |
|
| 68 | + function($jwkdata) { |
|
| 69 | 69 | return JWK::fromArray($jwkdata); |
| 70 | 70 | }, $members["keys"]); |
| 71 | 71 | unset($members["keys"]); |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | { |
| 199 | 199 | $data = $this->_additional; |
| 200 | 200 | $data["keys"] = array_map( |
| 201 | - function (JWK $jwk) { |
|
| 201 | + function(JWK $jwk) { |
|
| 202 | 202 | return $jwk->toArray(); |
| 203 | 203 | }, $this->_jwks); |
| 204 | 204 | return $data; |
@@ -66,14 +66,14 @@ |
||
| 66 | 66 | { |
| 67 | 67 | $this->_parts = explode(".", $token); |
| 68 | 68 | switch (count($this->_parts)) { |
| 69 | - case 3: |
|
| 70 | - $this->_type = self::TYPE_JWS; |
|
| 71 | - break; |
|
| 72 | - case 5: |
|
| 73 | - $this->_type = self::TYPE_JWE; |
|
| 74 | - break; |
|
| 75 | - default: |
|
| 76 | - throw new \UnexpectedValueException("Not a JWT token."); |
|
| 69 | + case 3: |
|
| 70 | + $this->_type = self::TYPE_JWS; |
|
| 71 | + break; |
|
| 72 | + case 5: |
|
| 73 | + $this->_type = self::TYPE_JWE; |
|
| 74 | + break; |
|
| 75 | + default: |
|
| 76 | + throw new \UnexpectedValueException("Not a JWT token."); |
|
| 77 | 77 | } |
| 78 | 78 | } |
| 79 | 79 | |
@@ -70,9 +70,9 @@ |
||
| 70 | 70 | // time_mid |
| 71 | 71 | mt_rand(0, 0xffff), |
| 72 | 72 | // time_hi_and_version |
| 73 | - mt_rand(0, 0x0fff) | 0x4000, |
|
| 73 | + mt_rand(0, 0x0fff)|0x4000, |
|
| 74 | 74 | // clk_seq_hi_res |
| 75 | - mt_rand(0, 0x3f) | 0x80, |
|
| 75 | + mt_rand(0, 0x3f)|0x80, |
|
| 76 | 76 | // clk_seq_low |
| 77 | 77 | mt_rand(0, 0xff), |
| 78 | 78 | // node |
@@ -31,17 +31,17 @@ |
||
| 31 | 31 | { |
| 32 | 32 | $data = strtr($data, "-_", "+/"); |
| 33 | 33 | switch (strlen($data) % 4) { |
| 34 | - case 0: |
|
| 35 | - break; |
|
| 36 | - case 2: |
|
| 37 | - $data .= "=="; |
|
| 38 | - break; |
|
| 39 | - case 3: |
|
| 40 | - $data .= "="; |
|
| 41 | - break; |
|
| 42 | - default: |
|
| 43 | - throw new \UnexpectedValueException( |
|
| 44 | - "Malformed base64url encoding."); |
|
| 34 | + case 0: |
|
| 35 | + break; |
|
| 36 | + case 2: |
|
| 37 | + $data .= "=="; |
|
| 38 | + break; |
|
| 39 | + case 3: |
|
| 40 | + $data .= "="; |
|
| 41 | + break; |
|
| 42 | + default: |
|
| 43 | + throw new \UnexpectedValueException( |
|
| 44 | + "Malformed base64url encoding."); |
|
| 45 | 45 | } |
| 46 | 46 | return self::decode($data); |
| 47 | 47 | } |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | * be updated to contain parameters specific to the encryption |
| 38 | 38 | * @return string Ciphertext |
| 39 | 39 | */ |
| 40 | - abstract protected function _encryptKey(string $key, Header &$header): string; |
|
| 40 | + abstract protected function _encryptKey(string $key, Header&$header): string; |
|
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | 43 | * Decrypt a key. |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | * @throws \RuntimeException For generic errors |
| 61 | 61 | * @return string Encrypted key |
| 62 | 62 | */ |
| 63 | - final public function encrypt(string $cek, Header &$header = null): string |
|
| 63 | + final public function encrypt(string $cek, Header&$header = null): string |
|
| 64 | 64 | { |
| 65 | 65 | if (!isset($header)) { |
| 66 | 66 | $header = new Header(); |
@@ -153,7 +153,7 @@ |
||
| 153 | 153 | * |
| 154 | 154 | * {@inheritdoc} |
| 155 | 155 | */ |
| 156 | - protected function _encryptKey(string $key, Header &$header): string |
|
| 156 | + protected function _encryptKey(string $key, Header&$header): string |
|
| 157 | 157 | { |
| 158 | 158 | $pubkey = openssl_pkey_get_public( |
| 159 | 159 | $this->publicKey() |
@@ -151,7 +151,7 @@ |
||
| 151 | 151 | * @see \JWX\JWE\KeyManagementAlgorithm::_encryptKey() |
| 152 | 152 | * @return string |
| 153 | 153 | */ |
| 154 | - protected function _encryptKey(string $key, Header &$header): string |
|
| 154 | + protected function _encryptKey(string $key, Header&$header): string |
|
| 155 | 155 | { |
| 156 | 156 | list($ciphertext, $auth_tag) = $this->_getGCM()->encrypt($key, "", |
| 157 | 157 | $this->_kek, $this->_iv); |
@@ -66,7 +66,7 @@ |
||
| 66 | 66 | * |
| 67 | 67 | * {@inheritdoc} |
| 68 | 68 | */ |
| 69 | - protected function _encryptKey(string $key, Header &$header): string |
|
| 69 | + protected function _encryptKey(string $key, Header&$header): string |
|
| 70 | 70 | { |
| 71 | 71 | if ($key != $this->_cek) { |
| 72 | 72 | throw new \LogicException("Content encryption key doesn't match."); |
@@ -193,7 +193,7 @@ |
||
| 193 | 193 | * |
| 194 | 194 | * {@inheritdoc} |
| 195 | 195 | */ |
| 196 | - protected function _encryptKey(string $key, Header &$header): string |
|
| 196 | + protected function _encryptKey(string $key, Header&$header): string |
|
| 197 | 197 | { |
| 198 | 198 | return $this->_kwAlgo()->wrap($key, $this->_derivedKey()); |
| 199 | 199 | } |