#!/bin/bash
method=$1
canonical_uri=$2
file_name=$3
access_key=""
secret_key=""
host=""
x_amz_date=`date "+%Y%m%dT%H%M%SZ"`
date_stamp=`date "+%Y%m%d"`
region="us-east-1"
service="s3"
request="aws4_request"
create_canonical_request() {
canonical_headers="host:${host}\nx-amz-date:${x_amz_date}\n"
signed_headers="host;x-amz-date"
payload_hash="UNSIGNED-PAYLOAD"
canonical_request="${method}\n${canonical_uri}\n\n${canonical_headers}\n${signed_headers}\n${payload_hash}"
# echo -en $canonical_request
}
create_string_to_sign() {
algorithm="AWS4-HMAC-SHA256"
credential_scope="${date_stamp}/${region}/${service}/${request}"
canonical_request_hash=$(echo -en ${
canonical_request} | openssl dgst -sha256 | awk '{print $2}')
string_to_sign=
shell实现s3 GET PUT(authv4)
最新推荐文章于 2023-06-18 05:51:53 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)