question

Kyoung-5975 avatar image
0 Votes"
Kyoung-5975 asked rogerdpack-7731 published

Verify the value of Content-MD5 in the response of PUT Block List

Hi,
I want to verify the value of Content-MD5 in the response of Put Block List to upload a big file.
In Azure doc, I see the description below.
"This header refers to the content of the request, meaning, in this case, the list of blocks, and not the content of the blob itself."
But, it does not give any hint to calculate my own value and check against the value that I recieved.
Please let me know how to calculate this value.
Thanks in advance !

azure-blob-storage
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Sumarigo-MSFT avatar image
0 Votes"
Sumarigo-MSFT answered Kyoung-5975 commented

@Kyoung-5975 Welcome to Microsoft Q&A, Thank you for posting your query!

The best practice is that you always calculate hash of a downloaded blob and keep it as baseline to compare next time.

As I understand you you are referring: Blobs uploaded by PutBlob will have Content-MD5 calculated by Storage service. But Blobs uploaded PutBlock/PutBlockList won’t have it, and client needs to calculate locally and set it to x-ms-blob-content-md5 Blob property explicitly. When client doesn’t do it, it’s empty. Above recommendation is based on such different cases. Reference: https://technet2.github.io/Wiki/blogs/windowsazurestorage/windows-azure-blob-md5-overview.html

Additional information: Please refer to this GitHub article

Hope this helps!

Kindly let us know if the above helps or you need further assistance on this issue.


Please do not forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.


https://docs.microsoft.com/en-us/rest/api/storageservices/put-blob has a handful of conditions around when MD5 will/won’t be stored.



· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@Sumarigo-MSFT I made my comment to your answer below as an Answer with the details of my issue. I hope you don't miss it.

0 Votes 0 ·
Kyoung-5975 avatar image
0 Votes"
Kyoung-5975 answered Kyoung-5975 commented

Hi,

Thanks for the quick reply !
The link you suggested, Windows Azure Blob MD5 Overview, helped me understand the background concept.

But still there is no answer to my question.
I will explain a little more details of my issue.

I am trying to upload a big file using PutBlock and PutBlockList.
After PutBlock requests are done, I send a request of PutBlockList with the following content in the body.

<BlockList><Latest>TURBd01EQXdNREF3TURBd01EQXdNREF3T01Bd01EQXdNREF3TURBd01EQSUzRA==</Latest><Latest>...</Latest>...<Latest>...</Latest></BlockList>

Then, in the response of PutBlockList, I get the Content-MD5 as below.

HTTP/1.1 201 Created
Content-Length: 0
Content-MD5: 3n1Wn5onWkdA7ogldWIKXA==
Last-Modified: Thu, 23 Mar 2021 18:25:58 GMT
ETag: "0x8D8EFBB9331C89E"
...

My question is how 'Content-MD5: 3n1Wn5onWkdA7ogldWIKXA==' is calculated in the Azure Storage Service.
I really need to calculate and verify this value in my application side, too
This issue is specific to my application. :-)

In the MD5 overview page you mentioned, I see the following.

"In a PutBlockList, the Content-MD5 header would provide transactional integrity for the message contents (the block list in the request body) , while ..."

So, I tried to generate MD5 value with the content in the body of the **PutBlockList" request,
but, I got a different value.
I think there is a specific format / way to calculate the MD5 value.
Please help me generate the same MD5 value.

Thanks !

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

rogerdpack-7731 avatar image
0 Votes"
rogerdpack-7731 answered rogerdpack-7731 published

technet2.github.io/Wiki/blogs/windowsazurestorage/windows-azure-blob-md5-overview.html may be useful, Content-MD5 basically applies to each transfer body itself, good luck!

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.