We are trying to access the blobs from azure blob storage without using the Azure SDK,
we are trying to access through the shared key by Azure REST API, for that we need to generate the Authorization header, but when I try to create a signature from the Access key I am getting the following error
"Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature."
"The MAC signature found in the HTTP request 'key hash' is not the same as any computed signature"
Need help to generate proper authorization header, we have followed the documentation
https://docs.microsoft.com/en-us/rest/api/storageservices/authorize-with-shared-key
We have tried in postman as well, and we are getting the same error.
string signWithAccountKey(string stringToSign, string accountKey)
{
var hmacsha = new System.Security.Cryptography.HMACSHA256();
hmacsha.Key = Convert.FromBase64String(accountKey);
var signature = hmacsha.ComputeHash(Encoding.UTF8.GetBytes(stringToSign));
return Convert.ToBase64String(signature);
}
The MAC signature found in the HTTP request 'key hash' is not the same as any computed signature
stringToSign
. – Gaurav Mantri