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

Unified Diff: content/common/experiments/api_key.h

Issue 1522813002: Add public key and signature verification to browser-side API keys (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@keys
Patch Set: Addressing feedback from PS#12 Created 4 years, 11 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
Index: content/common/experiments/api_key.h
diff --git a/content/common/experiments/api_key.h b/content/common/experiments/api_key.h
index 6b06ea279c070871a45a32312fa53490b9a0a82e..1ad575a15e970c60e9fd237d45d706869d8bda26 100644
--- a/content/common/experiments/api_key.h
+++ b/content/common/experiments/api_key.h
@@ -8,6 +8,7 @@
#include <string>
#include "base/memory/scoped_ptr.h"
+#include "base/strings/string_piece.h"
#include "base/time/time.h"
#include "content/common/content_export.h"
#include "url/gurl.h"
@@ -56,6 +57,11 @@ class CONTENT_EXPORT ApiKey {
bool ValidateOrigin(const std::string& origin) const;
bool ValidateApiName(const std::string& api_name) const;
bool ValidateDate(const base::Time& now) const;
+ bool ValidateSignature(const base::StringPiece& public_key) const;
+
+ static bool ValidateSignature(const std::string& signature_text,
+ const std::string& data,
+ const base::StringPiece& public_key);
private:
ApiKey(const std::string& signature,

Powered by Google App Engine
This is Rietveld 408576698