on-rev upload limits and Amazon S3 as an alternative

Martin Koob mkoob at rogers.com
Fri Jan 28 15:14:14 CST 2011


Hi Andre

I have tried to combine a suggested bit of code from you to do HMACSHA1 and
some of the handlers from Marksmith's LibS3.  It generates a signature but
it is not accepted by AmazonS#.   It gives the error:
"SignatureDoesNotMatchThe request signature we calculated does not match the
signature you provided. Check your key and signing method."


in a file called s3auth.irev i put the following
_______________________________________
##From Andre Garzia
function _oauthHMACSHA1 pContent, pPassword
   put tempname() into tFile
   put pContent into url ("binfile:" & tFile)
   put format("cat %s | openssl dgst -sha1 -hmac %s", tFile, pPassword) into
tCMD
   get shell(tCMD)
   delete file tFile
   return it 
end _oauthHMACSHA1

##adapted from Mark Smith's LibS3 
## - I replaced  his hmacSha1.b64 handler to Andre Garzia's _oauthHMACSHA1
handler
##AWS_SK is the AWS secret key which is set earlier
function makeQauth pBucket, pObject, pExpiry
   put makeObject(pBucket, pObject) into tObject
   put "GET" & cr & cr & cr & pExpiry & cr & tObject into stringToSign
   return urlencode(_oauthHMACSHA1(stringToSign, AWS_SK))
end makeQauth

##from Mark Smith's LibS3
##AWS_AK is the AWS access key which is set earlier
function s3.timeLimitURL pBucket, pObject, pExpiry
  put "http://" & pBucket & ".s3.amazonaws.com/" & pObject &
"?AWSAccessKeyId=" & AWS_AK into tUrl
  put "&Expires=" & pExpiry & "&Signature=" & makeQauth(pBucket, pObject,
pExpiry) after tUrl
  return tUrl
end s3.timeLimitURL
____________________


in another file 's3getfile.irev' I include the 's3auth.irev' file and call
the s.3timeLimitURL function
__________________________
put the seconds + (60 * 15) into tExpiry --15 minutes
put "avlicces" into tBucket
put "testmovie.m4v" into tObject
put s3.timeLimitURL(tBucket, tObject, tExpiry) into tFileURL
________________________

the tFileURL has all the elements it should have but the signature appears
longer than the one generated by Mark Smith's sample S3 application.

Any ideas why the signature does not get generated correctly by the
FrankenCode I have thrown together?

Thanks

Martin
-- 
View this message in context: http://runtime-revolution.278305.n4.nabble.com/on-rev-upload-limits-and-Amazon-S3-as-an-alternative-tp3244672p3245411.html
Sent from the Revolution - User mailing list archive at Nabble.com.



More information about the use-livecode mailing list