diff --git a/lib/aws/s3/authentication.rb b/lib/aws/s3/authentication.rb index 47089a9..0307c80 100644 --- a/lib/aws/s3/authentication.rb +++ b/lib/aws/s3/authentication.rb @@ -68,7 +68,8 @@ def canonical_string memoized :canonical_string def encoded_canonical - digest = OpenSSL::Digest::Digest.new('sha1') + klass = OpenSSL::Digest.respond_to?(:new) ? OpenSSL::Digest : OpenSSL::Digest::Digest + digest = klass.new('sha1') b64_hmac = [OpenSSL::HMAC.digest(digest, secret_access_key, canonical_string)].pack("m").strip url_encode? ? CGI.escape(b64_hmac) : b64_hmac end