Verifies the signature on data.

Returns true if the signature is valid, false otherwise.
@param $data
@param $signature
@return bool
546840
function verify($data, $signature) {
    $status = openssl_verify($data, $signature, $this->publicKey, "sha256");
    if ($status === -1) {
      throw new Exception('Signature verification error: ' . openssl_error_string());
    }
    return $status === 1;
  }
907308
public function equals($signature) : bool
    {
        if ($signature instanceof Signature) {
            $signature = $signature->signature;
        }

        if ($this === $signature || $this->signature == $signature) {
            return true;
        }

        return false;
    }
153261
public function isValid($payload, $secret, $signature)
    {
        return $signature === hash_hmac($this->hashAlgorithm, $payload, $secret, true);
    }
544608
public function check($signature)
    {
        if (is_array($signature) and isset($signature['sig'])) {
            $signature = $signature['sig'];
        }

        if (!is_string($signature)) {
            throw new \InvalidArgumentException('signature must be string, or present in array or parameters');
        }

        return $signature == $this->signed['sig'];
    }
1076357
function verify($text, $signature)
    {
        try {
            $verified = $this->gpg->verify($text, $signature);
            return $this->parse_signature($verified[0]);
        }
        catch (Exception $e) {
            return $this->get_error_from_exception($e);
        }
    }
1062060
protected static function _signature($data, $secret = null) {
		unset($data['__signature']);
		$secret = ($secret) ?: static::$_secret;
		return hash_hmac('sha1', serialize($data), $secret);
	}
1310873
public function verifySign($data, $key)
    {
        $prestr = $data['prestr'];
        $sign = $data['sign'];
        $prestr = $prestr . $key;
        $mysgin = md5($prestr);

        if($mysgin == $sign) {
            return true;
        }

        return false;
    }
1262449
public function verify(JWSInterface $jws, JWKSetInterface $signature_key_set, $detached_payload = null)
    {
        Assertion::inArray($jws->getSignature(0)->getProtectedHeader('alg'), $this->getSupportedSignatureAlgorithms(), sprintf('The signature algorithm "%s" is not supported or not allowed.', $jws->getSignature(0)->getProtectedHeader('alg')));

        $index = null;
        $this->verifier->verifyWithKeySet($jws, $signature_key_set, $detached_payload, $index);
        Assertion::notNull($index, 'JWS signature(s) verification failed.');
        $this->checker_manager->checkJWS($jws, $index);

        return $index;
    }
355096
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;
    }
1117860
public function verifySignature($content, $signature, VirgilPublicKey $signerPublicKey)
    {
        try {
            return $this->cryptoService->verify(
                $content,
                $signature,
                $signerPublicKey->getValue()
            );
        } catch (Exception $exception) {
            throw new VirgilCryptoException($exception->getMessage());
        }
    }
459897
protected function validWBMP($data)
	{
		return ord($data[0]) === 0 && ord($data[1]) === 0 && $data !== substr(TypeJp2::JPEG_2000_SIGNATURE, 0, self::LONG_SIZE);
	}
516921
private function compare(array $signature, array $metadata): bool
    {
        foreach ($signature as $key => $v1) {

            $v2 = $metadata[$key] ?? null;

            if (! is_null($v2) && $v1 !== $v2) return false;

        }

        return true;
    }
385913
protected function validateDataFromCache($data): bool
    {
        if (!\is_array($data)) {
            return false;
        }

        foreach (['value', 'ttl'] as $missing) {
            if (!\array_key_exists($missing, $data)) {
                return false;
            }
        }

        return true;
    }
179453
public function verify($signature, $baseString, $key)
    {
        $expectedSignature = $this->generateSignature($baseString, $key);
        if (empty($signature) || empty($expectedSignature)) {
            return false;
        }

        return (strcmp($expectedSignature, $signature) === 0);
    }
182205
public function check(array $auth, array $signature, $prefix)
    {
        if (! isset($auth[$prefix . 'signature'])) {
            throw new SignatureSignatureException('The signature has not been set');
        }

        if ($auth[$prefix . 'signature'] !== $signature[$prefix . 'signature']) {
            throw new SignatureSignatureException('The signature is not valid');
        }

        return true;
    }
794786
public static function validateSignature($signature, $payload)
    {
        $parts = explode(',', $signature);
        $parameters = [];
        $t = 0;
        // Find the timestamp
        foreach ($parts as $part) {
            parse_str($part, $parsed);
            if (key($parsed) === 't') {
                $t = $parsed['t'];
                break;
            }
        }

        if ($t === 0) {
            return false;
        }

        $wanted = hash_hmac('sha256', $t . '.' . $payload, self::$secret);

        // Find v1 hashes
        foreach ($parts as $part) {
            parse_str($part, $parsed);
            if (key($parsed) === 'v1') {
                if ($wanted === $parsed['v1']) {
                    return true;
                }
            }
        }

        return false;
    }
1144846
private function sign($data)
    {
        if (openssl_sign((string)$data, $signature, $this->privateKey->toString(), static::SIGNATURE_ALGORITHM) !== true) {
            throw new \Exception("Could not sign request: " . openssl_error_string());
        }

        return $signature;
    }