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
3// found in the LICENSE file.
4
5#ifndef CHROMEOS_DBUS_FAKE_EASY_UNLOCK_CLIENT_H_
6#define CHROMEOS_DBUS_FAKE_EASY_UNLOCK_CLIENT_H_
7
8#include <string>
9
10#include "chromeos/dbus/easy_unlock_client.h"
11
12namespace chromeos {
13
14// A fake implemetation of EasyUnlockClient.
15class CHROMEOS_EXPORT FakeEasyUnlockClient : public EasyUnlockClient {
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
22  FakeEasyUnlockClient();
23  virtual ~FakeEasyUnlockClient();
24
25  // EasyUnlockClient overrides
26  virtual void Init(dbus::Bus* bus) OVERRIDE;
27  virtual void GenerateEcP256KeyPair(const KeyPairCallback& callback) OVERRIDE;
28  virtual void PerformECDHKeyAgreement(const std::string& private_key,
29                                       const std::string& public_key,
30                                       const DataCallback& callback) OVERRIDE;
31  virtual void CreateSecureMessage(const std::string& payload,
32                                   const CreateSecureMessageOptions& options,
33                                   const DataCallback& callback) OVERRIDE;
34  virtual void UnwrapSecureMessage(const std::string& message,
35                                   const UnwrapSecureMessageOptions& options,
36                                   const DataCallback& callback) OVERRIDE;
37
38 private:
39  int generated_keys_count_;
40
41  DISALLOW_COPY_AND_ASSIGN(FakeEasyUnlockClient);
42};
43
44}  // namespace chromeos
45
46#endif  // CHROMEOS_DBUS_FAKE_EASY_UNLOCK_CLIENT_H_
47