@@ -39,7 +39,6 @@ |
||
| 39 | 39 | use jwt\utils\JOSEHeaderSerializer; |
| 40 | 40 | use jwt\utils\JWTClaimSetSerializer; |
| 41 | 41 | use jwt\utils\JWTRawSerializer; |
| 42 | -use utils\json_types\JsonArray; |
|
| 43 | 42 | use utils\json_types\JsonValue; |
| 44 | 43 | use utils\json_types\StringOrURI; |
| 45 | 44 | |
@@ -72,14 +72,14 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | $claim_set = null; |
| 74 | 74 | |
| 75 | - if(!is_null($payload) && $payload->isClaimSet() && $payload instanceof IJWSPayloadClaimSetSpec) { |
|
| 75 | + if (!is_null($payload) && $payload->isClaimSet() && $payload instanceof IJWSPayloadClaimSetSpec) { |
|
| 76 | 76 | $header->addHeader(new JOSEHeaderParam(RegisteredJOSEHeaderNames::Type, new StringOrURI('JWT'))); |
| 77 | 77 | $claim_set = $payload->getClaimSet(); |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | parent::__construct($header, $claim_set); |
| 81 | 81 | |
| 82 | - if(!is_null($payload)) |
|
| 82 | + if (!is_null($payload)) |
|
| 83 | 83 | $this->setPayload($payload); |
| 84 | 84 | |
| 85 | 85 | $this->signature = $signature; |
@@ -100,21 +100,18 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | public function toCompactSerialization() |
| 102 | 102 | { |
| 103 | - if(!is_null($this->jwk->getId())) |
|
| 103 | + if (!is_null($this->jwk->getId())) |
|
| 104 | 104 | $this->header->addHeader(new JOSEHeaderParam(RegisteredJOSEHeaderNames::KeyID, $this->jwk->getId())); |
| 105 | 105 | |
| 106 | - if($this->jwk instanceof IAsymmetricJWK) |
|
| 106 | + if ($this->jwk instanceof IAsymmetricJWK) |
|
| 107 | 107 | { |
| 108 | 108 | // we should add the public key on the header |
| 109 | 109 | $public_key = clone $this->jwk; |
| 110 | 110 | |
| 111 | - $this->header->addHeader |
|
| 112 | - ( |
|
| 113 | - new JOSEHeaderParam |
|
| 114 | - ( |
|
| 111 | + $this->header->addHeader( |
|
| 112 | + new JOSEHeaderParam( |
|
| 115 | 113 | RegisteredJOSEHeaderNames::JSONWebKey, |
| 116 | - new JsonValue |
|
| 117 | - ( |
|
| 114 | + new JsonValue( |
|
| 118 | 115 | $public_key->setVisibility(JSONWebKeyVisibility::PublicOnly) |
| 119 | 116 | ) |
| 120 | 117 | ) |
@@ -134,32 +131,32 @@ discard block |
||
| 134 | 131 | public function sign() |
| 135 | 132 | { |
| 136 | 133 | |
| 137 | - if(is_null($this->jwk)) |
|
| 134 | + if (is_null($this->jwk)) |
|
| 138 | 135 | throw new JWSInvalidJWKException; |
| 139 | 136 | |
| 140 | - if($this->jwk->getKeyUse()->getString() !== JSONWebKeyPublicKeyUseValues::Signature) |
|
| 137 | + if ($this->jwk->getKeyUse()->getString() !== JSONWebKeyPublicKeyUseValues::Signature) |
|
| 141 | 138 | throw new JWSInvalidJWKException(sprintf('use %s not supported.', $this->jwk->getKeyUse()->getString())); |
| 142 | 139 | |
| 143 | 140 | $alg = DigitalSignatures_MACs_Registry::getInstance()->get($this->header->getAlgorithm()->getString()); |
| 144 | 141 | |
| 145 | - if(is_null($alg)) |
|
| 146 | - throw new JWSNotSupportedAlgorithm(sprintf('alg %s.',$this->header->getAlgorithm()->getString())); |
|
| 142 | + if (is_null($alg)) |
|
| 143 | + throw new JWSNotSupportedAlgorithm(sprintf('alg %s.', $this->header->getAlgorithm()->getString())); |
|
| 147 | 144 | |
| 148 | - $secured_input_bytes = JOSEHeaderSerializer::serialize($this->header) . IBasicJWT::SegmentSeparator .$this->getEncodedPayload(); |
|
| 145 | + $secured_input_bytes = JOSEHeaderSerializer::serialize($this->header).IBasicJWT::SegmentSeparator.$this->getEncodedPayload(); |
|
| 149 | 146 | |
| 150 | - $key = $this->jwk->getKey(JSONWebKeyKeyOperationsValues::ComputeDigitalSignatureOrMAC); |
|
| 147 | + $key = $this->jwk->getKey(JSONWebKeyKeyOperationsValues::ComputeDigitalSignatureOrMAC); |
|
| 151 | 148 | |
| 152 | - if($alg instanceof DigitalSignatureAlgorithm) |
|
| 149 | + if ($alg instanceof DigitalSignatureAlgorithm) |
|
| 153 | 150 | { |
| 154 | 151 | $this->signature = $alg->sign($key, $secured_input_bytes); |
| 155 | 152 | } |
| 156 | - else if($alg instanceof MAC_Algorithm ) |
|
| 153 | + else if ($alg instanceof MAC_Algorithm) |
|
| 157 | 154 | { |
| 158 | 155 | $this->signature = $alg->digest($key, $secured_input_bytes); |
| 159 | 156 | } |
| 160 | 157 | else |
| 161 | 158 | { |
| 162 | - throw new JWSNotSupportedAlgorithm(sprintf('alg %s.',$this->header->getAlgorithm()->getString())); |
|
| 159 | + throw new JWSNotSupportedAlgorithm(sprintf('alg %s.', $this->header->getAlgorithm()->getString())); |
|
| 163 | 160 | } |
| 164 | 161 | |
| 165 | 162 | return $this; |
@@ -171,11 +168,11 @@ discard block |
||
| 171 | 168 | */ |
| 172 | 169 | public function getEncodedPayload() |
| 173 | 170 | { |
| 174 | - if(is_null($this->payload)) |
|
| 171 | + if (is_null($this->payload)) |
|
| 175 | 172 | throw new JWSInvalidPayloadException('payload is not set!'); |
| 176 | 173 | |
| 177 | 174 | $enc_payload = ''; |
| 178 | - if($this->payload->isClaimSet() && $this->payload instanceof IJWSPayloadClaimSetSpec) |
|
| 175 | + if ($this->payload->isClaimSet() && $this->payload instanceof IJWSPayloadClaimSetSpec) |
|
| 179 | 176 | { |
| 180 | 177 | $enc_payload = JWTClaimSetSerializer::serialize($this->payload->getClaimSet()); |
| 181 | 178 | } |
@@ -233,27 +230,23 @@ discard block |
||
| 233 | 230 | */ |
| 234 | 231 | public function verify($original_alg) |
| 235 | 232 | { |
| 236 | - if(is_null($this->jwk)) |
|
| 233 | + if (is_null($this->jwk)) |
|
| 237 | 234 | throw new JWSInvalidJWKException; |
| 238 | 235 | |
| 239 | - if($this->jwk->getKeyUse()->getString() !== JSONWebKeyPublicKeyUseValues::Signature) |
|
| 240 | - throw new JWSInvalidJWKException |
|
| 241 | - ( |
|
| 242 | - sprintf |
|
| 243 | - ( |
|
| 236 | + if ($this->jwk->getKeyUse()->getString() !== JSONWebKeyPublicKeyUseValues::Signature) |
|
| 237 | + throw new JWSInvalidJWKException( |
|
| 238 | + sprintf( |
|
| 244 | 239 | 'use %s not supported ', |
| 245 | 240 | $this->jwk->getKeyUse()->getString() |
| 246 | 241 | ) |
| 247 | 242 | ); |
| 248 | 243 | |
| 249 | - if(is_null($this->jwk->getAlgorithm())) |
|
| 244 | + if (is_null($this->jwk->getAlgorithm())) |
|
| 250 | 245 | throw new InvalidJWKAlgorithm('algorithm intended for use with the key is not set! '); |
| 251 | 246 | |
| 252 | - if(!is_null($this->jwk->getId()) && !is_null($this->header->getKeyID()) && $this->header->getKeyID()->getValue() != $this->jwk->getId()->getValue()) |
|
| 253 | - throw new JWSInvalidJWKException |
|
| 254 | - ( |
|
| 255 | - sprintf |
|
| 256 | - ( |
|
| 247 | + if (!is_null($this->jwk->getId()) && !is_null($this->header->getKeyID()) && $this->header->getKeyID()->getValue() != $this->jwk->getId()->getValue()) |
|
| 248 | + throw new JWSInvalidJWKException( |
|
| 249 | + sprintf( |
|
| 257 | 250 | 'original kid %s - current kid %s', |
| 258 | 251 | $this->header->getKeyID()->getValue(), |
| 259 | 252 | $this->jwk->getId()->getValue() |
@@ -262,34 +255,30 @@ discard block |
||
| 262 | 255 | |
| 263 | 256 | $alg = DigitalSignatures_MACs_Registry::getInstance()->get($original_alg); |
| 264 | 257 | |
| 265 | - if(is_null($alg)) |
|
| 258 | + if (is_null($alg)) |
|
| 266 | 259 | throw new JWSNotSupportedAlgorithm(sprintf('algo %s', $original_alg)); |
| 267 | 260 | |
| 268 | 261 | $former_alg = $this->header->getAlgorithm()->getString(); |
| 269 | 262 | |
| 270 | - if($former_alg != $original_alg) |
|
| 271 | - throw new JWSNotSupportedAlgorithm |
|
| 272 | - ( |
|
| 273 | - sprintf |
|
| 274 | - ( |
|
| 263 | + if ($former_alg != $original_alg) |
|
| 264 | + throw new JWSNotSupportedAlgorithm( |
|
| 265 | + sprintf( |
|
| 275 | 266 | 'former alg %s - original alg %s', |
| 276 | 267 | $former_alg, |
| 277 | 268 | $original_alg |
| 278 | 269 | ) |
| 279 | 270 | ); |
| 280 | 271 | |
| 281 | - if($this->jwk->getAlgorithm()->getValue() !== $original_alg) |
|
| 282 | - throw new InvalidJWKAlgorithm |
|
| 283 | - ( |
|
| 284 | - sprintf |
|
| 285 | - ( |
|
| 272 | + if ($this->jwk->getAlgorithm()->getValue() !== $original_alg) |
|
| 273 | + throw new InvalidJWKAlgorithm( |
|
| 274 | + sprintf( |
|
| 286 | 275 | 'mismatch between algorithm intended for use with the key %s and the cryptographic algorithm used to secure the JWS %s', |
| 287 | 276 | $this->jwk->getAlgorithm()->getValue(), |
| 288 | 277 | $original_alg |
| 289 | 278 | ) |
| 290 | 279 | ); |
| 291 | 280 | |
| 292 | - $secured_input_bytes = JOSEHeaderSerializer::serialize($this->header) . IBasicJWT::SegmentSeparator .$this->getEncodedPayload(); |
|
| 281 | + $secured_input_bytes = JOSEHeaderSerializer::serialize($this->header).IBasicJWT::SegmentSeparator.$this->getEncodedPayload(); |
|
| 293 | 282 | |
| 294 | 283 | // use public key / secret |
| 295 | 284 | $key = $this->jwk->getKey(JSONWebKeyKeyOperationsValues::VerifyDigitalSignatureOrMAC); |
@@ -310,9 +299,9 @@ discard block |
||
| 310 | 299 | * @param string $signature |
| 311 | 300 | * @return IJWS |
| 312 | 301 | */ |
| 313 | - static public function fromHeaderClaimsAndSignature(IJOSEHeader $header, IJWSPayloadSpec $payload = null , $signature = '') |
|
| 302 | + static public function fromHeaderClaimsAndSignature(IJOSEHeader $header, IJWSPayloadSpec $payload = null, $signature = '') |
|
| 314 | 303 | { |
| 315 | - return new JWS($header, $payload, $signature ); |
|
| 304 | + return new JWS($header, $payload, $signature); |
|
| 316 | 305 | } |
| 317 | 306 | |
| 318 | 307 | /** |
@@ -320,10 +309,9 @@ discard block |
||
| 320 | 309 | */ |
| 321 | 310 | public function take() |
| 322 | 311 | { |
| 323 | - $payload = $this->payload->isClaimSet() ? $this->claim_set : $this->payload->getRaw(); |
|
| 312 | + $payload = $this->payload->isClaimSet() ? $this->claim_set : $this->payload->getRaw(); |
|
| 324 | 313 | |
| 325 | - return array |
|
| 326 | - ( |
|
| 314 | + return array( |
|
| 327 | 315 | $this->header, |
| 328 | 316 | $payload, |
| 329 | 317 | $this->signature |
@@ -43,14 +43,14 @@ discard block |
||
| 43 | 43 | $this->algorithms[JSONWebSignatureAndEncryptionAlgorithms::Dir] = new DirAlgorithm; |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - private function __clone(){} |
|
| 46 | + private function __clone() {} |
|
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | 49 | * @return KeyManagementAlgorithms_Registry |
| 50 | 50 | */ |
| 51 | 51 | public static function getInstance() |
| 52 | 52 | { |
| 53 | - if(!is_object(self::$instance)) |
|
| 53 | + if (!is_object(self::$instance)) |
|
| 54 | 54 | { |
| 55 | 55 | self::$instance = new KeyManagementAlgorithms_Registry(); |
| 56 | 56 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | public function get($alg) |
| 74 | 74 | { |
| 75 | - if(!$this->isSupported($alg)) return null; |
|
| 75 | + if (!$this->isSupported($alg)) return null; |
|
| 76 | 76 | return $this->algorithms[$alg]; |
| 77 | 77 | } |
| 78 | 78 | } |
| 79 | 79 | \ No newline at end of file |
@@ -35,10 +35,10 @@ discard block |
||
| 35 | 35 | * @return string |
| 36 | 36 | * @throws InvalidKeyLengthAlgorithmException |
| 37 | 37 | */ |
| 38 | - public function digest(SharedKey $key, $message){ |
|
| 38 | + public function digest(SharedKey $key, $message) { |
|
| 39 | 39 | |
| 40 | - if($this->getMinKeyLen() > $key->getBitLength()) |
|
| 41 | - throw new InvalidKeyLengthAlgorithmException(sprintf('min len %s - cur len %s.',$this->getMinKeyLen(), $key->getBitLength())); |
|
| 40 | + if ($this->getMinKeyLen() > $key->getBitLength()) |
|
| 41 | + throw new InvalidKeyLengthAlgorithmException(sprintf('min len %s - cur len %s.', $this->getMinKeyLen(), $key->getBitLength())); |
|
| 42 | 42 | |
| 43 | 43 | return hash_hmac($this->getHashingAlgorithm(), $message, $key->getSecret(), true); |
| 44 | 44 | } |
@@ -51,8 +51,8 @@ discard block |
||
| 51 | 51 | * @throws InvalidKeyLengthAlgorithmException |
| 52 | 52 | * @throws InvalidKeyTypeAlgorithmException |
| 53 | 53 | */ |
| 54 | - public function verify(Key $key, $message, $digest){ |
|
| 55 | - if(!($key instanceof SharedKey)) throw new InvalidKeyTypeAlgorithmException; |
|
| 54 | + public function verify(Key $key, $message, $digest) { |
|
| 55 | + if (!($key instanceof SharedKey)) throw new InvalidKeyTypeAlgorithmException; |
|
| 56 | 56 | |
| 57 | 57 | return $digest === $this->digest($key, $message); |
| 58 | 58 | } |
@@ -45,14 +45,14 @@ discard block |
||
| 45 | 45 | */ |
| 46 | 46 | public function sign(PrivateKey $private_key, $message) |
| 47 | 47 | { |
| 48 | - if(!($private_key instanceof RSAPrivateKey)) throw new InvalidKeyTypeAlgorithmException; |
|
| 48 | + if (!($private_key instanceof RSAPrivateKey)) throw new InvalidKeyTypeAlgorithmException; |
|
| 49 | 49 | |
| 50 | - if($this->getMinKeyLen() > $private_key->getBitLength()) |
|
| 51 | - throw new InvalidKeyLengthAlgorithmException(sprintf('min len %s - cur len %s.',$this->getMinKeyLen(), $private_key->getBitLength())); |
|
| 50 | + if ($this->getMinKeyLen() > $private_key->getBitLength()) |
|
| 51 | + throw new InvalidKeyLengthAlgorithmException(sprintf('min len %s - cur len %s.', $this->getMinKeyLen(), $private_key->getBitLength())); |
|
| 52 | 52 | |
| 53 | 53 | $res = $this->rsa_impl->loadKey($private_key->getEncoded()); |
| 54 | 54 | |
| 55 | - if(!$res) throw new InvalidKeyTypeAlgorithmException; |
|
| 55 | + if (!$res) throw new InvalidKeyTypeAlgorithmException; |
|
| 56 | 56 | |
| 57 | 57 | $this->rsa_impl->setHash($this->getHashingAlgorithm()); |
| 58 | 58 | $this->rsa_impl->setMGFHash($this->getHashingAlgorithm()); |
@@ -70,14 +70,14 @@ discard block |
||
| 70 | 70 | */ |
| 71 | 71 | public function verify(Key $key, $message, $signature) |
| 72 | 72 | { |
| 73 | - if(!($key instanceof RSAPublicKey)) throw new InvalidKeyTypeAlgorithmException; |
|
| 73 | + if (!($key instanceof RSAPublicKey)) throw new InvalidKeyTypeAlgorithmException; |
|
| 74 | 74 | |
| 75 | - if($this->getMinKeyLen() > $key->getBitLength()) |
|
| 76 | - throw new InvalidKeyLengthAlgorithmException(sprintf('min len %s - cur len %s.',$this->getMinKeyLen(), $key->getBitLength())); |
|
| 75 | + if ($this->getMinKeyLen() > $key->getBitLength()) |
|
| 76 | + throw new InvalidKeyLengthAlgorithmException(sprintf('min len %s - cur len %s.', $this->getMinKeyLen(), $key->getBitLength())); |
|
| 77 | 77 | |
| 78 | 78 | $res = $this->rsa_impl->loadKey($key->getEncoded()); |
| 79 | 79 | |
| 80 | - if(!$res) throw new InvalidKeyTypeAlgorithmException; |
|
| 80 | + if (!$res) throw new InvalidKeyTypeAlgorithmException; |
|
| 81 | 81 | |
| 82 | 82 | $this->rsa_impl->setHash($this->getHashingAlgorithm()); |
| 83 | 83 | $this->rsa_impl->setMGFHash($this->getHashingAlgorithm()); |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | extends Abstract_RSA_Algorithm |
| 31 | 31 | implements EncryptionAlgorithm, KeyEncryption { |
| 32 | 32 | |
| 33 | - public function __construct(){ |
|
| 33 | + public function __construct() { |
|
| 34 | 34 | |
| 35 | 35 | parent::__construct(); |
| 36 | 36 | //configuration ... |
@@ -47,18 +47,18 @@ discard block |
||
| 47 | 47 | */ |
| 48 | 48 | public function encrypt(Key $key, $message) |
| 49 | 49 | { |
| 50 | - if(!($key instanceof RSAPublicKey)) |
|
| 50 | + if (!($key instanceof RSAPublicKey)) |
|
| 51 | 51 | throw new InvalidKeyTypeAlgorithmException('key is not public'); |
| 52 | 52 | |
| 53 | - if($key->getFormat() !== 'PKCS8') |
|
| 53 | + if ($key->getFormat() !== 'PKCS8') |
|
| 54 | 54 | throw new InvalidKeyTypeAlgorithmException('keys is not on PKCS1 format'); |
| 55 | 55 | |
| 56 | 56 | $res = $this->rsa_impl->loadKey($key->getEncoded()); |
| 57 | 57 | |
| 58 | - if(!$res) |
|
| 58 | + if (!$res) |
|
| 59 | 59 | throw new InvalidKeyTypeAlgorithmException('could not parse the key'); |
| 60 | 60 | |
| 61 | - if($this->rsa_impl->getSize() < $this->getMinKeyLen()) |
|
| 61 | + if ($this->rsa_impl->getSize() < $this->getMinKeyLen()) |
|
| 62 | 62 | throw new InvalidKeyTypeAlgorithmException('len is invalid'); |
| 63 | 63 | |
| 64 | 64 | return $this->rsa_impl->encrypt($message); |
@@ -70,21 +70,21 @@ discard block |
||
| 70 | 70 | * @return string |
| 71 | 71 | * @throws InvalidKeyTypeAlgorithmException |
| 72 | 72 | */ |
| 73 | - public function decrypt(Key $key, $enc_message){ |
|
| 73 | + public function decrypt(Key $key, $enc_message) { |
|
| 74 | 74 | |
| 75 | - if(!($key instanceof RSAPrivateKey)) |
|
| 75 | + if (!($key instanceof RSAPrivateKey)) |
|
| 76 | 76 | throw new InvalidKeyTypeAlgorithmException('key is not private'); |
| 77 | 77 | |
| 78 | 78 | |
| 79 | - if($key->getFormat() !== 'PKCS1') |
|
| 79 | + if ($key->getFormat() !== 'PKCS1') |
|
| 80 | 80 | throw new InvalidKeyTypeAlgorithmException('keys is not on PKCS1 format'); |
| 81 | 81 | |
| 82 | 82 | $res = $this->rsa_impl->loadKey($key->getEncoded()); |
| 83 | 83 | |
| 84 | - if(!$res) |
|
| 84 | + if (!$res) |
|
| 85 | 85 | throw new InvalidKeyTypeAlgorithmException('could not parse the key'); |
| 86 | 86 | |
| 87 | - if($this->rsa_impl->getSize() < $this->getMinKeyLen()) |
|
| 87 | + if ($this->rsa_impl->getSize() < $this->getMinKeyLen()) |
|
| 88 | 88 | throw new InvalidKeyTypeAlgorithmException('len is invalid'); |
| 89 | 89 | |
| 90 | 90 | return $this->rsa_impl->decrypt($enc_message); |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | { |
| 61 | 61 | $key_len = strlen($key); |
| 62 | 62 | |
| 63 | - if($this->getMinKeyLen() > ByteUtil::bitLength($key_len)) |
|
| 63 | + if ($this->getMinKeyLen() > ByteUtil::bitLength($key_len)) |
|
| 64 | 64 | throw new InvalidKeyLengthAlgorithmException; |
| 65 | 65 | |
| 66 | 66 | $enc_key_len = $key_len / 2; |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | */ |
| 134 | 134 | public function decrypt($cypher_text, $key, $iv, $aad, $tag) |
| 135 | 135 | { |
| 136 | - if(!$this->checkAuthenticationTag($cypher_text, $key, $iv, $aad, $tag)) |
|
| 136 | + if (!$this->checkAuthenticationTag($cypher_text, $key, $iv, $aad, $tag)) |
|
| 137 | 137 | throw new InvalidAuthenticationTagException; |
| 138 | 138 | |
| 139 | 139 | $enc_key_len = strlen($key) / 2; |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | /** |
| 130 | 130 | * AES Key Wrap using 256-bit key |
| 131 | 131 | */ |
| 132 | - const A256KW= 'A256KW'; |
|
| 132 | + const A256KW = 'A256KW'; |
|
| 133 | 133 | |
| 134 | 134 | /** |
| 135 | 135 | * Direct use of a shared symmetric key |
@@ -216,43 +216,41 @@ discard block |
||
| 216 | 216 | */ |
| 217 | 217 | const A256GCM = 'A256GCM'; |
| 218 | 218 | |
| 219 | - public static $header_location_alg = array |
|
| 220 | - ( |
|
| 219 | + public static $header_location_alg = array( |
|
| 221 | 220 | self::HS256, |
| 222 | 221 | self::HS384, |
| 223 | 222 | self::HS512, |
| 224 | 223 | self::RS256, |
| 225 | 224 | self::RS384, |
| 226 | 225 | self::RS512, |
| 227 | - self::ES256 , |
|
| 226 | + self::ES256, |
|
| 228 | 227 | self::ES384, |
| 229 | - self::ES512 , |
|
| 228 | + self::ES512, |
|
| 230 | 229 | self::PS256, |
| 231 | - self::PS384 , |
|
| 230 | + self::PS384, |
|
| 232 | 231 | self::PS512, |
| 233 | 232 | self::None, |
| 234 | 233 | self::RSA1_5, |
| 235 | - self::RSA_OAEP , |
|
| 234 | + self::RSA_OAEP, |
|
| 236 | 235 | self::RSA_OAEP_256, |
| 237 | - self::A128KW , |
|
| 236 | + self::A128KW, |
|
| 238 | 237 | self::A192KW, |
| 239 | 238 | self::A192KW, |
| 240 | 239 | self::A256KW, |
| 241 | 240 | self::Dir, |
| 242 | 241 | self::ECDH_ES, |
| 243 | - self::ECDH_ES_A128KW , |
|
| 242 | + self::ECDH_ES_A128KW, |
|
| 244 | 243 | self::ECDH_ES_A192KW, |
| 245 | - self::ECDH_ES_A256KW , |
|
| 246 | - self::A128GCMKW , |
|
| 244 | + self::ECDH_ES_A256KW, |
|
| 245 | + self::A128GCMKW, |
|
| 247 | 246 | self::A192GCMKW, |
| 248 | - self::A256GCMKW , |
|
| 249 | - self::PBES2_HS256_A128KW , |
|
| 247 | + self::A256GCMKW, |
|
| 248 | + self::PBES2_HS256_A128KW, |
|
| 250 | 249 | self::PBES2_HS384_A192KW, |
| 251 | 250 | self::PBES2_HS512_A256KW, |
| 252 | 251 | ); |
| 253 | 252 | |
| 254 | - public static $header_location_enc = array |
|
| 255 | - ( |
|
| 253 | + public static $header_location_enc = array( |
|
| 256 | 254 | self::A128CBC_HS256, |
| 257 | 255 | self::A192CBC_HS384, |
| 258 | 256 | self::A256CBC_HS512, |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | * @param string $name |
| 45 | 45 | * @param JsonValue $value |
| 46 | 46 | */ |
| 47 | - public function __construct($name , $value){ |
|
| 47 | + public function __construct($name, $value) { |
|
| 48 | 48 | $this->name = $name; |
| 49 | 49 | $this->value = $value; |
| 50 | 50 | } |
@@ -53,21 +53,21 @@ discard block |
||
| 53 | 53 | /** |
| 54 | 54 | * @return string |
| 55 | 55 | */ |
| 56 | - public function getName(){ |
|
| 56 | + public function getName() { |
|
| 57 | 57 | return $this->name; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | /** |
| 61 | 61 | * @return JsonValue |
| 62 | 62 | */ |
| 63 | - public function getValue(){ |
|
| 63 | + public function getValue() { |
|
| 64 | 64 | return $this->value; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /** |
| 68 | 68 | * @return array|bool|int|string|\utils\json_types\IJsonObject |
| 69 | 69 | */ |
| 70 | - public function getRawValue(){ |
|
| 70 | + public function getRawValue() { |
|
| 71 | 71 | return $this->getValue()->getValue(); |
| 72 | 72 | } |
| 73 | 73 | |
@@ -105,9 +105,8 @@ discard block |
||
| 105 | 105 | * @var array |
| 106 | 106 | * @see jwt/impl/JWTClaimSet.php constructor |
| 107 | 107 | */ |
| 108 | - public static $registered_claim_set = array |
|
| 109 | - ( |
|
| 110 | - self::Issuer , |
|
| 108 | + public static $registered_claim_set = array( |
|
| 109 | + self::Issuer, |
|
| 111 | 110 | self::Subject, |
| 112 | 111 | self::Audience, |
| 113 | 112 | self::IssuedAt, |
@@ -119,8 +118,7 @@ discard block |
||
| 119 | 118 | /** |
| 120 | 119 | * @var array |
| 121 | 120 | */ |
| 122 | - public static $registered_claim_set_types = array |
|
| 123 | - ( |
|
| 121 | + public static $registered_claim_set_types = array( |
|
| 124 | 122 | self::Issuer => JsonTypes::StringOrURI, |
| 125 | 123 | self::Audience => JsonTypes::StringOrURI, |
| 126 | 124 | self::Subject => JsonTypes::StringOrURI, |