I am not sure if you are aware of DigitalOcean's new Spaces, which is a K/V object storage much like S3. In fact, they've even made it compatible with the S3 API - except for one major issue. They only allow V2 Signatures at the minute.
Following this: https://developers.digitalocean.com/documentation/spaces/?utm_medium=email&utm_source=local&utm_campaign=ObjectStorageEA#authentication
I have come up with what I thought would work, but it doesn't.
Could anybody please point me in the right direction? There seems to be absolutely nobody that has come forward anywhere to say they know how to use the V2 signatures.
Thank you!
function generateSignature($a) {
$awsKeyId = 'KEY_ID';
$awsSecret = 'SECRET_KEY';
$expires = time() + (5*60);
$httpVerb = "GET";
$contentMD5 = "";
$contentType = "";
$amzHeaders = "";
$amzResource = "/" . $a;
$str = "AWS2-HMAC-SHA1"."\n" .
date(DateTime::ISO8601) . "\n" .
date('Ymd') . "/nyc3.digitaloceanspaces.com/s3/aws2_request" . "\n" .
base64_encode(sha1());
$dateKey = hash_hmac("sha1",$awsSecret,date("Ymd"));
$dateRegionKey = sha1($dateKey,"nyc3.digitaloceanspaces.com");
$dateRegionServiceKey = sha1($dateRegionKey,"s3");
$signingKey = sha1($dateRegionServiceKey."aws2_request");
$signature = base64_encode(hash_hmac('sha1',$str,$signingKey));
$url = "https://repo-name.nyc3.digitaloceanspaces.com%s?AWSAccessKeyId=%s&Expires=%s&Signature=%s";
$presignedUrl = sprintf( $url , $amzResource , $awsKeyId , $expires , $signature );
return $presignedUrl;
}