s3-bash4 icon indicating copy to clipboard operation
s3-bash4 copied to clipboard

Signature does not match

Open mengesb opened this issue 7 years ago • 4 comments

Getting the following error:

<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>SignatureDoesNotMatch</Code><Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.</Message><AWSAccessKeyId>_____</AWSAccessKeyId><StringToSign>AWS4-HMAC-SHA256
20170813T055036Z
20170813/us-west-2/s3/aws4_request
18f53936d0df8e747a82b43cfef8882931188222785cd5d63ee3d808b6c74349</StringToSign><SignatureProvided>34dba98f6ff684d5711bb08a53e4b2c0c4d5d4f603658a8694fa7820e9c0e409</SignatureProvided><StringToSignBytes>41 57 53 34 2d 48 4d 41 43 2d 53 48 41 32 35 36 0a 32 30 31 37 30 38 31 33 54 30 35 35 30 33 36 5a 0a 32 30 31 37 30 38 31 33 2f 75 73 2d 77 65 73 74 2d 32 2f 73 33 2f 61 77 73 34 5f 72 65 71 75 65 73 74 0a 31 38 66 35 33 39 33 36 64 30 64 66 38 65 37 34 37 61 38 32 62 34 33 63 66 65 66 38 38 38 32 39 33 31 31 38 38 32 32 32 37 38 35 63 64 35 64 36 33 65 65 33 64 38 30 38 62 36 63 37 34 33 34 39</StringToSignBytes><CanonicalRequest>GET
/__BUCKET__/__FULLY_QUALIFIED_FILE_PATH__

host:s3-us-west-2.amazonaws.com
x-amz-content-sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
x-amz-date:20170813T055036Z

host;x-amz-content-sha256;x-amz-date
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855</CanonicalRequest><CanonicalRequestBytes>47 45 54 0a 2f 68 63 2d 65 6e 74 65 72 70 72 69 73 65 2d 62 69 6e 61 72 69 65 73 2f 63 6f 6e 73 75 6c 2d 65 6e 74 65 72 70 72 69 73 65 2f 30 2e 39 2e 32 2f 63 6f 6e 73 75 6c 2d 65 6e 74 65 72 70 72 69 73 65 5f 30 2e 39 2e 32 25 32 42 65 6e 74 5f 64 61 72 77 69 6e 5f 61 6d 64 36 34 2e 7a 69 70 0a 0a 68 6f 73 74 3a 73 33 2d 75 73 2d 77 65 73 74 2d 32 2e 61 6d 61 7a 6f 6e 61 77 73 2e 63 6f 6d 0a 78 2d 61 6d 7a 2d 63 6f 6e 74 65 6e 74 2d 73 68 61 32 35 36 3a 65 33 62 30 63 34 34 32 39 38 66 63 31 63 31 34 39 61 66 62 66 34 63 38 39 39 36 66 62 39 32 34 32 37 61 65 34 31 65 34 36 34 39 62 39 33 34 63 61 34 39 35 39 39 31 62 37 38 35 32 62 38 35 35 0a 78 2d 61 6d 7a 2d 64 61 74 65 3a 32 30 31 37 30 38 31 33 54 30 35 35 30 33 36 5a 0a 0a 68 6f 73 74 3b 78 2d 61 6d 7a 2d 63 6f 6e 74 65 6e 74 2d 73 68 61 32 35 36 3b 78 2d 61 6d 7a 2d 64 61 74 65 0a 65 33 62 30 63 34 34 32 39 38 66 63 31 63 31 34 39 61 66 62 66 34 63 38 39 39 36 66 62 39 32 34 32 37 61 65 34 31 65 34 36 34 39 62 39 33 34 63 61 34 39 35 39 39 31 62 37 38 35 32 62 38 35 35</CanonicalRequestBytes><RequestId>D4FE2167BCCC1588</RequestId><HostId>4PkyV6i/DWmP9BRWN8e7UI1EJPPK0xsI5coTa2gPI4ZxkS6xMwhapNbGJrJDT+Xe14g6fSAbHmA=</HostId></Error>

I'm operating on MacOS so Ive updated the openssl command to specify -hmac hexkey:$1 and the date bin to use GNU date given I'm on MacOS and the native date binary is BSD date.

mengesb avatar Aug 13 '17 05:08 mengesb

Not sure why but it doesn't work on MacOS for me. I'm open to include a PR if anyone can make this work.

cvle avatar Dec 29 '17 16:12 cvle

@mengesb - You can't use BSD date as is. If you have the option to install GNU date, it should work.

Test with: date (GNU coreutils) 8.28 OpenSSL 1.0.2k 26 Jan 2017

cciotti avatar Jan 17 '18 02:01 cciotti

I am receiving this same error SignatureDoesNotMatch on mac. @cciotti does the script work as is except changing date to use gdate?

Ianwww avatar Apr 17 '18 19:04 Ianwww

Since the repo here seems dead, I forked it and fixed all MacOS related issues: https://github.com/ofhouse/s3-bash4

ofhouse avatar Jul 11 '20 18:07 ofhouse