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

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

WBOY
Release: 2016-06-02 11:00:59
Original
1037 people have browsed it

restphpazure

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

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

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

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

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

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

我是这么使用的

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

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

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template