Skip to content

Commit

Permalink
Refactor amazon_s34_sign().
Browse files Browse the repository at this point in the history
See: #440
  • Loading branch information
jaswsinc committed Jan 8, 2015
1 parent 6a57070 commit 9e55d2c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion s2member/includes/classes/files-in.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,11 @@ public static function amazon_s3_sign($string = '')
*/
public static function amazon_s34_sign($string = '')
{
$s3c['secret_key'] = $GLOBALS['WS_PLUGIN__']['s2member']['o']['amazon_s3_files_secret_key'];
$s3c = array(); // Initialize config. keys.
foreach($GLOBALS['WS_PLUGIN__']['s2member']['o'] as $option => $option_value)
if(preg_match('/^amazon_s3_files_/', $option) && ($option = preg_replace('/^amazon_s3_files_/', '', $option)))
$s3c[$option] = $option_value;

$s3_date_key = c_ws_plugin__s2member_utils_strings::hmac_sha256_sign(date('Ymd'), 'AWS4'.$s3c['secret_key']);
$s3_date_region_key = c_ws_plugin__s2member_utils_strings::hmac_sha256_sign($s3c['bucket_region'], $s3_date_key);
$s3_date_region_service_key = c_ws_plugin__s2member_utils_strings::hmac_sha256_sign('s3', $s3_date_region_key);
Expand Down

0 comments on commit 9e55d2c

Please sign in to comment.