Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize the AWS2 Authentication process

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains the "AWS2 authentication process how to achieve", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in-depth, together to study and learn "AWS2 authentication process how to achieve" it!

Many novice drivers look at the official document AWS2 authentication section, especially how the Authorization is generated is always obscure, the core is how the StringToSign is formed.

Authorization = "AWS" + "" + AWSAccessKeyId + ":" + Signature;Signature = Base64 (HMAC-SHA1 (YourSecretAccessKeyID, UTF-8-Encoding-Of (StringToSign); StringToSign = HTTP-Verb + "\ n" + Content-MD5 + "\ n" + Content-Type + "\ n" + Date + "\ n" + CanonicalizedAmzHeaders + CanonicalizedResource

Let's use bash to upload an Object to S3 as an example to explain the whole AWS2 signature process.

#! / bin/bashACCESS_KEY= "# fill in access keySECRET_KEY=" # fill in secret keyHOST= "s3.cephbook.com" # fill in the Endpoint address of S3 BUCKET= "demo" # fill in bucket name CONTENT_TYPE= "application/octet-stream" # MIMEFILENAME=/tmp/demo # File Local path ACL= "x-amz-acl:public-read" # Object ACLMETA_DATA= "x-amz-meta-ukey:value" # Custom medadataFILESIZE=$ (stat-c% s "$FILENAME") FILEMD5= `cat ${FILENAME} | openssl dgst-md5-binary | openssl enc-Base64`Auth _ PATH= "/ ${BUCKET} ${FILENAME}" CURRENT_TIME= `TZ = GMT LANG=en_US date "+% a % d% b% Y% H:%M:%S GMT 'stringToSign=' PUT\ n$ {FILEMD5}\ n$ {CONTENT_TYPE}\ n$ {CURRENT_TIME}\ n$ {ACL}\ n$ {META_DATA}\ n$ {AUTH_PATH} "echo $stringToSignsignature= `echo-en ${stringToSign} | openssl sha1-hmac ${SECRET_KEY}-binary | base64`curl-v-X PUT" http://${HOST}${AUTH_PATH}"\-H "Authorization: AWS ${ACCESS_KEY} : ${signature} "\-H" Date: ${CURRENT_TIME} "\-H" Host: ${HOST} "\-H" Content-Length: ${FILESIZE} "\-H" Content-MD5: ${FILEMD5} "\-H" Content-Type: ${CONTENT_TYPE} "\-H" ${ACL} "\-H" ${META_DATA} "\-T" ${FILENAME} "Thank you for reading The above is the content of "how to achieve the AWS2 authentication process". After the study of this article, I believe you have a deeper understanding of how to achieve this problem in the AWS2 certification process, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report