What is the execpted result after base64.encode() ?

Jack Wong 1 Reputation point
2022-07-05T04:06:34.677+00:00

Hi all,
I am trying to get file contents from Azure File Storage via REST API with the FileStorage Share Account & Key. I have read the Azure document and tried to create a valid Signature into the API Header, but I have a question about the Base64-decode.

According to Azure document here is how to create the Signature:

Signature=Base64(HMAC-SHA256(UTF8(StringToSign), Base64.decode(<your_azure_storage_account_shared_key>)))

When I try to decode the "your_azure_storage_account_shared_key" with base64, the result look garbled/wrong decode, example as follow:

input:

ABC/er5fghAerthj80+YCmacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacba==

Output:

¿z¾_‚ ®ØcóO˜
fœm§ iÆÚq¶œm§ iÆÚq¶œm§ iÆÚq¶œm§ iÆÚq¶œm§ iÆÚq¶œm

My question is:
The output seems garbled, it is a correct base64.decode result?

Azure Files
Azure Files
An Azure service that offers file shares in the cloud.
1,420 questions
{count} votes

1 answer

Sort by: Most helpful
  1. David Browne - msft 3,851 Reputation points
    2022-07-08T18:25:04.07+00:00

    When you decode a base64 string the result is a byte array. It's not directly displayable as a string. So it's expected that it would look garbled if you tried to display it as a string.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.