Rest 在HTTP请求中找到的MAC签名'';与任何计算签名不同

Rest 在HTTP请求中找到的MAC签名'';与任何计算签名不同,rest,azure-storage-blobs,postman,Rest,Azure Storage Blobs,Postman,我将在Postman中发送以下请求,以从此URL处从Azure Blob存储中检索一个简单的.jpg 使用此AuthenticationErrorDetail: The MAC signature found in the HTTP request '<my access key>' is not the same as any computed signature. Server used following string to sign: 'GET x-ms-date:Tue,

我将在Postman中发送以下请求,以从此URL处从Azure Blob存储中检索一个简单的.jpg

使用此AuthenticationErrorDetail:

The MAC signature found in the HTTP request '<my access key>' is not the same as any computed signature. Server used following string to sign: 'GET x-ms-date:Tue, 26 May 2015 17:35:00 GMT x-ms-version:2014-02-14 /steamo/testcontainer/dog.jpg'.
在HTTP请求“”中找到的MAC签名与任何计算签名不同。服务器使用以下字符串签名:“GET x-ms-date:Tue,2015年5月26日17:35:00 GMT x-ms-version:2014-02-14/steamo/testcontainer/dog.jpg”。

我该如何解决这个问题?如果您需要我提供更多信息,请告诉我。

Azure存储的身份验证不仅仅是提供访问密钥的问题(这不是很安全)。您需要创建一个代表给定请求的签名字符串,使用HMAC-SHA256算法对该字符串进行签名(使用存储密钥进行签名),并将结果编码为base 64。有关完整的详细信息,请参阅,包括如何构造签名字符串。

刚刚开始工作,以下是我的代码:

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 '<my access key>' is not the same as any computed signature. Server used following string to sign: 'GET x-ms-date:Tue, 26 May 2015 17:35:00 GMT x-ms-version:2014-02-14 /steamo/testcontainer/dog.jpg'.
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);
}