Download private file from S3 using bash

后端 未结 5 1108
不知归路
不知归路 2020-12-16 16:31

I am trying to get the following bash script to work (copied from http://curl.haxx.se/mail/archive-2014-10/0006.html#replies):

#!/bin/sh 
file=path/to/file          


        
5条回答
  •  轮回少年
    2020-12-16 16:53

    After way too much time spent on this I finally got it to work:

    This line:

    signature=`/bin/echo -n "$stringToSign" | openssl sha1 -hmac ${s3Secret} -binary | base64`
    

    is missing an 'e':

    signature=`/bin/echo -en "$stringToSign" | openssl sha1 -hmac ${s3Secret} -binary | base64`
    

    In other words, characters weren't being escaped before the string was signed.

    As an aside, I also learned that for get requests, the content type is meaningless.

提交回复
热议问题