Permalink
Browse files

Merge branch 'modify-sha-version' of git://github.com/mbailey/amazon-…

…ec2 into mbailey
  • Loading branch information...
2 parents d0da8a4 + c1d3fd1 commit 7315bcf19b8cbc0bd4854dca4ef65adfc8f850b5 @grempe committed Nov 21, 2010
Showing with 4 additions and 4 deletions.
  1. +2 −2 lib/AWS.rb
  2. +2 −2 test/test_EC2.rb
View
@@ -93,7 +93,7 @@ def AWS.canonical_string(params, host, method="POST", base="/")
# @param [Boolean] urlencode whether or not to url encode the result., true or false
# @return [String] the signed and encoded string.
def AWS.encode(secret_access_key, str, urlencode=true)
- digest = OpenSSL::Digest::Digest.new('sha1')
+ digest = OpenSSL::Digest::Digest.new('sha256')
b64_hmac =
Base64.encode64(
OpenSSL::HMAC.digest(digest, secret_access_key, str)).gsub("\n","")
@@ -278,7 +278,7 @@ def make_request(action, params, data='')
params.merge!( {"Action" => action,
"SignatureVersion" => "2",
- "SignatureMethod" => 'HmacSHA1',
+ "SignatureMethod" => 'HmacSHA256',
"AWSAccessKeyId" => @access_key_id,
"Version" => api_version,
"Timestamp"=>Time.now.getutc.iso8601} )
View
@@ -61,8 +61,8 @@
end
specify "AWS.encode should return the expected string" do
- AWS.encode("secretaccesskey", "foobar123", urlencode=true).should.equal "e3jeuDc3DIX2mW8cVqWiByj4j5g%3D"
- AWS.encode("secretaccesskey", "foobar123", urlencode=false).should.equal "e3jeuDc3DIX2mW8cVqWiByj4j5g="
+ AWS.encode("secretaccesskey", "foobar123", urlencode=true).should.equal "CPzGGhtvlG3P3yp88fPZp0HKouUV8mQK1ZcdFGQeAug%3D"
+ AWS.encode("secretaccesskey", "foobar123", urlencode=false).should.equal "CPzGGhtvlG3P3yp88fPZp0HKouUV8mQK1ZcdFGQeAug="
end
end

0 comments on commit 7315bcf

Please sign in to comment.