Do the Amazon SES documentation examples use a consistent, known set of example keys?

痞子三分冷 提交于 2021-02-08 09:51:15

问题


I am trying to write a Lua library for Amazon SES that will allow me to send API requests. I've poured over the documentation and various examples but I am continuing to get the following error:

The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.

One of my functions somewhere along the line is formatting data incorrectly or doing something to cause the end result of my signing process to not match what Amazon is generating on their side, so my request is being rejected. However, Amazon doesn't provide any useful information in their error response such as showing me the canonical request that they generate so I can compare it to mine to see if there are any discrepencies. My best attempts to debug this is to use the examples they provide in their documentation (see below) as "known good" comparisons and to try and generate the same hashes with my functions... Except that they don't provide all of the necessary information to do so.

In Task 3 of their documentation process, they do share an example secrey key and I've been able to use that to verify that at least part of my code is indeed working as intended, but that key does not seem to generate the same hashes on the other tasks. Am I missing something here, or is there a better way to figure this problem out?

Below are the example keys I was able to pull out of various Task pages in their documentation:

api_key    = "AKIDEXAMPLE"
api_secret = "wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY"

In Amazon's Documentation for Task 1, they provide the final canonical request and a paired hash:

GET
/
Action=ListUsers&Version=2010-05-08
content-type:application/x-www-form-urlencoded; charset=utf-8
host:iam.amazonaws.com
x-amz-date:20150830T123600Z

content-type;host;x-amz-date
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855

f536975d06c0309214f805bb90ccff089219ecd68b2577efef23edd43b7e1a59

However when I use the above secret to hash the above canonical request, I get a different hash:

d2da54b4842d8ca1acf1cf197827f4d75a742918af868d472e883781624a8bb5

So they must being using a different secret in some examples without actually documenting them.. unless I missed something?

Documentation: https://docs.aws.amazon.com/general/latest/gr/sigv4_signing.html

WIP Code: https://hastebin.com/mezugukefu.lua

来源:https://stackoverflow.com/questions/63082504/do-the-amazon-ses-documentation-examples-use-a-consistent-known-set-of-example

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!