无法在Azure中创建服务SAS

时间:2019-11-27 10:05:20

标签: azure

我想为Azure中的Blob存储创建服务SAS。参数为:

  • url =(这是从容器属性中获取的URL)
  • sv = 2019-02-02
  • se = 2020-02-02
  • sr = b
  • sp = rw
  • spr = https
  • sig = YDiaihib7 + cRay768bmfri2Z4t / kBhv8uxUGzWw5Dg4 =

使用以下bash脚本计算签名:

    StringToSign="signedversion\nsignedexpiry\nsignedResource\nsignedpermissions\nsignedProtocol"
    echo -e $StringToSign| openssl dgst -sha256 -hmac secret -binary | base64

StringToSign变量的值为:

echo -e $StringToSign
signedversion
signedexpiry
signedResource
signedpermissions
signedProtocol

echo $StringToSign
signedversion\nsignedexpiry\nsignedResource\nsignedpermissions\nsignedProtocol

结果URI为:

URL / backup?sv = 2019-02-02&se = 2020-02-02&sr = b&sp = rw&spr = https&sig = YDiaihib7 + cRay768bmfri2Z4t / kBhv8uxUGzWw5Dg4 =

和响应:

<Error>
<Code>AuthenticationFailed</Code>
<Message>
Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature. RequestId:<...> Time:<...>
</Message>
<AuthenticationErrorDetail>Signature fields not well formed.</AuthenticationErrorDetail>
</Error>

这里出了什么问题?

谢谢!

0 个答案:

没有答案