function testHmacSha1_again()
 {
     Braintree_Configuration::privateKey(str_repeat(chr(0xaa), 80));
     $message = 'Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data';
     $d = Braintree_Digest::_hmacSha1($message, Braintree_Configuration::privateKey());
     $this->assertEquals('e8e99d0f45237d786d6bbaa7965c7808bbff1a91', $d);
 }
 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");
     }
 }
 private static function _payloadMatches($signature, $payload)
 {
     $payloadSignature = Braintree_Digest::hexDigestSha1(Braintree_Configuration::privateKey(), $payload);
     return Braintree_Digest::secureCompare($signature, $payloadSignature);
 }
Exemplo n.º 4
0
 public static function sampleNotification($kind, $id)
 {
     $payload = base64_encode(self::_sampleXml($kind, $id));
     $signature = Braintree_Configuration::publicKey() . "|" . Braintree_Digest::hexDigest($payload);
     return array('signature' => $signature, 'payload' => $payload);
 }
 /**
  * @ignore
  */
 private function _hash($string)
 {
     return Braintree_Digest::hexDigestSha1($this->_config->privateKey(), $string);
 }
Exemplo n.º 6
0
 /**
  * @ignore
  */
 private static function _hash($string)
 {
     return Braintree_Digest::hexDigest($string);
 }
Exemplo n.º 7
0
 /**
  * @ignore
  */
 private static function _hash($string)
 {
     return Braintree_Digest::hexDigestSha1(Braintree_Configuration::privateKey(), $string);
 }