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

Side by Side Diff: components/policy/core/common/cloud/mock_signing_service.cc

Issue 2276593004: Device registration using an enrollment certificate from the PCA. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed constant. Created 4 years, 3 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
OLDNEW
(Empty)
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "components/policy/core/common/cloud/mock_signing_service.h"
6
7 #include <string>
8
9 #include "components/policy/core/common/cloud/cloud_policy_client.h"
10
11 namespace em = enterprise_management;
12
13 namespace policy {
14
15 const char kSignedDataNonce[] = "+nonce";
16 const char kSignature[] = "fake-signature";
17
18 FakeSigningService::FakeSigningService() {}
19
20 FakeSigningService::~FakeSigningService() {}
21
22 void FakeSigningService::SignRegistrationData(
23 const em::CertificateBasedDeviceRegistrationData* registration_data,
24 em::SignedData* signed_data) {
25 DoSignData(registration_data->SerializeAsString(), signed_data);
26 }
27
28 void FakeSigningService::SignData(const std::string& data,
29 const SigningCallback& callback) {
30 em::SignedData signed_data;
31 if (success_)
32 DoSignData(data, &signed_data);
33 callback.Run(success_, signed_data);
34 }
35
36 void FakeSigningService::DoSignData(const std::string& data,
37 em::SignedData* signed_data) {
38 signed_data->set_data(data + kSignedDataNonce);
39 signed_data->set_signature(kSignature);
40 signed_data->set_extra_data_bytes(sizeof(kSignedDataNonce) - 1);
41 }
42
43 void FakeSigningService::set_success(bool success) {
44 success_ = success;
45 }
46
47 MockSigningService::MockSigningService() {}
48
49 MockSigningService::~MockSigningService() {}
50
51 } // namespace policy
52
OLDNEW
« no previous file with comments | « components/policy/core/common/cloud/mock_signing_service.h ('k') | components/policy/core/common/cloud/signing_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698