Deployment Guide

Table Of Contents
$host = strtolower($urlParams['host']);
if($port && (($urlParams['scheme']=='https' && $port !=
443)||($urlParams['scheme']=='http' && $port != 80))) {
$host .= ':'.$port;
}
$canonical_request = self::getCanonicalFFECPContent($q,
$host, $urlParams['path']);
$stringToSign = "AWS4-HMAC-SHA256\n{$date}\n{$scope}\n" .
hash('sha256', $canonical_request);
$signingKey = self::getSigningKey($credentAttrs[1], $credentAttrs[2],
$credentAttrs[3], $awsKeyPairs[$pKey]);
$mySign = hash_hmac('sha256', $stringToSign, $signingKey);
if (strcmp($mySign,$sign)){
return self::AWS4_ERROR_INVALID_SIGNATURE;
}
return self::AWS4_ERROR_NONE;
}
/**
* Method to verify that the query parameters contain the elements
* required in the response to the controller and the ones required to
* sign the request.
* @param array $qParams: an associative array in which the key of an
* entry is the name of a query parameter and the corresponding value
* is the value of that parameter.
* @return an AWS_ERROR code.
*/
private static function validateQueryParms($qParams) {
if (is_null($qParams)) {
return self::AWS4_ERROR_MISSING_QUERY;
}
if ((!isset($qParams['wlan'])) or (!isset($qParams['token']))
or (!isset($qParams['dest']))) {
return self::AWS4_ERROR_MISSING_QUERY_PARAMS;
}
if (!isset($qParams['X-Amz-Signature'])) {
return self::AWS4_ERROR_MISSING_QUERY_SIGNATURE;
}
if(!isset($qParams['X-Amz-Algorithm'])) {
return self::AWS4_ERROR_MISSING_QUERY_ALGORITHM;
}
if (!isset($qParams['X-Amz-Credential'])) {
return self::AWS4_ERROR_MISSING_QUERY_CREDENTIAL;
}
if (!isset($qParams['X-Amz-Date'])) {
return self::AWS4_ERROR_MISSING_QUERY_DATE;
}
if (!isset($qParams['X-Amz-Expires'])) {
return self::AWS4_ERROR_MISSING_QUERY_EXPIRES;
}
if (!isset($qParams['X-Amz-SignedHeaders'])) {
return self::AWS4_ERROR_MISSING_QUERY_SIGNED_HEADERS;
}
// The date & expires parameters exist in the request.
// Verify that the request is not stale or replayed.
$redirectedAt = DateTime::createFromFormat('Ymd?Gis?',
$qParams['X-Amz-Date'], new DateTimeZone("UTC"));
$expires = $qParams['X-Amz-Expires'];
$now = date_create();
$delta = $now->getTimestamp() - $redirectedAt->getTimestamp();
// The following gives some latitude for clocks that are not synched
if (($delta < -10) or ($delta > $expires)) {
print("<br>");
print(date("Y-m-d H:i:sZ", $now->getTimestamp()));
print("<br>");
PHP External Captive Portal, Controller’s Firewall
Friendly API crypt_aws_s4.php
Extreme Campus Controller Deployment Guide for version 5.46.03 209