1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

drop dependency on deprecated ruby-hmac gem, fixes #2034

Ruby 1.8 compiled against OpenSSL 0.9.8 supports SHA256 for some time now.
Ref: https://github.com/ruby/ruby/blob/ruby_1_8_7/ChangeLog#L12025-L12029
This commit is contained in:
Mike Fiedler 2013-12-26 21:44:37 -05:00
parent 60e9268cb4
commit 6d663919b5
2 changed files with 3 additions and 17 deletions

View file

@ -49,7 +49,6 @@ Gem::Specification.new do |s|
s.add_dependency('net-scp', '~>1.1')
s.add_dependency('net-ssh', '>=2.1.3')
s.add_dependency('nokogiri', '~>1.5')
s.add_dependency('ruby-hmac')
## List your development dependencies here. Development dependencies are
## those that are only needed during development

View file

@ -25,22 +25,9 @@ module Fog
end
def setup_sha256
begin
@digest = OpenSSL::Digest.new('sha256')
@signer = lambda do |data|
OpenSSL::HMAC.digest(@digest, @key, data)
end
rescue RuntimeError => error
unless error.message == 'Unsupported digest algorithm (sha256).'
raise error
else
require 'hmac-sha2'
@hmac = ::HMAC::SHA256.new(@key)
@signer = lambda do |data|
@hmac.update(data)
@hmac.digest
end
end
@digest = OpenSSL::Digest.new('sha256')
@signer = lambda do |data|
OpenSSL::HMAC.digest(@digest, @key, data)
end
end