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

Unified Diff: components/policy/core/common/cloud/policy_builder.cc

Issue 116273002: Added support for signed policy blobs on desktop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanup from self-review + cros clang fix. Created 6 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: components/policy/core/common/cloud/policy_builder.cc
diff --git a/components/policy/core/common/cloud/policy_builder.cc b/components/policy/core/common/cloud/policy_builder.cc
index 3d000678188c46400bfaf4095c499184edec9d8e..552cedb6e95bb6a037c5f126e236f174f32190d4 100644
--- a/components/policy/core/common/cloud/policy_builder.cc
+++ b/components/policy/core/common/cloud/policy_builder.cc
@@ -144,6 +144,13 @@ void PolicyBuilder::SetDefaultNewSigningKey() {
raw_new_signing_key_.swap(key);
}
+void PolicyBuilder::SetDefaultInitialSigningKey() {
+ std::vector<uint8> key(kSigningKey,
+ kSigningKey + arraysize(kSigningKey));
+ raw_new_signing_key_.swap(key);
+ UnsetSigningKey();
+}
+
void PolicyBuilder::UnsetNewSigningKey() {
raw_new_signing_key_.clear();
}
@@ -169,6 +176,10 @@ void PolicyBuilder::Build() {
policy_.mutable_new_public_key_signature());
}
} else {
+ // No new signing key, so clear the old public key (this allows us to
+ // reuse the same PolicyBuilder to build multiple policy blobs).
+ policy_.clear_new_public_key();
+ policy_.clear_new_public_key_signature();
Mattias Nissler (ping if slow) 2014/01/27 13:52:13 The problem with this code is that it makes the bu
Andrew T Wilson (Slow) 2014/01/30 17:10:31 Yes it can - it can just inject them after calling
Mattias Nissler (ping if slow) 2014/01/31 21:00:34 Note that this will even fail for the code you hav
Andrew T Wilson (Slow) 2014/02/02 11:31:58 Done.
policy_signing_key = GetSigningKey();
}
@@ -205,6 +216,18 @@ scoped_ptr<crypto::RSAPrivateKey> PolicyBuilder::CreateTestOtherSigningKey() {
crypto::RSAPrivateKey::CreateFromPrivateKeyInfo(raw_new_signing_key));
}
+// static
+std::string PolicyBuilder::CreateTestSigningKeySignature() {
Mattias Nissler (ping if slow) 2014/01/27 13:52:13 These should probably be named GetXXX(), given tha
Andrew T Wilson (Slow) 2014/01/30 17:10:31 Done. I named this as CreateXXXX to match CreateTe
+ // TODO(atwilson): Return a real verification signature when one is available.
+ return std::string();
+}
+
+// static
+std::string PolicyBuilder::CreateTestOtherSigningKeySignature() {
+ // TODO(atwilson): Return a real verification signature when one is available.
+ return std::string();
+}
+
void PolicyBuilder::SignData(const std::string& data,
crypto::RSAPrivateKey* key,
std::string* signature) {

Powered by Google App Engine
This is Rietveld 408576698