Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/bash
STRING=$(echo -n "(request-target): get /signature-prototype-1.0-SNAPSHOT/api/colors/preferred
date: Tue, 07 Jun 2014 20:51:35 GMT" | base64)
SIGNATURE=$(
echo -n "(request-target): get /signature-prototype-1.0-SNAPSHOT/api/colors/preferred
date: Tue, 07 Jun 2014 20:51:35 GMT" | openssl dgst -binary -sha256 -hmac "PennyLunaLuka" | base64)
echo $SIGNATURE
curl -v \
-H "X-Signing-String: $STRING" \
-H 'Authorization: Signature keyId="kids",algorithm="hmac-sha256",headers="(request-target) date",signature="g+GNqWOXhigFV9ujbZN50J54HDeNZa1L4Bom+HIozqE="' \
-H 'Date: Tue, 07 Jun 2014 20:51:35 GMT' \
http://ec2-54-165-89-69.compute-1.amazonaws.com:8080/signature-prototype-1.0-SNAPSHOT/api/colors/preferred
curl -v \
-H "X-Signing-String: $STRING" \
-H "Authorization: Signature keyId=\"kids\",algorithm=\"hmac-sha256\",headers=\"(request-target) date\",signature=\"$SIGNATURE\"" \
-H 'Date: Tue, 07 Jun 2014 20:51:35 GMT' \
http://ec2-54-165-89-69.compute-1.amazonaws.com:8080/signature-prototype-1.0-SNAPSHOT/api/colors/preferred
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment