duanjia7912 2016-04-26 08:50
浏览 52

如何单独创建预签名URL查询参数?

Currently I am generating the authenticated URL as :

$this->s3Client = new S3Client($this->options);
$cmd = $this->s3Client->getCommand('GetObject', [
    'Bucket' => $bucket_name,
    'Key'    => $object_key
]);
$request = $this->s3Client->createPresignedRequest($cmd, PRESIGNED_URL_VALIDITY);
$presignedUrl = (string) $request->getUri();

Is there a way I could generate the query parameters in the authenticated URL on my own an not using createPresignedRequest.

I need to separately create :

?X-Amz-Algorithm=AWS4-HMAC-SHA256
&X-Amz-Credential=
&X-Amz-Date=20130721T201207Z
&X-Amz-Expires=86400
&X-Amz-SignedHeaders=host
&X-Amz-Signature=<signature-value>

and the append it to the bucket file path to make it into the presigned request.

  • 写回答

1条回答 默认 最新

  • drz5553 2016-04-26 09:22
    关注

    It's not exactly clear to me what you mean by "generate the query parameters in the authenticated URL on my own". AWS uses OpenSSL to deal with generating signatures and building signed URLs.

    You could create signed URLs entirely w/o PHP, for e.g. on a Linux command line using the openssl command. Check this for a bash example: https://github.com/gdbtek/aws-tools/blob/master/sign_s3_url.bash.

    You can also use PHP w/o the S3Client to generate signed URLs using the PHP OpenSSL extension and utilising openssl_* functions.

    评论

报告相同问题?

悬赏问题

  • ¥15 拟通过pc下指令到安卓系统,如果追求响应速度,尽可能无延迟,是不是用安卓模拟器会优于实体的安卓手机?如果是,可以快多少毫秒?
  • ¥20 神经网络Sequential name=sequential, built=False
  • ¥16 Qphython 用xlrd读取excel报错
  • ¥15 单片机学习顺序问题!!
  • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上
  • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)
  • ¥15 相敏解调 matlab
  • ¥15 求lingo代码和思路
  • ¥15 公交车和无人机协同运输
  • ¥15 stm32代码移植没反应