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

The multipart upload initiate requested encryption. #1084

Closed
rokka-n opened this issue Feb 6, 2016 · 4 comments
Closed

The multipart upload initiate requested encryption. #1084

rokka-n opened this issue Feb 6, 2016 · 4 comments

Comments

@rokka-n
Copy link

rokka-n commented Feb 6, 2016

Am I doing something stupid?

creds = Aws::SharedCredentials.new(region: 'us-east-1')
s3 = Aws::S3::Resource.new(creds, :region => 'us-east-1')

cipher = OpenSSL::Cipher::AES256.new(:CBC)
key = cipher.random_key
obj = s3.bucket('some-backups').object('key')

obj.upload_file('large.txt', :sse_customer_key => key, :sse_customer_algorithm=>'AES256')

/Library/Ruby/Gems/2.0.0/gems/aws-sdk-resources-2.2.14/lib/aws-sdk-resources/services/s3/multipart_file_uploader.rb:72:in `abort_upload': multipart upload failed: The multipart upload initiate requested encryption. Subsequent part requests must include the appropriate encryption parameters

from aws-sdk-ruby/aws-sdk-resources/lib/aws-sdk-resources/services/s3/multipart_file_uploader.rb:72:in `abort_upload'

It repeats the message for all parts of upload.

@rokka-n
Copy link
Author

rokka-n commented Feb 6, 2016

Hi,

Looks like a bug.

There is a bunch of options missing in the compute_parts method at

Since "part" object is missing some parameters, upload_part fails in cases when key/encryption is required.

Adding this two, for example fixes problem with sse with customer keys.

           sse_customer_key: options[:sse_customer_key],
           sse_customer_algorithm: options[:sse_customer_algorithm]

@awood45
Copy link
Member

awood45 commented Feb 8, 2016

Thanks for the report, will reproduce and investigate.

@trevorrowe
Copy link
Member

Thanks for reporting the issue. I've put together a fix that will work for the SSE CPK options and any other future options by inspecting the API model for S3 to know what options the call accepts. I've also added an integration test to ensure this continues to work.

trevorrowe added a commit that referenced this issue Feb 18, 2016
@rokka-n
Copy link
Author

rokka-n commented Feb 19, 2016

Nice, thank you for fixing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants