[livecode server] calculating signature for Amazon S3

Martin Koob mkoob at rogers.com
Thu Sep 8 17:40:21 EDT 2011


I am trying to do browser based uploads to amazon S3 buckets from and On-rev
page.   I am having a problem with the signature not matching.   

To make the signature a JSON policy has to be base64 encoded then that has
to be signed with hmacsha1 and which is then base64encoded.

I am using scripts from Mark Smith's bin-crypt library to handle the hmac
sha1 digest from his site
http://marksmith.on-rev.com/revstuff/index.html
the function is hmacsha1.b64()

I have used the same function to create authenticated S3 URLs so I know that
works for that. 

I also did a test from the following tutorial:
http://doc.s3.amazonaws.com/proposals/post.html#Dealing_with_Success

I signed the base64 encoded policy using my handler  and the resulting
string was the same as the one shown.

The problem seems to be with livecode's  base64encode() function.
   
In the tutorial i tried to encode the policy given with the base64encode()
function and the resulting string is the same except for the last character.

Another thing I noticed that the base64 encoded string is wrapped at 72
characters,  could that be throwing it off?  I tried replacing \r and \n
with empty in the string but that did not seem to remove the line wraps.

Thanks in advance for any suggestions.

Martin

--
View this message in context: http://runtime-revolution.278305.n4.nabble.com/livecode-server-calculating-signature-for-Amazon-S3-tp3800217p3800217.html
Sent from the Revolution - User mailing list archive at Nabble.com.




More information about the use-livecode mailing list