/** * Validate the signature using a key from the given JWK set. * * Correct key shall be sought by the key ID indicated by the header. * * @param JWKSet $set Set of JSON Web Keys * @throws \RuntimeException If algorithm initialization fails * @return bool True if signature is valid */ public function validateWithJWKSet(JWKSet $set) { if (!count($set)) { throw new \RuntimeException("No keys."); } $factory = new SignatureAlgorithmFactory($this->header()); $algo = $factory->algoByKeys($set); return $this->validate($algo); }