AWS PHP SDK签名V4

时间:2015-03-04 20:41:30

标签: php amazon-web-services amazon-s3

我使用以下代码生成直接上传到S3的签名(使用sig v4,因为存储桶位于法兰克福):

$s3 = S3Client::factory(array(
            'key' => Configure::read('Aws.key'), 
            'secret' => Configure::read('Aws.secret'), 
            'region' => Configure::read('Aws.region'),
            'signature' => 'v4'
        )
    );


    $postObject = new \Aws\S3\Model\PostObject($s3, Configure::read('Aws.bucket'), 
                                               array('acl' => 'public-read'));


    $form = $postObject->prepareData()->getFormInputs();

    $this->set('policy', $form['policy']);
    $this->set('signature', $form['signature']);

但是,POST的最终结果始终是包含以下消息的XML响应:

 The authorization mechanism you have provided is not supported. Please use AWS4-HMAC-SHA256.

任何人都可以看到我可能做错了吗?

0 个答案:

没有答案