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

Unified Diff: content/common/origin_trials/trial_token.cc

Issue 1653263005: [Experimental Framework] Move the trial token public key out of content and into the embedder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase; fix DLL export error in VS compile Created 4 years, 10 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/origin_trials/trial_token.cc
diff --git a/content/common/origin_trials/trial_token.cc b/content/common/origin_trials/trial_token.cc
index 5c64bcbaf1d238eea7d0af7579e80da7abf346d9..8212993205c53a57c3fdbac43a69cf8deddace03 100644
--- a/content/common/origin_trials/trial_token.cc
+++ b/content/common/origin_trials/trial_token.cc
@@ -21,15 +21,6 @@ namespace content {
namespace {
-// This is the default public key used for validating signatures.
-// TODO(iclelland): Move this to the embedder, and provide a mechanism to allow
-// for multiple signing keys. https://crbug.com/543220
-static const uint8_t kPublicKey[] = {
- 0x7c, 0xc4, 0xb8, 0x9a, 0x93, 0xba, 0x6e, 0xe2, 0xd0, 0xfd, 0x03,
- 0x1d, 0xfb, 0x32, 0x66, 0xc7, 0x3b, 0x72, 0xfd, 0x54, 0x3a, 0x07,
- 0x51, 0x14, 0x66, 0xaa, 0x02, 0x53, 0x4e, 0x33, 0xa1, 0x15,
-};
-
const char* kFieldSeparator = "|";
} // namespace
@@ -90,12 +81,11 @@ bool TrialToken::IsAppropriate(const std::string& origin,
return ValidateOrigin(origin) && ValidateFeatureName(feature_name);
}
-bool TrialToken::IsValid(const base::Time& now) const {
+bool TrialToken::IsValid(const base::Time& now,
+ const base::StringPiece& public_key) const {
// TODO(iclelland): Allow for multiple signing keys, and iterate over all
// active keys here. https://crbug.com/543220
chasej 2016/02/05 19:35:28 Nit: This is the wrong bug number (543220 is for s
iclelland 2016/02/05 20:18:09 Thanks! Done.
- return ValidateDate(now) &&
- ValidateSignature(base::StringPiece(
- reinterpret_cast<const char*>(kPublicKey), arraysize(kPublicKey)));
+ return ValidateDate(now) && ValidateSignature(public_key);
}
bool TrialToken::ValidateOrigin(const std::string& origin) const {

Powered by Google App Engine
This is Rietveld 408576698