Verify the hash passed with the WebHook against the stored secret passed in the constructor

@throws WebHookHandlerException
@return boolean The result of the hash verification
763304
public function verifyHash() {
		$this->ensureInput();
		if(empty($this->input['hash']))
			throw new WebHookHandlerException('No hash provided in input payload', WebHookHandlerException::NO_INPUT_HASH);
		
		if($this->input['payloadEncrypted']) {
			if(!$this->payloadJSONString && !$this->getPayload()) return false;
		} else {
			if(!$this->payloadJSONString) $this->payloadJSONString = json_encode($this->input['payload']);
		}
		
		$webHookSalt = substr($this->input['hash'], 0, self::SALT_LENGTH);
		return $this->input['hash'] === $webHookSalt.hash(self::HASH_METHOD, $webHookSalt.$this->secret.$this->payloadJSONString);
	}
1129947
public function isValidCallbackRequest()
    {
        if (!$this->isValidHubSignature()) {
            return false;
        }

        $decoded = $this->getDecodedBody();

        $object = isset($decoded['object']) ? $decoded['object'] : null;
        $entry = isset($decoded['entry']) ? $decoded['entry'] : null;

        return $object === 'page' && null !== $entry;
    }
433443
public function checkCredentials()
    {
        try {
            $requestHeader = array_merge_recursive($this->httpHeader, $this->config->getShopHeader());

            $request = $this->messageFactory->createRequest(
                'GET',
                $this->config->getBaseUrl() . '/engine/rest/merchants/',
                $requestHeader
            );
            $request = $this->basicAuth->authenticate($request);
            $responseCode = $this->httpClient->sendRequest($request)->getStatusCode();
        } catch (TransferException $e) {
            $this->getLogger()->debug('Check credentials: Error - ' . $e->getMessage());
            return false;
        }

        if ($responseCode === 404) {
            $this->getLogger()->debug('Check credentials: Valid');
            return true;
        }

        $this->getLogger()->debug('Check credentials: Invalid - Received status code: ' . $responseCode);
        return false;
    }
1360144
protected function verifyPayment()
    {
        $fields = array(
            "merchantID" => $this->config->get('gateway.saman.merchant'),
            "RefNum" => $this->refId,
            "password" => $this->config->get('gateway.saman.password'),
        );


        try {
            $soap = new SoapClient($this->serverUrl);
            $response = $soap->VerifyTransaction($fields["RefNum"], $fields["merchantID"]);

        } catch (\SoapFault $e) {
            $this->transactionFailed();
            $this->newLog('SoapFault', $e->getMessage());
            throw $e;
        }

        $response = intval($response);

        if ($response == $this->amount) {
            $this->transactionSucceed();
            return true;
        }

        //Reverse Transaction
        if($response>0){
            try {
                $soap = new SoapClient($this->serverUrl);
                $response = $soap->ReverseTransaction($fields["RefNum"], $fields["merchantID"], $fields["password"], $response);

            } catch (\SoapFault $e) {
                $this->transactionFailed();
                $this->newLog('SoapFault', $e->getMessage());
                throw $e;
            }
        }

        //
        $this->transactionFailed();
        $this->newLog($response, SamanException::$errors[$response]);
        throw new SamanException($response);
        


    }
1233995
public boolean verify() throws SignatureException {
        if (verified)
            return verifyResult;
        if (sigAttr != null) {
            sig.update(sigAttr);
            if (RSAdata != null) {
                byte msd[] = messageDigest.digest();
                messageDigest.update(msd);
            }
            verifyResult = (Arrays.equals(messageDigest.digest(), digestAttr) && sig.verify(digest));
        }
        else {
            if (RSAdata != null)
                sig.update(messageDigest.digest());
            verifyResult = sig.verify(digest);
        }
        verified = true;
        return verifyResult;
    }
115564
public function authenticate()
    {

        $signer = new RequestSigner();
        $signer->setProvider('USF');
        $authenticator = new RequestAuthenticator($signer, $this->_timeout);

        $key = $authenticator->authenticate($this->_requestWrapper, $this->_keyLoader);

        if ($key) {
            $this->principal = "[HMAC]".$key->getId();
            $this->attributes = [];
            return true;
        }

        return false;

    }
1068729
public function authenticate()
    {
        if (empty($this->authResult)) {
            if ($this->hasIdentity()) {
                $this->clearIdentity();
            }

            return new Result(
                Result::FAILURE_UNCATEGORIZED,
                null,
                ['no result set']
            );
        }

        if ($this->hasIdentity()) {
            $this->clearIdentity();
        }

        if ($this->authResult->isValid()) {
            $this->getStorage()->write($this->authResult->getIdentity());
        }

        $result = $this->authResult;
        $this->authResult = null;

        return $result;
    }
1233769
final public function check()
	{
		if ( ! $this->perform_check())
		{
			\Auth::_unregister_verified($this);
			return false;
		}

		\Auth::_register_verified($this);
		return true;
	}
60910
public function checkChallenge()
    {
        $request  = new CheckChallenge();

        /** @var CheckChallengeResponse $response */
        $response     =  $this->service->execute($request, $this->position);
        $challengeUrl = trim($response->getChallengeUrl());

        if ($response->getShowChallenge() || !empty($challengeUrl)) {
            if (!$this->captchaSolver instanceof Solver) {
                $this->getLogger()->alert("Account has been flagged for CAPTCHA. No CAPTCHA-solver defined, returning challenge.");
                return $challengeUrl;
            }

            $this->getLogger()->alert("Account has been flagged for CAPTCHA. Attempting to solve CAPTCHA with defined resolver.");

            /* Attempt to solve CAPTCHA */
            $token = $this->captchaSolver->solve($challengeUrl);
            $this->getLogger()->info("Received CAPTCHA solution. Verifying...");

            /* Wait 1 second before firing verification request. */
            sleep(1);
            $verify = $this->verifyChallenge($token);

            if ($verify->hasSuccess()) {
                $this->getLogger()->info("Successfully solved CAPTCHA.");
                return true;
            }

            throw new FailedCaptchaException("Failed to resolve CAPTCHA.");
        }

        return false;
    }
