在 HTTP 请求“..."中找到的 MAC 签名与任何计算的签名不同 [英] The MAC signature found in the HTTP request '...' is not the same as any computed signature

查看:16
本文介绍了在 HTTP 请求“..."中找到的 MAC 签名与任何计算的签名不同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 Postman 中发送以下请求,以从该 URL https://steamo.blob.core.windows.net/testcontainer/dog.jpg

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

GET /testcontainer/dog.jpg HTTP/1.1
Host: steamo.blob.core.windows.net
Authorization: SharedKey steamo:<my access key>
x-ms-date: Tue, 26 May 2015 17:35:00 GMT
x-ms-version: 2014-02-14
Cache-Control: no-cache
Postman-Token: b1134f8a-1a03-152c-2810-9cb351efb9ce

如果您不熟悉 Postman,它只是一个 REST 客户端 - 可以忽略 Postman-Token 标头.

If you're unfamiliar with Postman it is just a REST client - the Postman-Token header can probably be ignored.

我的访问密钥是从我的 Azure 管理门户复制的.

My access key is copied from my Azure Management Portal.

我收到此错误:

Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature. RequestId:2482503d-0001-0033-60da-9708ed000000 Time:2015-05-26T17:35:41.4577821Z

有了这个 AutheticationErrorDetail:

With this AutheticationErrorDetail:

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'.

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

How do I fix this? Let me know if you need any more info from me.

推荐答案

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

Authentication for Azure Storage is not simply a matter of providing the access key (that is not very secure). You need to create a signature string that represents the given request, sign the string with the HMAC-SHA256 algorithm (using your storage key to sign), and encode the result in base 64. See https://msdn.microsoft.com/en-us/library/azure/dd179428.aspx for full details, including how to construct the signature string.

这篇关于在 HTTP 请求“..."中找到的 MAC 签名与任何计算的签名不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