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

Side by Side Diff: components/policy/core/common/cloud/policy_builder.h

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, 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_POLICY_CORE_COMMON_CLOUD_POLICY_BUILDER_H_ 5 #ifndef COMPONENTS_POLICY_CORE_COMMON_CLOUD_POLICY_BUILDER_H_
6 #define COMPONENTS_POLICY_CORE_COMMON_CLOUD_POLICY_BUILDER_H_ 6 #define COMPONENTS_POLICY_CORE_COMMON_CLOUD_POLICY_BUILDER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 enterprise_management::PolicyFetchResponse& policy() { 55 enterprise_management::PolicyFetchResponse& policy() {
56 return policy_; 56 return policy_;
57 } 57 }
58 58
59 scoped_ptr<crypto::RSAPrivateKey> GetSigningKey(); 59 scoped_ptr<crypto::RSAPrivateKey> GetSigningKey();
60 void SetSigningKey(const crypto::RSAPrivateKey& key); 60 void SetSigningKey(const crypto::RSAPrivateKey& key);
61 void SetDefaultSigningKey(); 61 void SetDefaultSigningKey();
62 void UnsetSigningKey(); 62 void UnsetSigningKey();
63 63
64 // Sets the default initial signing key - the resulting policy will be signed
65 // by the default signing key, and will have that key set as the
66 // new_public_key field, as if it were an initial key provision.
67 void SetDefaultInitialSigningKey();
68
64 scoped_ptr<crypto::RSAPrivateKey> GetNewSigningKey(); 69 scoped_ptr<crypto::RSAPrivateKey> GetNewSigningKey();
65 void SetDefaultNewSigningKey(); 70 void SetDefaultNewSigningKey();
66 void UnsetNewSigningKey(); 71 void UnsetNewSigningKey();
67 72
68 // Assembles the policy components. The resulting policy protobuf is available 73 // Assembles the policy components. The resulting policy protobuf is available
69 // through policy() after this call. 74 // through policy() after this call.
70 virtual void Build(); 75 virtual void Build();
71 76
72 // Returns a copy of policy(). 77 // Returns a copy of policy().
73 scoped_ptr<enterprise_management::PolicyFetchResponse> GetCopy(); 78 scoped_ptr<enterprise_management::PolicyFetchResponse> GetCopy();
74 79
75 // Returns a binary policy blob, i.e. an encoded PolicyFetchResponse. 80 // Returns a binary policy blob, i.e. an encoded PolicyFetchResponse.
76 std::string GetBlob(); 81 std::string GetBlob();
77 82
78 // These return hard-coded testing keys. Don't use in production! 83 // These return hard-coded testing keys. Don't use in production!
79 static scoped_ptr<crypto::RSAPrivateKey> CreateTestSigningKey(); 84 static scoped_ptr<crypto::RSAPrivateKey> CreateTestSigningKey();
80 static scoped_ptr<crypto::RSAPrivateKey> CreateTestOtherSigningKey(); 85 static scoped_ptr<crypto::RSAPrivateKey> CreateTestOtherSigningKey();
81 86
87 // Verification signatures for the two hard-coded testing keys above. These
88 // signatures are valid only for the kFakeDomain domain.
89 static std::string GetTestSigningKeySignature();
90 static std::string GetTestOtherSigningKeySignature();
91
82 private: 92 private:
83 // Produces |key|'s signature over |data| and stores it in |signature|. 93 // Produces |key|'s signature over |data| and stores it in |signature|.
84 void SignData(const std::string& data, 94 void SignData(const std::string& data,
85 crypto::RSAPrivateKey* key, 95 crypto::RSAPrivateKey* key,
86 std::string* signature); 96 std::string* signature);
87 97
88 enterprise_management::PolicyFetchResponse policy_; 98 enterprise_management::PolicyFetchResponse policy_;
89 scoped_ptr<enterprise_management::PolicyData> policy_data_; 99 scoped_ptr<enterprise_management::PolicyData> policy_data_;
90 std::string payload_data_; 100 std::string payload_data_;
91 101
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 UserPolicyBuilder; 147 UserPolicyBuilder;
138 148
139 #if !defined(OS_ANDROID) && !defined(OS_IOS) 149 #if !defined(OS_ANDROID) && !defined(OS_IOS)
140 typedef TypedPolicyBuilder<enterprise_management::ExternalPolicyData> 150 typedef TypedPolicyBuilder<enterprise_management::ExternalPolicyData>
141 ComponentPolicyBuilder; 151 ComponentPolicyBuilder;
142 #endif 152 #endif
143 153
144 } // namespace policy 154 } // namespace policy
145 155
146 #endif // COMPONENTS_POLICY_CORE_COMMON_CLOUD_POLICY_BUILDER_H_ 156 #endif // COMPONENTS_POLICY_CORE_COMMON_CLOUD_POLICY_BUILDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698