Deployment Guide

Table Of Contents
foreach($q AS $k=>$v) {
$queryParams[] = "$k=".rawurlencode($v);
}
$p .= '?'.implode('&', $queryParams);
return $p;
}
/**
* Method to generate the AWS signing key
* @param string $shortDate: short date format (20140611)
* @param string $region: Region name (us-east-1)
* @param string $service: Service name (s3)
* @param string $secretKey Secret Access Key
* @return string
*/
protected static function getSigningKey($shortDate, $region, $service, $secretKey) {
$dateKey = hash_hmac('sha256', $shortDate, 'AWS4' . $secretKey, true);
$regionKey = hash_hmac('sha256', $region, $dateKey, true);
$serviceKey = hash_hmac('sha256', $service, $regionKey, true);
return hash_hmac('sha256', self::AWS4_EXTREME_REQUEST, $serviceKey, true);
}
/**
* Create the canonical context for the AWS service
* @param array $queryHash the query parameter hash
* @param string $host host name or ip address for the target service
* @param string $path the service address for the target service
* @param boolean $encode determine if the query parameter need to be encoded or not.
* @return string the canonical content for the request
*/
protected static function getCanonicalFFECPContent($queryHash, $host, $path,
$encode=false) {
$queryParams = array();
foreach($queryHash AS $k=>$v) {
if($encode) {$v = rawurlencode($v);}
$queryParams[] = "$k=$v";
}
$canonical_request = "GET\n"
.$path."\n"
.implode('&',$queryParams)."\n"
.'host:'.$host
."\n\nhost\nUNSIGNED-PAYLOAD";
return $canonical_request;
}
/**
* Create user readable error message
* @param integer $eid error code after verifying the AWS URL
* @return string the error message
*/
public static function getAwsError($eid) {
$forAws = " for Amazon Web Service request.";
SWITCH ($eid) {
case self::AWS4_ERROR_NULL_INPUT:
$res = "Empty input".$forAws;
break;
case self::AWS4_ERROR_INPUT_BUFFER_TOO_SMALL:
$res = "Input buffer is too small".$forAws;
break;
case self::AWS4_ERROR_INVALID_PROTOCOL:
$res = "Invalid protocol".$forAws;
break;
case self::AWS4_ERROR_INPUT_URL_TOO_BIG:
$res = "Input url is too big".$forAws;
break;
case self::AWS4_ERROR_INPUT_ID_TOO_BIG:
$res = "Input ID is too big".$forAws;
PHP External Captive Portal, Controller’s Firewall
Friendly API crypt_aws_s4.php
Extreme Campus Controller Deployment Guide for version 5.46.03 211