S3 Tools in Bash
Clash Royale CLAN TAG#URR8PPP
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;
up vote
1
down vote
favorite
This is a follow on to a previous question:
Part 1: Signature
All the code I am submitting here is available in github
The reason to write these tools is so I can prototype and quickly verify that I am doing things correctly before implementing them in C++. This is mainly necessary because the documentation these scripts are based on are relatively bad and confusing.
s3/signature
#!/usr/bin/env bash
check=$(echo -n s3 | openssl dgst -sha256 -binary -mac HMAC -macopt hexkey:01dda345af12 2> /dev/null | xxd -p -c 256)
if [[ "$check" != "6d00e194dca4f102300b638bb3404a1c9b8c1ba73514d22a7013f9832c20366a" ]]; then
echo "Check of openssl failed"
echo "You need a verions greater than 0"
exit 1
fi
#
# method
# url
# key
# secret
# dateTime if empty use now utc
# expires
# service if blank extracts from the URL
# region if blank extracts from the URL
# signHeaders if 1 creates headers for signing otherwise creates query parameters
# verbose if blank (empty or just white space) then no extra output.
# otherwise it is a filename to output (note - represents stdout)
# headers[@]
function createSignature xxd -p -c 256)
#
# Build the String to sign.
local ss=$(cat - <<StringToSign
AWS4-HMAC-SHA256
$dateTime
$date/$region/$service/aws4_request
$HashedCanonicalRequest
StringToSign
)
#
# Calculate the signature
local kDate=$(echo -n $date
bash s3
add a comment |Â
up vote
1
down vote
favorite
This is a follow on to a previous question:
Part 1: Signature
All the code I am submitting here is available in github
The reason to write these tools is so I can prototype and quickly verify that I am doing things correctly before implementing them in C++. This is mainly necessary because the documentation these scripts are based on are relatively bad and confusing.
s3/signature
#!/usr/bin/env bash
check=$(echo -n s3 | openssl dgst -sha256 -binary -mac HMAC -macopt hexkey:01dda345af12 2> /dev/null | xxd -p -c 256)
if [[ "$check" != "6d00e194dca4f102300b638bb3404a1c9b8c1ba73514d22a7013f9832c20366a" ]]; then
echo "Check of openssl failed"
echo "You need a verions greater than 0"
exit 1
fi
#
# method
# url
# key
# secret
# dateTime if empty use now utc
# expires
# service if blank extracts from the URL
# region if blank extracts from the URL
# signHeaders if 1 creates headers for signing otherwise creates query parameters
# verbose if blank (empty or just white space) then no extra output.
# otherwise it is a filename to output (note - represents stdout)
# headers[@]
function createSignature xxd -p -c 256)
#
# Build the String to sign.
local ss=$(cat - <<StringToSign
AWS4-HMAC-SHA256
$dateTime
$date/$region/$service/aws4_request
$HashedCanonicalRequest
StringToSign
)
#
# Calculate the signature
local kDate=$(echo -n $date
bash s3
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
This is a follow on to a previous question:
Part 1: Signature
All the code I am submitting here is available in github
The reason to write these tools is so I can prototype and quickly verify that I am doing things correctly before implementing them in C++. This is mainly necessary because the documentation these scripts are based on are relatively bad and confusing.
s3/signature
#!/usr/bin/env bash
check=$(echo -n s3 | openssl dgst -sha256 -binary -mac HMAC -macopt hexkey:01dda345af12 2> /dev/null | xxd -p -c 256)
if [[ "$check" != "6d00e194dca4f102300b638bb3404a1c9b8c1ba73514d22a7013f9832c20366a" ]]; then
echo "Check of openssl failed"
echo "You need a verions greater than 0"
exit 1
fi
#
# method
# url
# key
# secret
# dateTime if empty use now utc
# expires
# service if blank extracts from the URL
# region if blank extracts from the URL
# signHeaders if 1 creates headers for signing otherwise creates query parameters
# verbose if blank (empty or just white space) then no extra output.
# otherwise it is a filename to output (note - represents stdout)
# headers[@]
function createSignature xxd -p -c 256)
#
# Build the String to sign.
local ss=$(cat - <<StringToSign
AWS4-HMAC-SHA256
$dateTime
$date/$region/$service/aws4_request
$HashedCanonicalRequest
StringToSign
)
#
# Calculate the signature
local kDate=$(echo -n $date
bash s3
This is a follow on to a previous question:
Part 1: Signature
All the code I am submitting here is available in github
The reason to write these tools is so I can prototype and quickly verify that I am doing things correctly before implementing them in C++. This is mainly necessary because the documentation these scripts are based on are relatively bad and confusing.
s3/signature
#!/usr/bin/env bash
check=$(echo -n s3 | openssl dgst -sha256 -binary -mac HMAC -macopt hexkey:01dda345af12 2> /dev/null | xxd -p -c 256)
if [[ "$check" != "6d00e194dca4f102300b638bb3404a1c9b8c1ba73514d22a7013f9832c20366a" ]]; then
echo "Check of openssl failed"
echo "You need a verions greater than 0"
exit 1
fi
#
# method
# url
# key
# secret
# dateTime if empty use now utc
# expires
# service if blank extracts from the URL
# region if blank extracts from the URL
# signHeaders if 1 creates headers for signing otherwise creates query parameters
# verbose if blank (empty or just white space) then no extra output.
# otherwise it is a filename to output (note - represents stdout)
# headers[@]
function createSignature xxd -p -c 256)
#
# Build the String to sign.
local ss=$(cat - <<StringToSign
AWS4-HMAC-SHA256
$dateTime
$date/$region/$service/aws4_request
$HashedCanonicalRequest
StringToSign
)
#
# Calculate the signature
local kDate=$(echo -n $date
bash s3
asked Jan 13 at 22:33
Martin York
70.9k481244
70.9k481244
add a comment |Â
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f185066%2fs3-tools-in-bash%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password