OLD | NEW |
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 CHROME_BROWSER_POLICY_POLICY_BUILDER_H_ | 5 #ifndef CHROME_BROWSER_POLICY_POLICY_BUILDER_H_ |
6 #define CHROME_BROWSER_POLICY_POLICY_BUILDER_H_ | 6 #define CHROME_BROWSER_POLICY_POLICY_BUILDER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
| 9 #include <vector> |
9 | 10 |
10 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
11 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
12 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
13 #include "chrome/browser/policy/proto/cloud_policy.pb.h" | 14 #include "chrome/browser/policy/proto/cloud_policy.pb.h" |
14 #include "chrome/browser/policy/proto/device_management_local.pb.h" | 15 #include "chrome/browser/policy/proto/device_management_local.pb.h" |
15 #include "crypto/rsa_private_key.h" | 16 #include "crypto/rsa_private_key.h" |
16 | 17 |
17 namespace enterprise_management { | 18 namespace enterprise_management { |
18 class ChromeDeviceSettingsProto; | 19 class ChromeDeviceSettingsProto; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 // Assembles the policy components. The resulting policy protobuf is available | 72 // Assembles the policy components. The resulting policy protobuf is available |
72 // through policy() after this call. | 73 // through policy() after this call. |
73 virtual void Build(); | 74 virtual void Build(); |
74 | 75 |
75 // Returns a copy of policy(). | 76 // Returns a copy of policy(). |
76 scoped_ptr<enterprise_management::PolicyFetchResponse> GetCopy(); | 77 scoped_ptr<enterprise_management::PolicyFetchResponse> GetCopy(); |
77 | 78 |
78 // Returns a binary policy blob, i.e. an encoded PolicyFetchResponse. | 79 // Returns a binary policy blob, i.e. an encoded PolicyFetchResponse. |
79 std::string GetBlob(); | 80 std::string GetBlob(); |
80 | 81 |
| 82 // Writes the public key corresponding to |signing_key_| to |public_key|. |
| 83 void GetPublicKey(std::vector<uint8>* public_key); |
| 84 |
| 85 // Writes the public key corresponding to |new_signing_key_| to |public_key|. |
| 86 void GetNewPublicKey(std::vector<uint8>* public_key); |
| 87 |
81 // These return hard-coded testing keys. Don't use in production! | 88 // These return hard-coded testing keys. Don't use in production! |
82 static scoped_ptr<crypto::RSAPrivateKey> CreateTestSigningKey(); | 89 static scoped_ptr<crypto::RSAPrivateKey> CreateTestSigningKey(); |
83 static scoped_ptr<crypto::RSAPrivateKey> CreateTestNewSigningKey(); | 90 static scoped_ptr<crypto::RSAPrivateKey> CreateTestNewSigningKey(); |
84 | 91 |
85 private: | 92 private: |
86 // Produces |key|'s signature over |data| and stores it in |signature|. | 93 // Produces |key|'s signature over |data| and stores it in |signature|. |
87 void SignData(const std::string& data, | 94 void SignData(const std::string& data, |
88 crypto::RSAPrivateKey* key, | 95 crypto::RSAPrivateKey* key, |
89 std::string* signature); | 96 std::string* signature); |
90 | 97 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 }; | 133 }; |
127 | 134 |
128 typedef TypedPolicyBuilder<enterprise_management::CloudPolicySettings> | 135 typedef TypedPolicyBuilder<enterprise_management::CloudPolicySettings> |
129 UserPolicyBuilder; | 136 UserPolicyBuilder; |
130 typedef TypedPolicyBuilder<enterprise_management::ChromeDeviceSettingsProto> | 137 typedef TypedPolicyBuilder<enterprise_management::ChromeDeviceSettingsProto> |
131 DevicePolicyBuilder; | 138 DevicePolicyBuilder; |
132 | 139 |
133 } // namespace policy | 140 } // namespace policy |
134 | 141 |
135 #endif // CHROME_BROWSER_POLICY_POLICY_BUILDER_H_ | 142 #endif // CHROME_BROWSER_POLICY_POLICY_BUILDER_H_ |
OLD | NEW |