/** * @param \Jose\Object\SignatureInterface $signature * * @return \Jose\Algorithm\SignatureAlgorithmInterface */ private function getAlgorithm(Object\SignatureInterface $signature) { $complete_headers = array_merge($signature->getProtectedHeaders(), $signature->getHeaders()); Assertion::keyExists($complete_headers, 'alg', 'No "alg" parameter set in the header.'); $algorithm = $this->getJWAManager()->getAlgorithm($complete_headers['alg']); Assertion::isInstanceOf($algorithm, Algorithm\SignatureAlgorithmInterface::class, sprintf('The algorithm "%s" is not supported or does not implement SignatureInterface.', $complete_headers['alg'])); return $algorithm; }