Skip to content

Commit

Permalink
Merge pull request #529 from YorickPeterse/master
Browse files Browse the repository at this point in the history
Use OpenSSL::Digest where possible.
  • Loading branch information
trevorrowe committed May 15, 2014
2 parents a321827 + 1fca862 commit ee75b78
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/aws/core/signers/version_4.rb
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def body_digest req, chunk_signing
# @param [String] value
# @return [String]
def hexdigest value
digest = Digest::SHA256.new
digest = OpenSSL::Digest::SHA256.new
if value.respond_to?(:read)
chunk = nil
chunk_size = 1024 * 1024 # 1 megabyte
Expand Down
2 changes: 1 addition & 1 deletion lib/aws/core/signers/version_4/chunk_signed_stream.rb
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def sign value
end

def hash value
Digest::SHA256.new.update(value).hexdigest
OpenSSL::Digest::SHA256.new.update(value).hexdigest
end

class << self
Expand Down
6 changes: 3 additions & 3 deletions lib/aws/s3/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def is_xml? possible_xml
end

def md5 str
Base64.encode64(Digest::MD5.digest(str)).strip
Base64.encode64(OpenSSL::Digest::MD5.digest(str)).strip
end

def parse_copy_part_response resp
Expand Down Expand Up @@ -1015,7 +1015,7 @@ def self.object_method(method_name, verb, *args, &block)
# * `:permission` - (String) Logging permissions given to the Grantee
# for the bucket. The bucket owner is automatically granted FULL_CONTROL
# to all logs delivered to the bucket. This optional element enables
# you grant access to others. Valid Values: FULL_CONTROL | READ | WRITE
# you grant access to others. Valid Values: FULL_CONTROL | READ | WRITE
# @return [Core::Response]
bucket_method(:put_bucket_logging, :put) do
configure_request do |req, options|
Expand Down Expand Up @@ -1062,7 +1062,7 @@ def self.object_method(method_name, verb, *args, &block)
xml = xml.doc.root.to_xml
req.body = xml
req.headers['content-md5'] = md5(xml)

super(req, options)

end
Expand Down

0 comments on commit ee75b78

Please sign in to comment.