Skip to content

Instantly share code, notes, and snippets.

Created February 2, 2015 23:52
Show Gist options
  • Save anonymous/1805ec5b9a90beab54f8 to your computer and use it in GitHub Desktop.
Save anonymous/1805ec5b9a90beab54f8 to your computer and use it in GitHub Desktop.
#!/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 -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
@jeanouii
Copy link

jeanouii commented Feb 2, 2015

$ 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
g+GNqWOXhigFV9ujbZN50J54HDeNZa1L4Bom+HIozqE=

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment