I am trying to upload a blob to S3 and specify the ‘Content-MD5‘ header using the .NET API. I would to like to do this so that a) S3 validates the hash, b) Anytime a client downloads the file they will read the ‘Content-MD5‘ header on the blob and validate this on the client side.
Something like this:
PutObjectRequest request = new PutObjectRequest();
request.WithFilePath(fileName)
.WithBucketName(S3_BUCKET_NAME)
.WithKey(fileKey)
.WithTimeout(FIVE_MINUTES)
.WithMD5Digest("ubewX5M7uzz64zskr7FThQ==");
This seems to put the head in the request, and S3 validates the hash properly. The problem is if I view the blob headers afterward they do not content the ‘Content-MD5‘ header so I have no way of having downstream clients validate the file after they download (requirement b) from above).
I have tried other ways to set the header on the blob but none of these worked:
request.AddHeaders(Amazon.S3.Util.AmazonS3Util.CreateHeaderEntry("Content-MD5", "ubewX5M7uzz64zskr7FThQ=="));
request.AddHeader("Content-MD5", "ubewX5M7uzz64zskr7FThQ==");
request.WithMetaData("Content-MD5", "ubewX5M7uzz64zskr7FThQ==");
I even tried to use CloudBerry to update the headers of the blob, but although Cloudberry sent the request to S3 (and did not complain) the blob still did not contain the header.
Any ideas? Is this even possible with S3? There are several ways to do this with AzureBlob storage.
It is not possible without MD5 of any S3 file ?
Note : ETag and Content-MD5 are same.
You can validate your downloadstream with ETAG