| 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 #include "components/policy/core/common/cloud/policy_builder.h" | 5 #include "components/policy/core/common/cloud/policy_builder.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 // Generate signatures if applicable. | 214 // Generate signatures if applicable. |
| 215 std::unique_ptr<crypto::RSAPrivateKey> policy_signing_key = | 215 std::unique_ptr<crypto::RSAPrivateKey> policy_signing_key = |
| 216 GetNewSigningKey(); | 216 GetNewSigningKey(); |
| 217 if (policy_signing_key) { | 217 if (policy_signing_key) { |
| 218 // Add the new public key. | 218 // Add the new public key. |
| 219 std::vector<uint8_t> raw_new_public_signing_key; | 219 std::vector<uint8_t> raw_new_public_signing_key; |
| 220 CHECK(policy_signing_key->ExportPublicKey(&raw_new_public_signing_key)); | 220 CHECK(policy_signing_key->ExportPublicKey(&raw_new_public_signing_key)); |
| 221 policy_.set_new_public_key(raw_new_public_signing_key.data(), | 221 policy_.set_new_public_key(raw_new_public_signing_key.data(), |
| 222 raw_new_public_signing_key.size()); | 222 raw_new_public_signing_key.size()); |
| 223 | 223 |
| 224 policy_.set_new_public_key_verification_signature( | 224 policy_.set_new_public_key_verification_signature_deprecated( |
| 225 raw_new_signing_key_signature_); | 225 raw_new_signing_key_signature_); |
| 226 | 226 |
| 227 // The new public key must be signed by the old key. | 227 // The new public key must be signed by the old key. |
| 228 std::unique_ptr<crypto::RSAPrivateKey> old_signing_key = GetSigningKey(); | 228 std::unique_ptr<crypto::RSAPrivateKey> old_signing_key = GetSigningKey(); |
| 229 if (old_signing_key) { | 229 if (old_signing_key) { |
| 230 SignData(policy_.new_public_key(), | 230 SignData(policy_.new_public_key(), |
| 231 old_signing_key.get(), | 231 old_signing_key.get(), |
| 232 policy_.mutable_new_public_key_signature()); | 232 policy_.mutable_new_public_key_signature()); |
| 233 } | 233 } |
| 234 } else { | 234 } else { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 template<> | 320 template<> |
| 321 TypedPolicyBuilder<em::ExternalPolicyData>::TypedPolicyBuilder() | 321 TypedPolicyBuilder<em::ExternalPolicyData>::TypedPolicyBuilder() |
| 322 : payload_(new em::ExternalPolicyData()) { | 322 : payload_(new em::ExternalPolicyData()) { |
| 323 policy_data().set_policy_type(dm_protocol::kChromeExtensionPolicyType); | 323 policy_data().set_policy_type(dm_protocol::kChromeExtensionPolicyType); |
| 324 } | 324 } |
| 325 | 325 |
| 326 template class TypedPolicyBuilder<em::ExternalPolicyData>; | 326 template class TypedPolicyBuilder<em::ExternalPolicyData>; |
| 327 #endif | 327 #endif |
| 328 | 328 |
| 329 } // namespace policy | 329 } // namespace policy |
| OLD | NEW |