The MAC signature found in the HTTP request '…' is not the same as any computed signature

前端 未结 2 1285
孤独总比滥情好
孤独总比滥情好 2020-12-31 05:54

I\'m sending the following request in Postman to retrieve a simple .jpg from Azure Blob storage at this URL https://steamo.blob.core.windows.net/testcontainer/dog.jpg

<
2条回答
  •  鱼传尺愫
    2020-12-31 06:46

    Just got this working, here's my code:

    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);
    }
    

提交回复
热议问题