Module: AmazonAuthentication

Defined in:
lib/amazon_authentication.rb

Constant Summary collapse

DIGEST =
OpenSSL::Digest::Digest.new('sha1')

Class Method Summary collapse

Class Method Details

.key(aws_private, date) ⇒ Object


4
5
6
7
8
9
10
11
12
# File 'lib/amazon_authentication.rb', line 4

def self.key(aws_private, date)
  hmac = OpenSSL::HMAC.digest(DIGEST, aws_private, date.to_s)
  # make ruby 1.9 compatible
  if RUBY_VERSION < '1.9'
    b64 = Base64.b64encode(hmac)
  else
    b64 = Base64.encode64(hmac)
  end
end