Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use OpenSSL::Digest where possible. #529

Merged
merged 1 commit into from
May 15, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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