You are here

public function AcquiaLiftAPI::getResponseSignature in Acquia Lift Connector 7.2

Parameters

string $nonce: Nonce used in the request

string $timestamp: Timestamp used in the request

string $body: Body from the response

Return value

string Base64 of the hash of the canonicalized version of the response

1 call to AcquiaLiftAPI::getResponseSignature()
AcquiaLiftAPI::authenticateResponse in includes/AcquiaLiftAPI.inc

File

includes/AcquiaLiftAPI.inc, line 671

Class

AcquiaLiftAPI

Code

public function getResponseSignature($nonce, $timestamp, $body = "") {

  // See https://github.com/acquia/http-hmac-spec (branch 2.0) for

  //specification on canonicalization of the response
  $list = array();

  // Nonce + "\n" +
  $list[] = $nonce;

  // Timestamp
  $list[] = $timestamp;

  // Body
  $list[] = $body;
  $message = implode("\n", $list);

  // Always use binary output
  return base64_encode(hash_hmac('sha256', (string) $message, $this->api_private_key, TRUE));
}