我一直在閱讀:http://www.thebuzzmedia.com/designing-a-secure-rest-api-without-oauth-authentication/使用HMAC保護REST服務
這是一篇非常棒的文章。我在我的思想有一個問題是,這一步(在文章的後半部分):
4. (OPTIONAL) The only way to protect against 「replay attacks」 on your API is to include a timestamp of time kind along with the request so the server can decide if this is an 「old」 request, and deny it. The timestamp must be included into the HMAC generation (effectively stamping a created-on time on the hash) in addition to being checked 「within acceptable bounds」 on the server.
5. [SERVER] Receive all the data from the client.
6. [SERVER] (see OPTIONAL) Compare the current server’s timestamp to the timestamp the client sent. Make sure the difference between the two timestamps it within an acceptable time limit (5-15mins maybe) to hinder replay attacks.
如果時間戳必須發送,這意味着它必須在兩個客戶端上的散列和服務器,所以必須使用相同的確切時間。現在,這意味着我必須以純文本或加密的形式發送日期,可能作爲標題值。它是否正確?因爲如果它很簡單,那麼重放攻擊者不能輕易修改日期到可接受的範圍內(用於驗證目的)......所以我們可以加密日期,但這意味着哈希和加密數據都在使用只是一起加密所有的數據。
我的評估是否正確,或者是否有辦法包含安全的日期?還是必須在這種情況下加密?
謝謝。