0

I am writing an application using the AWS SDK for C++. I would like to enable integrity checking for S3 transfers, even transfers that require multiple requests due to the size of the file. How can I do this? The documentation for the C++ version of the AWS SDK is scanty.

I scanned the source code to the SDK and found this in AmazonWebServiceRequest:

inline virtual bool ShouldComputeContentMd5() const { return false; }

but it's not clear to me how to get the S3 classes to use an overridden version of this class.

While we're on the subject, I'd rather use the relatively new SHA256 AWS feature instead of MD5, but there seem to be even fewer hooks for that hash algorithm in the C++ SDK.

Can anyone help? Thanks.

Mark R
  • 251
  • 3
  • 12
  • 1
    Forcing Signature Version 4 should force SHA-256, because V4 requires the `x-amz-content-sha256` header and the service will reject corrupted payload. Adding a `Content-MD5` request header with the base64 of the binary md5 of the upload payload will also cause a corrupt upload to fail. I've worked extensively with the APIs directly, but no C++ SDK, but maybe this gives you something to chase down. I would hope that the "disabled" MD5 is overridden to enabled where it's relevant. – Michael - sqlbot Aug 14 '17 at 01:49

1 Answers1

0

S3 has Etag feature. Once an object is uploaded either partially or fully, you can get the Etag from the S3 API Call and Read the Etag from its header.

Below links discusses more on the etags.

What is the algorithm to compute the Amazon-S3 Etag for a file larger than 5GB?

S3 Documentation on ETag Header:

http://docs.aws.amazon.com/AmazonS3/latest/API/RESTCommonResponseHeaders.html

Kannaiyan
  • 12,554
  • 3
  • 44
  • 83