64) { $key = pack('H*', sha1($key)); } $key = str_pad($key, 64, chr(0x00)); $ipad = str_repeat(chr(0x36), 64); $opad = str_repeat(chr(0x5c), 64); $hmac = pack( 'H*', sha1( ($key ^ $opad) . pack( 'H*', sha1( ($key ^ $ipad) . $data )) )); return base64_encode($hmac); } public function getFileSecureParams($bucket, $fileName) { $expires = time() + intval(floatval(AWSOAuth::$MINUTES_EXPIRES) * 60); $fileName = str_replace('%2F', '/', rawurlencode($fileName = ltrim($fileName, '/'))); $signpath = '/'. $bucket .'/'. $fileName; $signsz = implode("\n", $pieces = array('GET', null, null, $expires, $signpath)); $signature = $this->lazySignature(AWSOAuth::$SECRET_KEY, $signsz); $qs = http_build_query($pieces = array( 'AWSAccessKeyId' => AWSOAuth::$ACCESS_KEY, 'Expires' => $expires, 'Signature' => $signature, )); return $qs; } }