hi,您好
今天下午看到你的文章 并且看了那片英文文章和英文文章里面的一些参考资料
我这里有些疑问
我还不清楚你所说的唯一性是指什么?
客户端发送的HMAC是动态的是变的,不仅仅第一次发送服务端需要记录以后作为一个凭证。同样的是只要在有效的时间内请求相同的http都很得到服务器的相应,这一点只能通过时间范围来控制重复请求。
HMAC他也是一个hash算法,目前md5等是可以破解的HMAC不仅仅是由hash所决定的 他还是由私钥决定。HMAC = H( K XOR opad, H(K XOR ipad, text)) 。
在v1.0中使用的md5算法 md5(uri+key)的方式 在v2.0中改进了算法机制。
还有因为在1.0存在安全漏洞 就是 key=value 和 keyvalu=e是成立的 ,目前版本也做了改进。
非常希望能和你交流 学习,我只是一个初学者。wfwq2008gmail.com 谢谢
并且我看了一下AWS的phpsdk的实现方式,下面是HMAC在PHP的中的实现
// client $hash = hash_hmac('ripemd160', $xml.$time.$clientId, 'secret'); Then say I am submitting the following array of data via POST. Code: Array ( [xml] => '<request>Some XML Data Here</request>' [expires] => 'Unix Timestamp?' [clientId] => '12345' [hash] = > 'b8e7ae12510bdfb1812e463a7f086122cf37e4f7' )
|
//On the server side I would then do something along the lines of the following PHP Code: $key = lookupSecret($_POST['clientId']); $hash = hash_hmac('ripemd160', $_POST['xml'].$_POST['time'].$_POST['clientId'], $key); if($hash === $_POST['hash']){ // proceed } else { sendResponse(401,'Unauthorized'); }
|
Designing a Secure REST (Web) API without OAuth
http://www.thebuzzmedia.com/designing-a-secure-rest-api-without-oauth-authentication/RFC 2104 - HMAC: Keyed-Hashing for Message Authentication
http://www.faqs.org/rfcs/rfc2104.html
Making Secure Requests to Amazon Web Services
http://aws.amazon.com/articles/1928
AWS signature version 1 is insecure
http://www.daemonology.net/blog/2008-12.html
[该贴被Breezedon于2011-04-29 19:08修改过]