• Модуль: socialservices
  • Путь к файлу: ~/bitrix/modules/socialservices/classes/general/bitrix24.php
  • Класс: CBitrixPHPAppTransport
  • Вызов: CBitrixPHPAppTransport::callSigned
public function callSigned($methodName, $additionalParams = '')
{
	if($this->signatureKey)
	{
		$state = RandString(32);

		$result = $this->call($methodName, 'state=' . $state . "&" . static::prepareRequest($additionalParams));

		if(is_array($result) && isset($result["signature"]))
		{
			$signer = new BitrixSocialservicesBitrix24Signer();
			$signer->setKey($this->signatureKey);

			//try
			//{

			$signatureCheck = $signer->unsign($result["signature"]);

			if(
				$signatureCheck["state"] === $state
			)
			{
				foreach($signatureCheck as $key => $value)
				{
					if($key !== "state")
					{
						if($result['result'][$key] !== $value)
						{
							return false;
						}
					}
				}

				unset($result["signature"]);

				return $result;
			}

			//}
			//catch (BitrixMainSecuritySignBadSignatureException $e)
			//{}
		}
	}

	return false;
}