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