Home >Backend Development >PHP Tutorial >rest-Azure REST API中的Authorization中的头标到底该怎么写——CSDN问答频道

rest-Azure REST API中的Authorization中的头标到底该怎么写——CSDN问答频道

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-02 11:00:591113browse

restphpazure

Authorization中的头标到底该怎么写
官方给出的格式如下

<code>Authorization="[SharedKey|SharedKeyLite] <accountname>:<signature>" </signature></accountname></code>

主要是部分,官方给出的生成方法如下

<code>Signature=Base64(HMAC-SHA256(UTF8(StringToSign)))</code>

如此,在php中,生成HMAC-SHA256的函数是(参考了PHP: hash_hmac -Manual)

<code>hash_hmac ( string $algo , string $data , string $key [, bool $raw_output = false ] )</code>

我是这么使用的

<code>hash_hmac('sha256',$str,'');</code>

那么问题来了,这种函数需要的第三个参数是一个key,不然无法生成结果。这里的key到底要填啥??

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn