You are here

private static function Braintree_WebhookNotification::_validateSignature in Commerce Braintree 7

1 call to Braintree_WebhookNotification::_validateSignature()
Braintree_WebhookNotification::parse in braintree_php/lib/Braintree/WebhookNotification.php

File

braintree_php/lib/Braintree/WebhookNotification.php, line 48

Class

Braintree_WebhookNotification

Code

private static function _validateSignature($signature, $payload) {
  $signaturePairs = preg_split("/&/", $signature);
  $matchingSignature = self::_matchingSignature($signaturePairs);
  $payloadSignature = Braintree_Digest::hexDigest($payload);
  if (!Braintree_Digest::secureCompare($matchingSignature, $payloadSignature)) {
    throw new Braintree_Exception_InvalidSignature("webhook notification signature invalid");
  }
}