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 #ifndef CHROMEOS_DBUS_FAKE_EASY_UNLOCK_CLIENT_H_ | 5 #ifndef CHROMEOS_DBUS_FAKE_EASY_UNLOCK_CLIENT_H_ |
6 #define CHROMEOS_DBUS_FAKE_EASY_UNLOCK_CLIENT_H_ | 6 #define CHROMEOS_DBUS_FAKE_EASY_UNLOCK_CLIENT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "chromeos/dbus/easy_unlock_client.h" | 10 #include "chromeos/dbus/easy_unlock_client.h" |
11 | 11 |
12 namespace chromeos { | 12 namespace chromeos { |
13 | 13 |
14 // A fake implemetation of EasyUnlockClient. | 14 // A fake implemetation of EasyUnlockClient. |
15 class CHROMEOS_EXPORT FakeEasyUnlockClient : public EasyUnlockClient { | 15 class CHROMEOS_EXPORT FakeEasyUnlockClient : public EasyUnlockClient { |
16 public: | 16 public: |
| 17 // Tests if the provided keys belong to the same (fake) EC P256 key pair |
| 18 // generated by |this|. |
| 19 static bool IsEcP256KeyPair(const std::string& private_key, |
| 20 const std::string& public_key); |
| 21 |
17 FakeEasyUnlockClient(); | 22 FakeEasyUnlockClient(); |
18 virtual ~FakeEasyUnlockClient(); | 23 virtual ~FakeEasyUnlockClient(); |
19 | 24 |
20 // EasyUnlockClient overrides | 25 // EasyUnlockClient overrides |
21 virtual void Init(dbus::Bus* bus) OVERRIDE; | 26 virtual void Init(dbus::Bus* bus) OVERRIDE; |
22 virtual void GenerateEcP256KeyPair(const KeyPairCallback& callback) OVERRIDE; | 27 virtual void GenerateEcP256KeyPair(const KeyPairCallback& callback) OVERRIDE; |
23 virtual void PerformECDHKeyAgreement(const std::string& private_key, | 28 virtual void PerformECDHKeyAgreement(const std::string& private_key, |
24 const std::string& public_key, | 29 const std::string& public_key, |
25 const DataCallback& callback) OVERRIDE; | 30 const DataCallback& callback) OVERRIDE; |
26 virtual void CreateSecureMessage(const std::string& payload, | 31 virtual void CreateSecureMessage(const std::string& payload, |
27 const std::string& secret_key, | 32 const std::string& key, |
28 const std::string& associated_data, | 33 const std::string& associated_data, |
29 const std::string& public_metadata, | 34 const std::string& public_metadata, |
30 const std::string& verification_key_id, | 35 const std::string& verification_key_id, |
31 const std::string& encryption_type, | 36 const std::string& encryption_type, |
32 const std::string& signature_type, | 37 const std::string& signature_type, |
33 const DataCallback& callback) OVERRIDE; | 38 const DataCallback& callback) OVERRIDE; |
34 virtual void UnwrapSecureMessage(const std::string& message, | 39 virtual void UnwrapSecureMessage(const std::string& message, |
35 const std::string& secret_key, | 40 const std::string& key, |
36 const std::string& associated_data, | 41 const std::string& associated_data, |
37 const std::string& encryption_type, | 42 const std::string& encryption_type, |
38 const std::string& signature_type, | 43 const std::string& signature_type, |
39 const DataCallback& callback) OVERRIDE; | 44 const DataCallback& callback) OVERRIDE; |
40 | 45 |
41 private: | 46 private: |
| 47 int generated_keys_count_; |
| 48 |
42 DISALLOW_COPY_AND_ASSIGN(FakeEasyUnlockClient); | 49 DISALLOW_COPY_AND_ASSIGN(FakeEasyUnlockClient); |
43 }; | 50 }; |
44 | 51 |
45 } // namespace chromeos | 52 } // namespace chromeos |
46 | 53 |
47 #endif // CHROMEOS_DBUS_FAKE_EASY_UNLOCK_CLIENT_H_ | 54 #endif // CHROMEOS_DBUS_FAKE_EASY_UNLOCK_CLIENT_H_ |
OLD | NEW |