| 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 COMPONENTS_OWNERSHIP_MOCK_OWNER_KEY_UTIL_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_SETTINGS_MOCK_OWNER_KEY_UTIL_H_ | 6 #define COMPONENTS_OWNERSHIP_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 "components/ownership/owner_key_util.h" |
| 15 #include "components/ownership/ownership_export.h" |
| 15 | 16 |
| 16 namespace chromeos { | 17 namespace ownership { |
| 17 | 18 |
| 18 class MockOwnerKeyUtil : public OwnerKeyUtil { | 19 class OWNERSHIP_EXPORT MockOwnerKeyUtil : public OwnerKeyUtil { |
| 19 public: | 20 public: |
| 20 MockOwnerKeyUtil(); | 21 MockOwnerKeyUtil(); |
| 21 | 22 |
| 22 // OwnerKeyUtil: | 23 // OwnerKeyUtil: |
| 23 virtual bool ImportPublicKey(std::vector<uint8>* output) OVERRIDE; | 24 virtual bool ImportPublicKey(std::vector<uint8>* output) OVERRIDE; |
| 25 #if defined(USE_NSS) |
| 24 virtual crypto::RSAPrivateKey* FindPrivateKeyInSlot( | 26 virtual crypto::RSAPrivateKey* FindPrivateKeyInSlot( |
| 25 const std::vector<uint8>& key, | 27 const std::vector<uint8>& key, |
| 26 PK11SlotInfo* slot) OVERRIDE; | 28 PK11SlotInfo* slot) OVERRIDE; |
| 29 #endif // defined(USE_NSS) |
| 27 virtual bool IsPublicKeyPresent() OVERRIDE; | 30 virtual bool IsPublicKeyPresent() OVERRIDE; |
| 28 | 31 |
| 29 // Clears the public and private keys. | 32 // Clears the public and private keys. |
| 30 void Clear(); | 33 void Clear(); |
| 31 | 34 |
| 32 // Configures the mock to return the given public key. | 35 // Configures the mock to return the given public key. |
| 33 void SetPublicKey(const std::vector<uint8>& key); | 36 void SetPublicKey(const std::vector<uint8>& key); |
| 34 | 37 |
| 35 // Sets the public key to use from the given private key, but doesn't | 38 // Sets the public key to use from the given private key, but doesn't |
| 36 // configure the private key. | 39 // configure the private key. |
| 37 void SetPublicKeyFromPrivateKey(const crypto::RSAPrivateKey& key); | 40 void SetPublicKeyFromPrivateKey(const crypto::RSAPrivateKey& key); |
| 38 | 41 |
| 39 // Sets the private key (also configures the public key). | 42 // Sets the private key (also configures the public key). |
| 40 void SetPrivateKey(scoped_ptr<crypto::RSAPrivateKey> key); | 43 void SetPrivateKey(scoped_ptr<crypto::RSAPrivateKey> key); |
| 41 | 44 |
| 42 protected: | 45 protected: |
| 43 virtual ~MockOwnerKeyUtil(); | 46 virtual ~MockOwnerKeyUtil(); |
| 44 | 47 |
| 45 private: | 48 private: |
| 46 std::vector<uint8> public_key_; | 49 std::vector<uint8> public_key_; |
| 47 scoped_ptr<crypto::RSAPrivateKey> private_key_; | 50 scoped_ptr<crypto::RSAPrivateKey> private_key_; |
| 48 | 51 |
| 49 DISALLOW_COPY_AND_ASSIGN(MockOwnerKeyUtil); | 52 DISALLOW_COPY_AND_ASSIGN(MockOwnerKeyUtil); |
| 50 }; | 53 }; |
| 51 | 54 |
| 52 } // namespace chromeos | 55 } // namespace ownership |
| 53 | 56 |
| 54 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_MOCK_OWNER_KEY_UTIL_H_ | 57 #endif // COMPONENTS_OWNERSHIP_MOCK_OWNER_KEY_UTIL_H_ |
| OLD | NEW |