OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef NET_HTTP_MAC_SIGNATURE_H_ |
| 6 #define NET_HTTP_MAC_SIGNATURE_H_ |
| 7 #pragma once |
| 8 |
| 9 #include <string> |
| 10 |
| 11 #include "base/basictypes.h" |
| 12 #include "base/gtest_prod_util.h" |
| 13 #include "crypto/hmac.h" |
| 14 |
| 15 namespace net { |
| 16 |
| 17 class HttpMacSignature { |
| 18 public: |
| 19 HttpMacSignature(); |
| 20 ~HttpMacSignature(); |
| 21 |
| 22 // Returns whether this information is valid. |
| 23 bool AddStateInfo(const std::string& id, |
| 24 const std::string& mac_key, |
| 25 const std::string& mac_algorithm, |
| 26 const std::string& issuer); |
| 27 |
| 28 // Returns whether this information is valid. |
| 29 bool AddHttpInfo(const std::string& method, |
| 30 const std::string& request_uri, |
| 31 const std::string& host, |
| 32 int port); |
| 33 |
| 34 std::string GenerateAuthorizationHeader(); |
| 35 |
| 36 private: |
| 37 FRIEND_TEST_ALL_PREFIXES(HttpMacSignatureTest, GenerateNormalizedRequest); |
| 38 FRIEND_TEST_ALL_PREFIXES(HttpMacSignatureTest, GenerateMAC); |
| 39 |
| 40 std::string GenerateNormalizedRequest(const std::string& timestamp, |
| 41 const std::string& nonce); |
| 42 |
| 43 std::string GenerateMAC(const std::string& timestamp, |
| 44 const std::string& nonce); |
| 45 |
| 46 std::string id_; |
| 47 std::string mac_key_; |
| 48 crypto::HMAC::HashAlgorithm mac_algorithm_; |
| 49 std::string issuer_; |
| 50 |
| 51 std::string method_; |
| 52 std::string request_uri_; |
| 53 std::string host_; |
| 54 std::string port_; |
| 55 // TODO(abarth): body_hash_ |
| 56 |
| 57 DISALLOW_COPY_AND_ASSIGN(HttpMacSignature); |
| 58 }; |
| 59 |
| 60 } // namespace net |
| 61 |
| 62 #endif // NET_HTTP_MAC_SIGNATURE_H_ |
OLD | NEW |