Verify the signature of a callback redirect to the client

@param string $accessTokenCipher
@param string $signature
@return boolean
339560
public function verifyCallbackSignature($accessTokenCipher, $signature) {
		return $this->rsaWalletService->verifySignature($accessTokenCipher, $signature, $this->publicKey);
	}
199083
public function verifySignature($data, $signature)
    {
        switch ($this->cryptParams['library']) {
            case 'openssl':
                return $this->verifyOpenSSL($data, $signature);
            case (self::HMAC_SHA1):
                $expectedSignature = hash_hmac("sha1", $data, $this->key, true);
                return strcmp($signature, $expectedSignature) == 0;
        }
    }
1021963
private function getAccessToken(AccessToken $invalid = null)
    {
        if (!isset($this->accessToken) || $this->accessToken->hasExpired() || ($invalid && $this->accessToken === $invalid)) {
            $this->accessToken = $this->acquireAccessToken();
            if (is_callable($this->tokenSave)) {
                call_user_func($this->tokenSave, $this->accessToken);
            }
        }

        return $this->accessToken;
    }
921543
protected function createIdToken(AccessTokenEntityInterface $accessToken, ClaimsSet $claims)
    {
        $issuer = $this->site->getSite();

        // Initialize the builder
        $builder = (new Builder())
            ->setAudience($accessToken->getClient()->getIdentifier())
            ->setIssuer($issuer->getSiteCanonicalURL())
            ->setIssuedAt(time())
            ->setNotBefore(time())
            ->setExpiration($accessToken->getExpiryDateTime()->getTimestamp())
            ->setSubject($accessToken->getUserIdentifier());

        // Apply claims
        foreach ($claims->jsonSerialize() as $key => $claim) {
            $builder->set($key, $claim);
        }

        // Return the newly signed token
        return $builder
            ->sign(new Sha256(), new Key($this->privateKey->getKeyPath(), $this->privateKey->getPassPhrase()))
            ->getToken();
    }
1266615
public function verifyIfSigned ( $token_type = 'access' )
	{
		if ($this->getParam('oauth_consumer_key'))
		{
			OAuthRequestLogger::start($this);
			$this->verify($token_type);
			$signed = true;
			OAuthRequestLogger::flush();
		}
		else
		{
			$signed = false;
		}
		return $signed;
	}
142202
public function verifyIPN($url, $signature, $key, $nonce, $body)
    {
        if (!$key || !$nonce || !$signature || $body == "") {
            //// missing headers OR an empty payload
            return false;
        }
        $message = $nonce . $url . $body;
        $calculated_signature = $this->signMessage($message);
        if($calculated_signature <> $signature ){
            //// invalid IPN call
            return false;
        }
        //// valid IPN call
        return true;
    }
704045
public function verifyAccessToken($accessToken)
    {
        $jwtPayload = $this->decodeAccessToken($accessToken);

        $expectedIss = sprintf('https://cognito-idp.%s.amazonaws.com/%s', $this->region, $this->userPoolId);
        if ($jwtPayload['iss'] !== $expectedIss) {
            throw new TokenVerificationException('invalid iss');
        }

        if ($jwtPayload['token_use'] !== 'access') {
            throw new TokenVerificationException('invalid token_use');
        }

        if ($jwtPayload['exp'] < time()) {
            throw new TokenExpiryException('invalid exp');
        }

        return $jwtPayload['username'];
    }
78046
public function refreshToken($accessToken = null)
    {
        $accessToken = $accessToken ?: $this->accessToken;
        $this->accessToken = $this->provider->getAccessToken('refresh_token', [
            'refresh_token' => $accessToken->getRefreshToken()
        ]);
        return $this->accessToken;
    }
