OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/proximity_auth/cryptauth/fake_secure_message_delegate.h" | 5 #include "components/cryptauth/fake_secure_message_delegate.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/md5.h" | 12 #include "base/md5.h" |
13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
14 | 14 |
15 namespace proximity_auth { | 15 namespace cryptauth { |
16 | 16 |
17 namespace { | 17 namespace { |
18 | 18 |
19 const char kKeyPrefix[] = "fake_key_"; | 19 const char kKeyPrefix[] = "fake_key_"; |
20 const char kPrivateKeyPrefix[] = "private_"; | 20 const char kPrivateKeyPrefix[] = "private_"; |
21 | 21 |
22 // Encrypts the |plaintext| with the |key| using the |encryption_scheme| and | 22 // Encrypts the |plaintext| with the |key| using the |encryption_scheme| and |
23 // returns the ciphertext. | 23 // returns the ciphertext. |
24 std::string Encrypt(const std::string& plaintext, | 24 std::string Encrypt(const std::string& plaintext, |
25 const std::string& key, | 25 const std::string& key, |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 } else { | 190 } else { |
191 callback.Run(false, std::string(), securemessage::Header()); | 191 callback.Run(false, std::string(), securemessage::Header()); |
192 } | 192 } |
193 } | 193 } |
194 | 194 |
195 std::string FakeSecureMessageDelegate::GetPrivateKeyForPublicKey( | 195 std::string FakeSecureMessageDelegate::GetPrivateKeyForPublicKey( |
196 const std::string& public_key) { | 196 const std::string& public_key) { |
197 return kPrivateKeyPrefix + public_key; | 197 return kPrivateKeyPrefix + public_key; |
198 } | 198 } |
199 | 199 |
200 } // namespace proximity_auth | 200 } // namespace cryptauth |
OLD | NEW |