function acquia_spi_valid_request in Acquia Connector 6.2
Same name and namespace in other branches
- 7.2 acquia_spi/acquia_spi.module \acquia_spi_valid_request()
1 call to acquia_spi_valid_request()
- acquia_spi_send_module_data in acquia_spi/
acquia_spi.module - Send a file's contents to the requestor
File
- acquia_spi/
acquia_spi.module, line 203 - Send site profile information (NSPI) and system data to Acquia Insight.
Code
function acquia_spi_valid_request($data, $message) {
$key = acquia_agent_settings('acquia_key');
if (!isset($data['authenticator']) || !isset($data['authenticator']['time']) || !isset($data['authenticator']['nonce'])) {
return FALSE;
}
$string = $data['authenticator']['time'] . ':' . $data['authenticator']['nonce'] . ':' . $message;
$hash = sha1((str_pad($key, 64, chr(0x0)) ^ str_repeat(chr(0x5c), 64)) . pack("H*", sha1((str_pad($key, 64, chr(0x0)) ^ str_repeat(chr(0x36), 64)) . $string)));
if ($hash == $data['authenticator']['hash']) {
return TRUE;
}
else {
return FALSE;
}
}