1358958
public static function validateSignature($uri, $nonce, $signature, $auth_token='')
    {
      $nonce = utf8_encode($nonce);
      $signature = utf8_encode($signature);
      $auth_token = utf8_encode($auth_token);
      $uri = utf8_encode($uri);
      $port = '';
      $parsed_uri = parse_url($uri);
      $base_url = $parsed_uri['scheme'].'://'.$parsed_uri['host'];
      if (isset($parsed_uri['port'])) {
        $base_url .= ':'.$parsed_uri['port'];
      }
      if (isset($parsed_uri['path'])) {
        $base_url .= $parsed_uri['path'];
      }
      $hmac = hash_hmac('SHA256', $base_url.$nonce, $auth_token, true);
      $authentication_string = base64_encode($hmac);
      return $authentication_string == $signature;
    }
439266
public function verify(string $signature, string $data, string $secret): bool
    {
        $compareSignature = $this->sign($data, $secret);

        return $compareSignature === $signature;
    }
628697
public function verifyCallbackRequest(array $params)
    {
        return $this->signatureCallback
            ->setOrderId(array_get($params, 'Order_ID'))
            ->setStatus(array_get($params, 'Status'))
            ->setFields(array_except($params, ['Order_ID', 'Status', 'Signature']))
            ->setPassword($this->getPassword())
            ->verify(array_get($params, 'Signature'));
    }
134607
public function checkSignature($signature = null, $timestamp = null, $nonce = null)
    {
        $signature === null && isset($_GET['signature']) && $signature = $_GET['signature'];
        $timestamp === null && isset($_GET['timestamp']) && $timestamp = $_GET['timestamp'];
        $nonce === null && isset($_GET['nonce']) && $nonce = $_GET['nonce'];
        $tmpArr = [$this->token, $timestamp, $nonce];
        sort($tmpArr, SORT_STRING);
        $tmpStr = implode($tmpArr);
        return sha1($tmpStr) == $signature;
    }
1359544
public function accessTokenIsValid($accessToken, $openId)
    {
        $params = [
            'openid'       => $openId,
            'access_token' => $accessToken,
        ];

        $this->apitype = 'sns';
        $this->module  = 'auth';

        $res = $this->_get('', $params);

        return $res;
    }
32996
public function sign(Token $token, $prefix = self::PREFIX)
    {
        $auth = [
            $prefix . 'version'   => self::VERSION,
            $prefix . 'key'       => $token->key(),
            $prefix . 'timestamp' => $this->timestamp,
        ];

        $payload = $this->payload($auth, $this->params);

        $signature = $this->signature($payload, $this->method, $this->uri, $token->secret());

        $auth[$prefix . 'signature'] = $signature;

        return $auth;
    }
1035441
public function createClient($signatureCredentials, $baseUrl = null, $config = array())
    {
        if (!$signatureCredentials instanceof SignatureCredentials) {
            $signatureCredentials = $this->algorithmManager->createSignatureCredentials($signatureCredentials);
        }

        $signatureProvider = new MacSignatureProvider(
            $signatureCredentials,
            $this->algorithmManager,
            new TokenExtensionProvider($this->algorithmManager),
            new DefaultRandomProvider(),
            new DefaultTimeProvider()
        );
        $guzzleClient = new Client($baseUrl ?: $this->defaultBaseUrl, $config + (array)$this->defaultConfig);
        $guzzleClient->addSubscriber($signatureProvider)->addSubscriber($this->errorProvider);

        return $this->constructClient($guzzleClient);
    }
1259751
public function sign(SignatureAlgorithmIdentifier $algo,
        PrivateKeyInfo $privkey_info, Crypto $crypto = null): AttributeCertificate
    {
        $crypto = $crypto ?: Crypto::getDefault();
        $aci = clone $this;
        if (!isset($aci->_serialNumber)) {
            $aci->_serialNumber = "0";
        }
        $aci->_signature = $algo;
        $data = $aci->toASN1()->toDER();
        $signature = $crypto->sign($data, $privkey_info, $algo);
        return new AttributeCertificate($aci, $algo, $signature);
    }
855238
public function verifyWithKey(JWS $jws, JWK $jwk, int $signature, ?string $detachedPayload = null): bool
    {
        $jwkset = new JWKSet([$jwk]);

        return $this->verifyWithKeySet($jws, $jwkset, $signature, $detachedPayload);
    }