| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_CHROMEOS_SETTINGS_MOCK_OWNER_KEY_UTIL_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_SETTINGS_MOCK_OWNER_KEY_UTIL_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_SETTINGS_MOCK_OWNER_KEY_UTIL_H_ | 6 #define CHROME_BROWSER_CHROMEOS_SETTINGS_MOCK_OWNER_KEY_UTIL_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "chrome/browser/chromeos/settings/owner_key_util.h" | 14 #include "chrome/browser/chromeos/settings/owner_key_util.h" |
| 15 | 15 |
| 16 namespace chromeos { | 16 namespace chromeos { |
| 17 | 17 |
| 18 class MockOwnerKeyUtil : public OwnerKeyUtil { | 18 class MockOwnerKeyUtil : public OwnerKeyUtil { |
| 19 public: | 19 public: |
| 20 MockOwnerKeyUtil(); | 20 MockOwnerKeyUtil(); |
| 21 | 21 |
| 22 // OwnerKeyUtil: | 22 // OwnerKeyUtil: |
| 23 virtual bool ImportPublicKey(std::vector<uint8>* output) OVERRIDE; | 23 virtual bool ImportPublicKey(std::vector<uint8>* output) OVERRIDE; |
| 24 virtual crypto::RSAPrivateKey* FindPrivateKey( | 24 virtual crypto::RSAPrivateKey* FindPrivateKey( |
| 25 const std::vector<uint8>& key) OVERRIDE; | 25 const std::vector<uint8>& key) OVERRIDE; |
| 26 virtual crypto::RSAPrivateKey* FindPrivateKeyInSlot( |
| 27 const std::vector<uint8>& key, |
| 28 PK11SlotInfo* slot) OVERRIDE; |
| 26 virtual bool IsPublicKeyPresent() OVERRIDE; | 29 virtual bool IsPublicKeyPresent() OVERRIDE; |
| 27 | 30 |
| 28 // Clears the public and private keys. | 31 // Clears the public and private keys. |
| 29 void Clear(); | 32 void Clear(); |
| 30 | 33 |
| 31 // Configures the mock to return the given public key. | 34 // Configures the mock to return the given public key. |
| 32 void SetPublicKey(const std::vector<uint8>& key); | 35 void SetPublicKey(const std::vector<uint8>& key); |
| 33 | 36 |
| 34 // Sets the public key to use from the given private key, but doesn't | 37 // Sets the public key to use from the given private key, but doesn't |
| 35 // configure the private key. | 38 // configure the private key. |
| 36 void SetPublicKeyFromPrivateKey(const crypto::RSAPrivateKey& key); | 39 void SetPublicKeyFromPrivateKey(const crypto::RSAPrivateKey& key); |
| 37 | 40 |
| 38 // Sets the private key (also configures the public key). | 41 // Sets the private key (also configures the public key). |
| 39 void SetPrivateKey(scoped_ptr<crypto::RSAPrivateKey> key); | 42 void SetPrivateKey(scoped_ptr<crypto::RSAPrivateKey> key); |
| 40 | 43 |
| 41 protected: | 44 protected: |
| 42 virtual ~MockOwnerKeyUtil(); | 45 virtual ~MockOwnerKeyUtil(); |
| 43 | 46 |
| 44 private: | 47 private: |
| 45 std::vector<uint8> public_key_; | 48 std::vector<uint8> public_key_; |
| 46 scoped_ptr<crypto::RSAPrivateKey> private_key_; | 49 scoped_ptr<crypto::RSAPrivateKey> private_key_; |
| 47 | 50 |
| 48 DISALLOW_COPY_AND_ASSIGN(MockOwnerKeyUtil); | 51 DISALLOW_COPY_AND_ASSIGN(MockOwnerKeyUtil); |
| 49 }; | 52 }; |
| 50 | 53 |
| 51 } // namespace chromeos | 54 } // namespace chromeos |
| 52 | 55 |
| 53 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_MOCK_OWNER_KEY_UTIL_H_ | 56 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_MOCK_OWNER_KEY_UTIL_H_ |
| OLD | NEW |