Jose\Verifier::verifySignature PHP Метод

verifySignature() приватный Метод

private verifySignature ( Jose\Object\JWSInterface $jws, Jose\Object\JWKSetInterface $jwk_set, Jose\Object\SignatureInterface $signature, string | null $detached_payload = null ) : boolean
$jws Jose\Object\JWSInterface
$jwk_set Jose\Object\JWKSetInterface
$signature Jose\Object\SignatureInterface
$detached_payload string | null
Результат boolean
    private function verifySignature(Object\JWSInterface $jws, Object\JWKSetInterface $jwk_set, Object\SignatureInterface $signature, $detached_payload = null)
    {
        $input = $this->getInputToVerify($jws, $signature, $detached_payload);
        foreach ($jwk_set->getKeys() as $jwk) {
            $algorithm = $this->getAlgorithm($signature);
            try {
                $this->checkKeyUsage($jwk, 'verification');
                $this->checkKeyAlgorithm($jwk, $algorithm->getAlgorithmName());
                if (true === $algorithm->verify($jwk, $input, $signature->getSignature())) {
                    return true;
                }
            } catch (\Exception $e) {
                //We do nothing, we continue with other keys
                continue;
            }
        }
        return false;
    }