lib/aws/s3/s3_object.rb in aws-sdk-1.6.6 vs lib/aws/s3/s3_object.rb in aws-sdk-1.6.7
- old
+ new
@@ -1199,11 +1199,11 @@
protected
# @return [Boolean]
def should_decrypt? options
- options[:encryption_key]
+ options[:encryption_key] or config.s3_encryption_key
end
# A small wrapper around client#get_object
def get_object options, &read_block
client.get_object(options, &read_block).data[:data]
@@ -1451,11 +1451,11 @@
config.s3_encryption_materials_location
cipher =
decryption_materials(location) do |envelope_key, envelope_iv|
envelope_key, envelope_iv =
- decode_envelope_key(envelope_key, envelope_iv, options)
+ decode_envelope_key(envelope_key, envelope_iv, encryption_key)
get_aes_cipher(:decrypt, :CBC, envelope_key, envelope_iv)
end
remove_cse_options(options)
@@ -1463,13 +1463,13 @@
end
end
# Decodes the envelope key for decryption
- def decode_envelope_key envelope_key, envelope_iv, options
+ def decode_envelope_key envelope_key, envelope_iv, encryption_key
decrypted_key =
begin
- decrypt(decode64(envelope_key), options[:encryption_key])
+ decrypt(decode64(envelope_key), encryption_key)
rescue RuntimeError
msg = "Master key used to decrypt data key is not correct."
raise AWS::S3::Errors::IncorrectClientSideEncryptionKey, msg
end