mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[HP|storage] Fix generate_object_temp_url to use signer that is backward compatible to 1.8.7
This commit is contained in:
parent
8f6f735585
commit
50b0dcbe73
1 changed files with 5 additions and 1 deletions
|
@ -167,7 +167,11 @@ module Fog
|
||||||
encoded_path = "#{path}/#{Fog::HP.escape(container)}/#{Fog::HP.escape(object)}"
|
encoded_path = "#{path}/#{Fog::HP.escape(container)}/#{Fog::HP.escape(object)}"
|
||||||
|
|
||||||
string_to_sign = "#{method}\n#{expires}\n#{sig_path}"
|
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 = @hp_tenant_id.to_s + ":" + @hp_access_key.to_s + ":" + signed_string
|
||||||
signature = Fog::HP.escape(signature)
|
signature = Fog::HP.escape(signature)
|
||||||
|
|
Loading…
Reference in a new issue