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

Side by Side Diff: chromeos/dbus/fake_easy_unlock_client.cc

Issue 577443004: Revert of Minor cleanup in EasyUnlockClient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "base/json/json_string_value_serializer.h" 5 #include "base/json/json_string_value_serializer.h"
6 #include "base/strings/stringprintf.h" 6 #include "base/strings/stringprintf.h"
7 #include "chromeos/dbus/fake_easy_unlock_client.h" 7 #include "chromeos/dbus/fake_easy_unlock_client.h"
8 8
9 namespace { 9 namespace {
10 10
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 // same shared key. To achieve this, identify the created key by sum and 88 // same shared key. To achieve this, identify the created key by sum and
89 // product of the used key pairs. 89 // product of the used key pairs.
90 callback.Run(base::StringPrintf( 90 callback.Run(base::StringPrintf(
91 "{\"secret_key\": [%d, %d]}", 91 "{\"secret_key\": [%d, %d]}",
92 private_key_index + public_key_index, 92 private_key_index + public_key_index,
93 private_key_index * public_key_index)); 93 private_key_index * public_key_index));
94 } 94 }
95 95
96 void FakeEasyUnlockClient::CreateSecureMessage( 96 void FakeEasyUnlockClient::CreateSecureMessage(
97 const std::string& payload, 97 const std::string& payload,
98 const CreateSecureMessageOptions& options, 98 const std::string& key,
99 const std::string& associated_data,
100 const std::string& public_metadata,
101 const std::string& verification_key_id,
102 const std::string& decryption_key_id,
103 const std::string& encryption_type,
104 const std::string& signature_type,
99 const DataCallback& callback) { 105 const DataCallback& callback) {
100 callback.Run(base::StringPrintf( 106 callback.Run(base::StringPrintf(
101 "{\"securemessage\": {" 107 "{\"securemessage\": {"
102 "\"payload\": \"%s\"," 108 "\"payload\": \"%s\","
103 "\"key\": \"%s\"," 109 "\"key\": \"%s\","
104 "\"associated_data\": \"%s\"," 110 "\"associated_data\": \"%s\","
105 "\"public_metadata\": \"%s\"," 111 "\"public_metadata\": \"%s\","
106 "\"verification_key_id\": \"%s\"," 112 "\"verification_key_id\": \"%s\","
107 "\"decryption_key_id\": \"%s\"," 113 "\"decryption_key_id\": \"%s\","
108 "\"encryption_type\": \"%s\"," 114 "\"encryption_type\": \"%s\","
109 "\"signature_type\": \"%s\"" 115 "\"signature_type\": \"%s\""
110 "}}", 116 "}}",
111 payload.c_str(), 117 payload.c_str(),
112 options.key.c_str(), 118 key.c_str(),
113 options.associated_data.c_str(), 119 associated_data.c_str(),
114 options.public_metadata.c_str(), 120 public_metadata.c_str(),
115 options.verification_key_id.c_str(), 121 verification_key_id.c_str(),
116 options.decryption_key_id.c_str(), 122 decryption_key_id.c_str(),
117 options.encryption_type.c_str(), 123 encryption_type.c_str(),
118 options.signature_type.c_str())); 124 signature_type.c_str()));
119 } 125 }
120 126
121 void FakeEasyUnlockClient::UnwrapSecureMessage( 127 void FakeEasyUnlockClient::UnwrapSecureMessage(
122 const std::string& message, 128 const std::string& message,
123 const UnwrapSecureMessageOptions& options, 129 const std::string& key,
130 const std::string& associated_data,
131 const std::string& encryption_type,
132 const std::string& signature_type,
124 const DataCallback& callback) { 133 const DataCallback& callback) {
125 // TODO(tbarzic): Verify that |message| is in the format returned by 134 // TODO(tbarzic): Verify that |message| is in the format returned by
126 // |CreateSecureMessage| and extract payload, metadata and 135 // |CreateSecureMessage| and extract payload, metadata and
127 // verification_key_id from there. 136 // verification_key_id from there.
128 callback.Run(base::StringPrintf( 137 callback.Run(base::StringPrintf(
129 "{\"unwrapped_securemessage\": {" 138 "{\"unwrapped_securemessage\": {"
130 "\"message\": \"%s\"," 139 "\"message\": \"%s\","
131 "\"key\": \"%s\"," 140 "\"key\": \"%s\","
132 "\"associated_data\": \"%s\"," 141 "\"associated_data\": \"%s\","
133 "\"encryption_type\": \"%s\"," 142 "\"encryption_type\": \"%s\","
134 "\"signature_type\": \"%s\"" 143 "\"signature_type\": \"%s\""
135 "}}", 144 "}}",
136 message.c_str(), 145 message.c_str(),
137 options.key.c_str(), 146 key.c_str(),
138 options.associated_data.c_str(), 147 associated_data.c_str(),
139 options.encryption_type.c_str(), 148 encryption_type.c_str(),
140 options.signature_type.c_str())); 149 signature_type.c_str()));
141 } 150 }
142 151
143 } // namespace chromeos 152 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/dbus/fake_easy_unlock_client.h ('k') | chromeos/dbus/fake_easy_unlock_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698