741294
public function verify()
	{
		// TODO check structure
		if($this->type != SocialRecord::TYPE_PLATFORM && $this->type != SocialRecord::TYPE_USER && $this->type != SocialRecord::TYPE_PAGE)
			throw new SocialRecordFormatException('invalid type value [' . $this->type . ']');
		
		if(!GID::isValid($this->globalID))
			throw new SocialRecordFormatException('invalid globalID value');
			
		if(!GID::isValid($this->platformGID))
			throw new SocialRecordFormatException('invalid platformGID value');
		
		if(!GID::verifyGID($this->personalPublicKey, $this->salt, $this->globalID))
			throw new SocialRecordFormatException('invalid globalID value');
		
		if(!XSDDateTime::isValid($this->datetime))
			throw new SocialRecordFormatException('invalid date value [' . $this->datetime . ']');
		
		/*if($this->)
			throw new SocialRecordFormatException('invalid value');
		*/
		
		return true;
	}
1250517
public function verify()
	{
		if (!$this->request->has('transaction_id') && !$this->request->has('iN'))
			throw new InvalidRequestException;
		if ($this->request->has('transaction_id')) {
			$id = $this->request->get('transaction_id');
		}else {
			$id = $this->request->get('iN');
		}

		$transaction = $this->getTable()->whereId($id)->first();

		if (!$transaction)
			throw new NotFoundTransactionException;

		if (in_array($transaction->status, [Enum::TRANSACTION_SUCCEED, Enum::TRANSACTION_FAILED]))
			throw new RetryException;

		$this->make($transaction->port);

		return $this->port->verify($transaction);
	}
394337
public function verify ( $request, $base_string, $consumer_secret, $token_secret, $signature )
	{
		$decoded_sig = base64_decode($request->urldecode($signature));
		  
		// Fetch the public key cert based on the request
		$cert = $this->fetch_public_cert($request);
		
		// Pull the public key ID from the certificate
		$publickeyid = openssl_get_publickey($cert);
		
		// Check the computed signature against the one passed in the query
		$ok = openssl_verify($base_string, $decoded_sig, $publickeyid);   
		
		// Release the key resource
		openssl_free_key($publickeyid);
		return $ok == 1;
	}
459794
public function verify()
	{
		if (is_null($this->publicKey))
		{
			trigger_error('Cannot verify XML digital signature without public key', E_USER_WARNING);
			return false;
		}
		
		// find the SignedInfo element which was signed
		$signedInfo = $this->doc->getElementsByTagName($this->nodeNsPrefix . 'SignedInfo')->item(0);
		if (is_null($signedInfo))
		{
			throw new \UnexpectedValueException('Unable to locate the SignedInfo node');
		}
		
		// canonicalize the SignedInfo element for signature checking
		$c14nSignedInfo = $this->canonicalize($signedInfo);

		// find the signature value to verify
		$signatureValue = $this->doc->getElementsByTagName($this->nodeNsPrefix . 'SignatureValue')->item(0);
		if (is_null($signatureValue))
		{
			throw new \UnexpectedValueException('Unable to locate the SignatureValue node');
		}
		
		$signature = base64_decode($signatureValue->nodeValue);	
		
		return 1 === openssl_verify($c14nSignedInfo, $signature, $this->publicKey, $this->openSSLAlgoMapping[$this->digestMethod]);
	}
295453
protected function validSecret()
    {
        // this method is intentionally broken in two pieces
        // so the logic will be loud and clear.

        // is the secret empty?
        if (empty($this->secret)) {
            return false;
        }

        // created a hex representation of the secret.
        $hexRepresentation = bin2hex($this->secret);

        // check for the secret's hex representation length...
        // hex size is deterministic, it's a way of counting bytes from binary
        // ( SORT OF)
        // in any case, the length will double of the binary random generated secret.
        // 16 bytes secret will have a hex of length 32
        // 32 bytes secret will have a hex of length 64
        // 64 bytes secret will have a hex of length 128
        // you get it right?
        if ((Str::length($hexRepresentation) / 2) < 16) {
            // the minimum secret size should be 16
            // so return false in case the secret
            // is shorter than that.
            return false;
        }

        // after all this checks, declare the secret valid (finally).
        return true;
    }
1080705
public function validated(): array
    {
        $config = $this->container->make('katsana.manager')->config('webhook');

        $signature = new Signature($config['signature']);
        $header = $this->header('X_SIGNATURE') ?? '';

        if (! $signature->verify($header, $this->getContent(), ($config['threshold'] ?? 3600))) {
            throw new HttpException(419, 'Unable to verify X-Signature.');
        }

        return $this->post();
    }
630456
public function isAuthenticated()
    {
        $authenticated = false;

        if (is_null($this->parameters)) {
            return $authenticated;
        }

        $calculatedHash = md5(
            $this->parameters['item'] . '|' .
            $this->parameters['page'] . '|' .
            $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey']
        );

        if ($this->parameters['hash'] === $calculatedHash) {
            $authenticated = true;
        }

        return $authenticated;
    }
834090
public function verifyWebhookSecret($payload, $hmac_header)
    {
        $signing_secret = $this->configHelper->getSigningSecret();
        $computed_hmac  = base64_encode(hash_hmac('sha256', $payload, $signing_secret, true));

        return $computed_hmac == $hmac_header;
    }