EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Specify server side encryption for S3 upload?

Also by EldoS: Callback File System
Create virtual file systems and disks, expose and manage remote data as if they were files on the local disk.
#29679
Posted: 06/04/2014 03:10:49
by Ken Ivanov (EldoS Corp.)

Hi Brennon,

Those parameters are optional. Just set ContentType and ContentDisposition parameters to empty strings and Metadata to null to make the component roll back to their default values.

Ken
#29682
Posted: 06/04/2014 10:12:13
by Brennon Thompson (Basic support level)
Joined: 05/28/2014
Posts: 11

Hi Ken,

I tried passing in String.Empty for the ContentType and ContentDisposition parameters as well as null for the Metadata parameter. I also created an instance of TElStringList and added "x-amz-server-side-encryption" to it with a value of "AES256". Then I passed that instance into WriteObject() as the Headers parameter. The upload works but when I look at the data in the S3 management console, server side encryption hasn't been applied. Also, when I write out the response headers from my TElHTTPSClient object, I don't see "x-amz-server-side-encryption" as I'd expect to. Any other thoughts?

Thanks,
Brennon
#29706
Posted: 06/06/2014 04:09:00
by Ken Ivanov (EldoS Corp.)

Hello Brennon,

Sounds weird. I've just tried to upload an object with the server-side encryption parameter specified, and the encryption has been correctly applied for the object. This is the code I used (simplified):

Code
TElStringList headers = new TElStringList();
headers.Add("x-amz-server-side-encryption: AES256");
storage.WriteObject(bucketName, objName, stream, "", "", null, headers, null);


If the above code doesn't work for you (the object is still shown as unprotected in the AWS management console), could you please check if the x-amz-server-side-encryption header is present at all in the lists returned by OnPreparedHeaders and OnReceivingHeaders events?

Ken
#29707
Posted: 06/06/2014 06:31:32
by Brennon Thompson (Basic support level)
Joined: 05/28/2014
Posts: 11

Hi Ken,

Thanks for the reply. I was adding the x-amz-server-side-encryption header using this overload:

Code
TElStringList.Add(string name, string value)


...instead of...

Code
TElStringList.Add(string name)


When I use the second overload, as you did, it works perfectly. I thought I had tried that before but apparently not! Thank you again for all of your assistance with this problem.

Brennon
#29715
Posted: 06/06/2014 15:14:09
by Ken Ivanov (EldoS Corp.)

Hi Brennon,

Great, we are glad that the things are working for you now. The TElStringList.Add(string name, string value) overload simply redirects the call to TElStringList.Add(string name) by passing the 'name=value' string to it. As it uses the '=' character and not the ':' one, the resulting string does not comply to HTTP header format and thus is ignore by the TElHTTPSClient component.

Thank you for confirming that you've managed to get your code work. Have a nice weekend.

Ken
Also by EldoS: MsgConnect
Cross-platform protocol-independent communication framework for building peer-to-peer and client-server applications and middleware components.

Reply

Statistics

Topic viewed 2310 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!