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 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
52 policy_data_.reset(); | 52 policy_data_.reset(); |
53 } | 53 } |
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(); |
Mattias Nissler (ping if slow)
2014/01/27 13:52:13
nit: blank line before comment.
Andrew T Wilson (Slow)
2014/01/30 17:10:31
Done.
| |
63 // Sets the default initial signing key - the resulting policy will be signed | |
64 // by the default signing key, and will have that key set as the | |
65 // new_public_key field, as if it were an initial key provision. | |
66 void SetDefaultInitialSigningKey(); | |
63 | 67 |
64 scoped_ptr<crypto::RSAPrivateKey> GetNewSigningKey(); | 68 scoped_ptr<crypto::RSAPrivateKey> GetNewSigningKey(); |
65 void SetDefaultNewSigningKey(); | 69 void SetDefaultNewSigningKey(); |
66 void UnsetNewSigningKey(); | 70 void UnsetNewSigningKey(); |
67 | 71 |
68 // Assembles the policy components. The resulting policy protobuf is available | 72 // Assembles the policy components. The resulting policy protobuf is available |
69 // through policy() after this call. | 73 // through policy() after this call. |
70 virtual void Build(); | 74 virtual void Build(); |
71 | 75 |
72 // Returns a copy of policy(). | 76 // Returns a copy of policy(). |
73 scoped_ptr<enterprise_management::PolicyFetchResponse> GetCopy(); | 77 scoped_ptr<enterprise_management::PolicyFetchResponse> GetCopy(); |
74 | 78 |
75 // Returns a binary policy blob, i.e. an encoded PolicyFetchResponse. | 79 // Returns a binary policy blob, i.e. an encoded PolicyFetchResponse. |
76 std::string GetBlob(); | 80 std::string GetBlob(); |
77 | 81 |
78 // These return hard-coded testing keys. Don't use in production! | 82 // These return hard-coded testing keys. Don't use in production! |
79 static scoped_ptr<crypto::RSAPrivateKey> CreateTestSigningKey(); | 83 static scoped_ptr<crypto::RSAPrivateKey> CreateTestSigningKey(); |
80 static scoped_ptr<crypto::RSAPrivateKey> CreateTestOtherSigningKey(); | 84 static scoped_ptr<crypto::RSAPrivateKey> CreateTestOtherSigningKey(); |
81 | 85 |
86 // Verification signatures for the two hard-coded testing keys above. These | |
87 // signatures are valid only for the kFakeDomain domain. | |
88 static std::string CreateTestSigningKeySignature(); | |
89 static std::string CreateTestOtherSigningKeySignature(); | |
90 | |
82 private: | 91 private: |
83 // Produces |key|'s signature over |data| and stores it in |signature|. | 92 // Produces |key|'s signature over |data| and stores it in |signature|. |
84 void SignData(const std::string& data, | 93 void SignData(const std::string& data, |
85 crypto::RSAPrivateKey* key, | 94 crypto::RSAPrivateKey* key, |
86 std::string* signature); | 95 std::string* signature); |
87 | 96 |
88 enterprise_management::PolicyFetchResponse policy_; | 97 enterprise_management::PolicyFetchResponse policy_; |
89 scoped_ptr<enterprise_management::PolicyData> policy_data_; | 98 scoped_ptr<enterprise_management::PolicyData> policy_data_; |
90 std::string payload_data_; | 99 std::string payload_data_; |
91 | 100 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
137 UserPolicyBuilder; | 146 UserPolicyBuilder; |
138 | 147 |
139 #if !defined(OS_ANDROID) && !defined(OS_IOS) | 148 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
140 typedef TypedPolicyBuilder<enterprise_management::ExternalPolicyData> | 149 typedef TypedPolicyBuilder<enterprise_management::ExternalPolicyData> |
141 ComponentPolicyBuilder; | 150 ComponentPolicyBuilder; |
142 #endif | 151 #endif |
143 | 152 |
144 } // namespace policy | 153 } // namespace policy |
145 | 154 |
146 #endif // COMPONENTS_POLICY_CORE_COMMON_CLOUD_POLICY_BUILDER_H_ | 155 #endif // COMPONENTS_POLICY_CORE_COMMON_CLOUD_POLICY_BUILDER_H_ |
OLD | NEW |