diff --git a/lib/fog/hp/storage.rb b/lib/fog/hp/storage.rb index 7ace87205..b42466500 100644 --- a/lib/fog/hp/storage.rb +++ b/lib/fog/hp/storage.rb @@ -167,7 +167,11 @@ module Fog encoded_path = "#{path}/#{Fog::HP.escape(container)}/#{Fog::HP.escape(object)}" string_to_sign = "#{method}\n#{expires}\n#{sig_path}" - signed_string = Digest::HMAC.hexdigest(string_to_sign, @hp_secret_key, Digest::SHA1) + # Only works with 1.9+ Not compatible with 1.8.7 + #signed_string = Digest::HMAC.hexdigest(string_to_sign, @hp_secret_key, Digest::SHA1) + # Compatible with 1.8.7 onwards + hmac = OpenSSL::HMAC.new(@hp_secret_key, OpenSSL::Digest::SHA1.new) + signed_string = hmac.update(string_to_sign).hexdigest signature = @hp_tenant_id.to_s + ":" + @hp_access_key.to_s + ":" + signed_string signature = Fog::HP.escape(signature)