Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1799)

Unified Diff: net/http/http_mac_signature.h

Issue 6901121: MAC Cookies (patch 2 of N) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/http/http_mac_signature.cc » ('j') | net/http/http_mac_signature.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_mac_signature.h
===================================================================
--- net/http/http_mac_signature.h (revision 0)
+++ net/http/http_mac_signature.h (revision 0)
@@ -0,0 +1,62 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef NET_HTTP_MAC_SIGNATURE_H_
+#define NET_HTTP_MAC_SIGNATURE_H_
+#pragma once
+
+#include <string>
+
+#include "base/basictypes.h"
+#include "base/gtest_prod_util.h"
+#include "crypto/hmac.h"
+
+namespace net {
+
+class HttpMacSignature {
+ public:
+ HttpMacSignature();
+ ~HttpMacSignature();
+
+ // Returns whether this information is valid.
+ bool AddStateInfo(const std::string& id,
+ const std::string& mac_key,
+ const std::string& mac_algorithm,
+ const std::string& issuer);
+
+ // Returns whether this information is valid.
+ bool AddHttpInfo(const std::string& method,
+ const std::string& request_uri,
+ const std::string& host,
+ int port);
+
+ std::string GenerateAuthorizationHeader();
+
+ private:
+ FRIEND_TEST_ALL_PREFIXES(HttpMacSignatureTest, GenerateNormalizedRequest);
+ FRIEND_TEST_ALL_PREFIXES(HttpMacSignatureTest, GenerateMAC);
+
+ std::string GenerateNormalizedRequest(const std::string& timestamp,
+ const std::string& nonce);
+
+ std::string GenerateMAC(const std::string& timestamp,
+ const std::string& nonce);
+
+ std::string id_;
+ std::string mac_key_;
+ crypto::HMAC::HashAlgorithm mac_algorithm_;
+ std::string issuer_;
+
+ std::string method_;
+ std::string request_uri_;
+ std::string host_;
+ std::string port_;
+ // TODO(abarth): body_hash_
+
+ DISALLOW_COPY_AND_ASSIGN(HttpMacSignature);
+};
+
+} // namespace net
+
+#endif // NET_HTTP_MAC_SIGNATURE_H_
Property changes on: net/http/http_mac_signature.h
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « no previous file | net/http/http_mac_signature.cc » ('j') | net/http/http_mac_signature.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698