OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "components/policy/core/common/cloud/user_cloud_policy_store.h" | 5 #include "components/policy/core/common/cloud/user_cloud_policy_store.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 } | 147 } |
148 | 148 |
149 if (!WriteStringToFile(policy_path, data)) | 149 if (!WriteStringToFile(policy_path, data)) |
150 return; | 150 return; |
151 | 151 |
152 if (policy.has_new_public_key()) { | 152 if (policy.has_new_public_key()) { |
153 // Write the new public key and its verification signature/key to a file. | 153 // Write the new public key and its verification signature/key to a file. |
154 em::PolicySigningKey key_info; | 154 em::PolicySigningKey key_info; |
155 key_info.set_signing_key(policy.new_public_key()); | 155 key_info.set_signing_key(policy.new_public_key()); |
156 key_info.set_signing_key_signature( | 156 key_info.set_signing_key_signature( |
157 policy.new_public_key_verification_signature()); | 157 policy.new_public_key_verification_signature_deprecated()); |
158 key_info.set_verification_key(verification_key); | 158 key_info.set_verification_key(verification_key); |
159 std::string key_data; | 159 std::string key_data; |
160 if (!key_info.SerializeToString(&key_data)) { | 160 if (!key_info.SerializeToString(&key_data)) { |
161 DLOG(WARNING) << "Failed to serialize policy signing key"; | 161 DLOG(WARNING) << "Failed to serialize policy signing key"; |
162 return; | 162 return; |
163 } | 163 } |
164 | 164 |
165 WriteStringToFile(key_path, key_data); | 165 WriteStringToFile(key_path, key_data); |
166 } | 166 } |
167 } | 167 } |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 std::move(validator->payload())); | 454 std::move(validator->payload())); |
455 | 455 |
456 // If the key was rotated, update our local cache of the key. | 456 // If the key was rotated, update our local cache of the key. |
457 if (validator->policy()->has_new_public_key()) | 457 if (validator->policy()->has_new_public_key()) |
458 policy_key_ = validator->policy()->new_public_key(); | 458 policy_key_ = validator->policy()->new_public_key(); |
459 status_ = STATUS_OK; | 459 status_ = STATUS_OK; |
460 NotifyStoreLoaded(); | 460 NotifyStoreLoaded(); |
461 } | 461 } |
462 | 462 |
463 } // namespace policy | 463 } // namespace policy |
OLD | NEW |