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

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: Fix for ios. 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..09c09febd8fe04812d69334641aeafa250b17d17 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();
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::GetTestSigningKeySignature() {
+ // TODO(atwilson): Return a real verification signature when one is available.
+ return std::string();
+}
+
+// static
+std::string PolicyBuilder::GetTestOtherSigningKeySignature() {
+ // 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