Skip to content
This repository has been archived by the owner on Apr 21, 2020. It is now read-only.

Commit

Permalink
Switch bash client to do hmac256.
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanbreen committed Sep 25, 2015
1 parent 0ca3b22 commit 48106a8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions test/clients/bash/client.sh
Expand Up @@ -5,9 +5,9 @@ CONSUMER_SECRET=`cat ../../keys/8008/8080/$CONSUMER_KEY`\&
TIME=$(($(date +'%s * 1000 + %-N / 1000000')))
NONCE=$(date +%s | shasum | base64 | head -c 32 ; echo)

TO_SIGN="GET&http%3A%2F%2Flocalhost%3A8008%2Fjob%2F12345&oauth_consumer_key%3D$CONSUMER_KEY%26oauth_nonce%3D$NONCE%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D$TIME%26oauth_version%3D1.0"
TO_SIGN="GET&http%3A%2F%2Flocalhost%3A8008%2Fjob%2F12345&oauth_consumer_key%3D$CONSUMER_KEY%26oauth_nonce%3D$NONCE%26oauth_signature_method%3DHMAC-SHA256%26oauth_timestamp%3D$TIME%26oauth_version%3D1.0"

SIGNATURE=`echo -n $TO_SIGN | openssl sha1 -hmac "$CONSUMER_SECRET" -binary | base64`
SIGNATURE=`echo -n $TO_SIGN | openssl dgst -sha256 -hmac "$CONSUMER_SECRET" -binary | base64`

#curl -v -G --data-urlencode "oauth_consumer_key=$CONSUMER_KEY" --data-urlencode "oauth_nonce=$NONCE" --data-urlencode "oauth_signature_method=HMAC-SHA1" --data-urlencode "oauth_signature=$SIGNATURE" --data-urlencode "oauth_version=1.0" --data-urlencode "oauth_timestamp=$TIME" http://localhost:8000/job
curl --silent -G --data-urlencode "oauth_consumer_key=$CONSUMER_KEY" --data-urlencode "oauth_nonce=$NONCE" --data-urlencode "oauth_signature_method=HMAC-SHA1" --data-urlencode "oauth_signature=$SIGNATURE" --data-urlencode "oauth_version=1.0" --data-urlencode "oauth_timestamp=$TIME" http://localhost:8008/job/12345
curl --silent -G --data-urlencode "oauth_consumer_key=$CONSUMER_KEY" --data-urlencode "oauth_nonce=$NONCE" --data-urlencode "oauth_signature_method=HMAC-SHA256" --data-urlencode "oauth_signature=$SIGNATURE" --data-urlencode "oauth_version=1.0" --data-urlencode "oauth_timestamp=$TIME" http://localhost:8008/job/12345
2 changes: 1 addition & 1 deletion test/clients/perl/client.pl
Expand Up @@ -20,7 +20,7 @@
consumer_secret => $consumer_secret,
request_url => url(),
request_method => 'GET',
signature_method => 'HMAC-SHA1',
signature_method => 'HMAC-SHA256',
timestamp => time,
nonce => nonce(),
);
Expand Down

0 comments on commit 48106a8

Please sign in to comment.