| OLD | NEW |
| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 std::string& key, | 98 const std::string& key, |
| 99 const std::string& associated_data, | 99 const std::string& associated_data, |
| 100 const std::string& public_metadata, | 100 const std::string& public_metadata, |
| 101 const std::string& verification_key_id, | 101 const std::string& verification_key_id, |
| 102 const std::string& decryption_key_id, |
| 102 const std::string& encryption_type, | 103 const std::string& encryption_type, |
| 103 const std::string& signature_type, | 104 const std::string& signature_type, |
| 104 const DataCallback& callback) { | 105 const DataCallback& callback) { |
| 105 callback.Run(base::StringPrintf( | 106 callback.Run(base::StringPrintf( |
| 106 "{\"securemessage\": {" | 107 "{\"securemessage\": {" |
| 107 "\"payload\": \"%s\"," | 108 "\"payload\": \"%s\"," |
| 108 "\"key\": \"%s\"," | 109 "\"key\": \"%s\"," |
| 109 "\"associated_data\": \"%s\"," | 110 "\"associated_data\": \"%s\"," |
| 110 "\"public_metadata\": \"%s\"," | 111 "\"public_metadata\": \"%s\"," |
| 111 "\"verification_key_id\": \"%s\"," | 112 "\"verification_key_id\": \"%s\"," |
| 113 "\"decryption_key_id\": \"%s\"," |
| 112 "\"encryption_type\": \"%s\"," | 114 "\"encryption_type\": \"%s\"," |
| 113 "\"signature_type\": \"%s\"" | 115 "\"signature_type\": \"%s\"" |
| 114 "}}", | 116 "}}", |
| 115 payload.c_str(), | 117 payload.c_str(), |
| 116 key.c_str(), | 118 key.c_str(), |
| 117 associated_data.c_str(), | 119 associated_data.c_str(), |
| 118 public_metadata.c_str(), | 120 public_metadata.c_str(), |
| 119 verification_key_id.c_str(), | 121 verification_key_id.c_str(), |
| 122 decryption_key_id.c_str(), |
| 120 encryption_type.c_str(), | 123 encryption_type.c_str(), |
| 121 signature_type.c_str())); | 124 signature_type.c_str())); |
| 122 } | 125 } |
| 123 | 126 |
| 124 void FakeEasyUnlockClient::UnwrapSecureMessage( | 127 void FakeEasyUnlockClient::UnwrapSecureMessage( |
| 125 const std::string& message, | 128 const std::string& message, |
| 126 const std::string& key, | 129 const std::string& key, |
| 127 const std::string& associated_data, | 130 const std::string& associated_data, |
| 128 const std::string& encryption_type, | 131 const std::string& encryption_type, |
| 129 const std::string& signature_type, | 132 const std::string& signature_type, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 140 "\"signature_type\": \"%s\"" | 143 "\"signature_type\": \"%s\"" |
| 141 "}}", | 144 "}}", |
| 142 message.c_str(), | 145 message.c_str(), |
| 143 key.c_str(), | 146 key.c_str(), |
| 144 associated_data.c_str(), | 147 associated_data.c_str(), |
| 145 encryption_type.c_str(), | 148 encryption_type.c_str(), |
| 146 signature_type.c_str())); | 149 signature_type.c_str())); |
| 147 } | 150 } |
| 148 | 151 |
| 149 } // namespace chromeos | 152 } // namespace chromeos |
| OLD | NEW |