Sha256: 3cf00f3a42bce3f35bda95dec3a05d521fc6580bd33edb5f058a132a4b6d51a5
Contents?: true
Size: 709 Bytes
Versions: 1
Compression:
Stored size: 709 Bytes
Contents
require 'hmac-sha2' require 'base64' require 'cgi' require 'date' load '../keys.rb' expected_signature="Rfo1hgMnp1urA2CDpi1pxmP6Mu8%2FxgwU0hd2ZEsiUXY%3D" string_to_sign = "GET ecs.amazonaws.com /onca/xml AWSAccessKeyId=AKIAJ5CS7UGGUIDUBLXA&ItemId=0500330220&Operation=ItemLookup&ResponseGroup=ItemAttributes%2CImages%2CEditorialReview&Service=AWSECommerceService%20%20%20&Timestamp=2010-10-07T18%3A38%3A45.000Z" digest = HMAC::SHA256.new(SECRET) << string_to_sign signature = CGI.escape(Base64.encode64(digest.digest()).strip()) puts "expected= " + expected_signature puts "generated= " + signature # how we format dates to create the timestamp d = DateTime.now puts d.strftime('%FT%T.000Z')
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
amzwish-0.0.0 | samples/create_key_sample.rb |