<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,3 +1,7 @@
+0.5.7 2009-08-28
+----------------
+* Added support for to sign request using openssl with fallback on ruby-hmac
+
 0.5.6 2009-07-21
 ----------------
 * Update parameter value encoding to support special characters</diff>
      <filename>CHANGELOG</filename>
    </modified>
    <modified>
      <diff>@@ -12,7 +12,7 @@ If in the future, there is a change in REST XML output structure,
 no changes will be required on &lt;tt&gt;amazon-ecs&lt;/tt&gt; library, 
 instead you just need to change the element path.
 
-Version: 0.5.6
+Version: 0.5.7
 
 == INSTALLATION
 </diff>
      <filename>README</filename>
    </modified>
    <modified>
      <diff>@@ -26,6 +26,7 @@ require 'hpricot'
 require 'cgi'
 require 'hmac-sha2'
 require 'base64'
+require 'openssl'
 
 module Amazon
   class RequestError &lt; StandardError; end
@@ -39,6 +40,11 @@ module Amazon
         :fr =&gt; 'http://webservices.amazon.fr/onca/xml?'
     }
     
+    OPENSSL_DIGEST_SUPPORT = OpenSSL::Digest.constants.include?( 'SHA256' ) ||
+                             OpenSSL::Digest.constants.include?( :SHA256 )
+    
+    OPENSSL_DIGEST = OpenSSL::Digest::Digest.new( 'sha256' ) if OPENSSL_DIGEST_SUPPORT
+    
     @@options = {
       :version =&gt; &quot;2009-01-06&quot;,
       :service =&gt; &quot;AWSECommerceService&quot;
@@ -245,10 +251,16 @@ module Amazon
       
       def self.sign_request(url, key)
         return nil if key.nil?
-        signature = URI.escape( Base64.encode64( HMAC::SHA256.digest(key, url) ).strip, Regexp.new(&quot;[+=]&quot;) )
+        
+        if (OPENSSL_DIGEST_SUPPORT)
+          signature = OpenSSL::HMAC.digest(OPENSSL_DIGEST, key, url)
+          signature = [signature].pack('m').chomp
+        else
+          signature = Base64.encode64( HMAC::SHA256.digest(key, url) ).strip
+        end
+        signature = URI.escape(signature, Regexp.new(&quot;[+=]&quot;))
         return signature
       end
-      
   end
 
   # Internal wrapper class to provide convenient method to access Hpricot element value.</diff>
      <filename>lib/amazon/ecs.rb</filename>
    </modified>
    <modified>
      <diff>@@ -2,8 +2,8 @@ require File.dirname(__FILE__) + '/../test_helper'
 
 class Amazon::EcsTest &lt; Test::Unit::TestCase
 
-  AWS_ACCESS_KEY_ID = ''
-  AWS_SECRET_KEY = ''
+  AWS_ACCESS_KEY_ID = '0XQXXC6YV2C85DX1BF02'
+  AWS_SECRET_KEY = 'fwLOn0Y/IUXEM8Hk49o7QJV+ryOscbhXRb6CmA5l'
   
   raise &quot;Please specify set your AWS_ACCESS_KEY_ID&quot; if AWS_ACCESS_KEY_ID.empty?
   raise &quot;Please specify set your AWS_SECRET_KEY&quot; if AWS_SECRET_KEY.empty?
@@ -16,108 +16,111 @@ class Amazon::EcsTest &lt; Test::Unit::TestCase
 
   ## Test item_search
   def test_item_search
-     resp = Amazon::Ecs.item_search('ruby')
-     
-     assert(resp.is_valid_request?)
-     assert(resp.total_results &gt;= 3600)
-     assert(resp.total_pages &gt;= 360)
-     
-     signature_elements = (resp.doc/&quot;arguments/argument&quot;).select {|ele| ele.attributes['name'] == 'Signature' }.length
-     assert(signature_elements == 1)
-   end
-   
-   def test_item_search_with_special_characters
-     Amazon::Ecs.debug = true
-     resp = Amazon::Ecs.item_search('()*&amp;^%$')
-     assert(resp.is_valid_request?)
-   end
- 
-   def test_item_search_with_paging
-     resp = Amazon::Ecs.item_search('ruby', :item_page =&gt; 2)
-     assert resp.is_valid_request?
-     assert 2, resp.item_page
-   end
- 
-   def test_item_search_with_invalid_request
-     resp = Amazon::Ecs.item_search(nil)
-     assert !resp.is_valid_request?
-   end
- 
-   def test_item_search_with_no_result
-     resp = Amazon::Ecs.item_search('afdsafds')
-     
-     assert resp.is_valid_request?
-     assert_equal &quot;We did not find any matches for your request.&quot;, 
-       resp.error
-   end
-   
-   def test_item_search_uk
-     resp = Amazon::Ecs.item_search('ruby', :country =&gt; :uk)
-     assert resp.is_valid_request?
-   end
+    resp = Amazon::Ecs.item_search('ruby')
+    
+    assert(resp.is_valid_request?)
+    assert(resp.total_results &gt;= 3600)
+    assert(resp.total_pages &gt;= 360)
+    
+    signature_elements = (resp.doc/&quot;arguments/argument&quot;).select do |ele| 
+      ele.attributes['name'] == 'Signature' || ele.attributes['Name'] == 'Signature'
+    end.length
+    
+    assert(signature_elements == 1)
+  end
+      
+  def test_item_search_with_special_characters
+    Amazon::Ecs.debug = true
+    resp = Amazon::Ecs.item_search('()*&amp;^%$')
+    assert(resp.is_valid_request?)
+  end
    
-   def test_item_search_by_author
-     resp = Amazon::Ecs.item_search('dave', :type =&gt; :author)
-     assert resp.is_valid_request?
-   end
+  def test_item_search_with_paging
+    resp = Amazon::Ecs.item_search('ruby', :item_page =&gt; 2)
+    assert resp.is_valid_request?
+    assert 2, resp.item_page
+  end
    
-   def test_item_get
-     resp = Amazon::Ecs.item_search(&quot;0974514055&quot;)
-     item = resp.first_item
-         
-     # test get
-     assert_equal &quot;Programming Ruby: The Pragmatic Programmers' Guide, Second Edition&quot;, 
-       item.get(&quot;itemattributes/title&quot;)
-       
-     # test get_array
-     assert_equal ['Dave Thomas', 'Chad Fowler', 'Andy Hunt'], 
-       item.get_array(&quot;author&quot;)
- 
-     # test get_hash
-     small_image = item.get_hash(&quot;smallimage&quot;)
-     
-     assert_equal 3, small_image.keys.size
-     assert_match &quot;.jpg&quot;, small_image[:url]
-     assert_equal &quot;75&quot;, small_image[:height]
-     assert_equal &quot;59&quot;, small_image[:width]
-     
-     # test /
-     reviews = item/&quot;editorialreview&quot;
- reviews.each do |review|
-   # returns unescaped HTML content, Hpricot escapes all text values
-   assert Amazon::Element.get_unescaped(review, 'source')
-   assert Amazon::Element.get_unescaped(review, 'content')
- end
-   end
+  def test_item_search_with_invalid_request
+    resp = Amazon::Ecs.item_search(nil)
+    assert !resp.is_valid_request?
+  end
    
-   ## Test item_lookup
-   def test_item_lookup
-     resp = Amazon::Ecs.item_lookup('0974514055')
-     assert_equal &quot;Programming Ruby: The Pragmatic Programmers' Guide, Second Edition&quot;, 
-     resp.first_item.get(&quot;itemattributes/title&quot;)
-   end
+  def test_item_search_with_no_result
+    resp = Amazon::Ecs.item_search('afdsafds')
+    
+    assert resp.is_valid_request?
+    assert_equal &quot;We did not find any matches for your request.&quot;, 
+      resp.error
+  end
+  
+  def test_item_search_uk
+    resp = Amazon::Ecs.item_search('ruby', :country =&gt; :uk)
+    assert resp.is_valid_request?
+  end
+  
+  def test_item_search_by_author
+    resp = Amazon::Ecs.item_search('dave', :type =&gt; :author)
+    assert resp.is_valid_request?
+  end
+  
+  def test_item_get
+    resp = Amazon::Ecs.item_search(&quot;0974514055&quot;)
+    item = resp.first_item
+        
+    # test get
+    assert_equal &quot;Programming Ruby: The Pragmatic Programmers' Guide, Second Edition&quot;, 
+      item.get(&quot;itemattributes/title&quot;)
+      
+    # test get_array
+    assert_equal ['Dave Thomas', 'Chad Fowler', 'Andy Hunt'], 
+      item.get_array(&quot;author&quot;)
    
-   def test_item_lookup_with_invalid_request
-     resp = Amazon::Ecs.item_lookup(nil)
-     assert resp.has_error?
-     assert resp.error
-   end
- 
-   def test_item_lookup_with_no_result
-     resp = Amazon::Ecs.item_lookup('abc')
-     
-     assert resp.is_valid_request?
-     assert_match(/ABC is not a valid value for ItemId/, resp.error)
-   end  
+    # test get_hash
+    small_image = item.get_hash(&quot;smallimage&quot;)
+    
+    assert_equal 3, small_image.keys.size
+    assert_match &quot;.jpg&quot;, small_image[:url]
+    assert_equal &quot;75&quot;, small_image[:height]
+    assert_equal &quot;59&quot;, small_image[:width]
+    
+    # test /
+    reviews = item/&quot;editorialreview&quot;
+    reviews.each do |review|
+      # returns unescaped HTML content, Hpricot escapes all text values
+      assert Amazon::Element.get_unescaped(review, 'source')
+      assert Amazon::Element.get_unescaped(review, 'content')
+    end
+  end
+  
+  ## Test item_lookup
+  def test_item_lookup
+    resp = Amazon::Ecs.item_lookup('0974514055')
+    assert_equal &quot;Programming Ruby: The Pragmatic Programmers' Guide, Second Edition&quot;, 
+    resp.first_item.get(&quot;itemattributes/title&quot;)
+  end
+  
+  def test_item_lookup_with_invalid_request
+    resp = Amazon::Ecs.item_lookup(nil)
+    assert resp.has_error?
+    assert resp.error
+  end
    
-   def test_search_and_convert
-     resp = Amazon::Ecs.item_lookup('0974514055')
-     title = resp.first_item.get(&quot;itemattributes/title&quot;)
-     authors = resp.first_item.search_and_convert(&quot;author&quot;)
-     
-     assert_equal &quot;Programming Ruby: The Pragmatic Programmers' Guide, Second Edition&quot;, title
-     assert authors.is_a?(Array)
-     assert 3, authors.size
-     assert_equal &quot;Dave Thomas&quot;, authors.first.get
-   end  
-end
\ No newline at end of file
+  def test_item_lookup_with_no_result
+    resp = Amazon::Ecs.item_lookup('abc')
+    
+    assert resp.is_valid_request?
+    assert_match(/ABC is not a valid value for ItemId/, resp.error)
+  end  
+  
+  def test_search_and_convert
+    resp = Amazon::Ecs.item_lookup('0974514055')
+    title = resp.first_item.get(&quot;itemattributes/title&quot;)
+    authors = resp.first_item.search_and_convert(&quot;author&quot;)
+    
+    assert_equal &quot;Programming Ruby: The Pragmatic Programmers' Guide, Second Edition&quot;, title
+    assert authors.is_a?(Array)
+    assert 3, authors.size
+    assert_equal &quot;Dave Thomas&quot;, authors.first.get
+  end  
+end</diff>
      <filename>test/amazon/ecs_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>5e90c399f211a3ed18a74dd95e21a5e640f27589</id>
    </parent>
  </parents>
  <author>
    <name>Herryanto Siatono</name>
    <email>hsiatono@wideanother-lm.(none)</email>
  </author>
  <url>http://github.com/jugend/amazon-ecs/commit/5385c86070415139811f13aabdd0d8cff2678c9e</url>
  <id>5385c86070415139811f13aabdd0d8cff2678c9e</id>
  <committed-date>2009-08-27T09:05:37-07:00</committed-date>
  <authored-date>2009-08-27T09:05:37-07:00</authored-date>
  <message>Add support to sign request with openssl with fallback on ruby-hmac</message>
  <tree>235ceb34849a4f9c18aef61a334b5e4fb9903dd2</tree>
  <committer>
    <name>Herryanto Siatono</name>
    <email>hsiatono@wideanother-lm.(none)</email>
  </committer>
</commit>
