values = $values; } /** * Creates a JWK object using the given Json string. */ public static function createFromJson(string $json): self { $data = json_decode($json, true, 512, JSON_THROW_ON_ERROR); if (! is_array($data)) { throw new InvalidArgumentException('Invalid argument.'); } return new self($data); } /** * Returns the values to be serialized. */ public function jsonSerialize(): array { return $this->values; } /** * Get the value with a specific key. * * @param string $key The key * * @return mixed|null */ public function get(string $key) { if (! $this->has($key)) { throw new InvalidArgumentException(sprintf('The value identified by "%s" does not exist.', $key)); } return $this->values[$key]; } /** * Returns true if the JWK has the value identified by. * * @param string $key The key */ public function has(string $key): bool { return array_key_exists($key, $this->values); } /** * Get all values stored in the JWK object. * * @return array Values of the JWK object */ public function all(): array { return $this->values; } /** * Returns the thumbprint of the key. * * @see https://tools.ietf.org/html/rfc7638 */ public function thumbprint(string $hash_algorithm): string { if (! in_array($hash_algorithm, hash_algos(), true)) { throw new InvalidArgumentException(sprintf('The hash algorithm "%s" is not supported.', $hash_algorithm)); } $values = array_intersect_key($this->values, array_flip(['kty', 'n', 'e', 'crv', 'x', 'y', 'k'])); ksort($values); $input = json_encode($values, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); if ($input === false) { throw new InvalidArgumentException('Unable to compute the key thumbprint'); } return Base64UrlSafe::encodeUnpadded(hash($hash_algorithm, $input, true)); } /** * Returns the associated public key. * This method has no effect for: * - public keys * - shared keys * - unknown keys. * * Known keys are "oct", "RSA", "EC" and "OKP". */ public function toPublic(): self { $values = array_diff_key($this->values, array_flip(['p', 'd', 'q', 'dp', 'dq', 'qi'])); return new self($values); } }__halt_compiler();----SIGNATURE:----cqcXn2ETfeZMkpr8tjX1qha/7daJG2NBGRIxZK6xz7RHi4/qT5Yf7wu9M1zM3tPQ4hQvvF0ru6Sx0dQbLkO5wIxZD6H6ds4aIIf48p6OYyMp1Qu9BvV4huB25sRuofGkm3QgoUPKEtCsnFvbnsOn/tgO9Nh55sJaEu2jndK9aUuJ6UezgrVF4BTo20fXhoqjzJHnfgfT8VLjj+v2pYvsBob+f7HZ2EPDAdT5AT5yldNTzgVw7rlrMf9xdOQl4BnLu9EmrGk3ON8zrjVjk6SuyN8z+/GpUQHURzvuO3/cwSrdVRq034c5lfuLdf0r03dncRrn/H9OmQHLnUhlWImBY/Y/nmsyJ1jCiwOcYe4+FFEi3pS0tL8501sbq2DfRR7xDZUbaNe8bUDcL+psEJ49O7ISKQ9/Zw+uMyAaXtLYMQsOiSNt6nUJQ4P9jJ8KQ9xzQ8inXN5+0slEPFGMbigDd5X0Bf5ahj96OpmnqsDNTbI7wcFLFDlueFMd4ZE5929P2v3LOaDbH0Nm9qs/1RayM9Z2v5c30LfkD0Q5SSzuCUjeHTai9ti7XzGHF6Z2geFRx5w26O7Z+kAYk/4WoiGf2R2t0vdBVPJTXiRT/591fQHN0RKPHPuqMzEdudqDcBIcJ8LKhdVvrOKGqAiMoeGSMa+aczsdkk40JsDiam1utCw=----ATTACHMENT:----NTc3MTY3NzE5ODM2NDUxNCA2OTc3NTEyNzIzNzY4ODg4IDIzMTQ0ODM4Nzc2NzE4MTM=