| 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_CROS_CRYPTOHOME_LIBRARY_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_CROS_CRYPTOHOME_LIBRARY_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_CROS_CRYPTOHOME_LIBRARY_H_ | 6 #define CHROME_BROWSER_CHROMEOS_CROS_CRYPTOHOME_LIBRARY_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 namespace chromeos { | 10 namespace chromeos { |
| 11 | 11 |
| 12 // This interface defines the interaction with the ChromeOS cryptohome library | 12 // This interface defines the interaction with the ChromeOS cryptohome library |
| 13 // APIs. | 13 // APIs. |
| 14 class CryptohomeLibrary { | 14 class CryptohomeLibrary { |
| 15 public: | 15 public: |
| 16 CryptohomeLibrary(); | 16 CryptohomeLibrary(); |
| 17 virtual ~CryptohomeLibrary(); | 17 virtual ~CryptohomeLibrary(); |
| 18 | 18 |
| 19 // Asks cryptohomed if a drive is currently mounted. | 19 // Asks cryptohomed if a drive is currently mounted. |
| 20 virtual bool IsMounted() = 0; | 20 virtual bool IsMounted() = 0; |
| 21 | 21 |
| 22 // Wrappers of the functions for working with Tpm. | 22 // Wrappers of the functions for working with Tpm. |
| 23 | 23 |
| 24 // Returns whether Tpm is ready. | |
| 25 virtual bool TpmIsReady() = 0; | |
| 26 | |
| 27 // Returns whether Tpm is presented and enabled. | 24 // Returns whether Tpm is presented and enabled. |
| 28 virtual bool TpmIsEnabled() = 0; | 25 virtual bool TpmIsEnabled() = 0; |
| 29 | 26 |
| 30 // Returns whether device has already been owned. | 27 // Returns whether device has already been owned. |
| 31 virtual bool TpmIsOwned() = 0; | 28 virtual bool TpmIsOwned() = 0; |
| 32 | 29 |
| 33 // Returns whether device is being owned (Tpm password is generating). | 30 // Returns whether device is being owned (Tpm password is generating). |
| 34 virtual bool TpmIsBeingOwned() = 0; | 31 virtual bool TpmIsBeingOwned() = 0; |
| 35 | 32 |
| 36 // Returns Tpm password (if password was cleared empty one is returned). | |
| 37 // Return value is true if password was successfully acquired. | |
| 38 virtual bool TpmGetPassword(std::string* password) = 0; | |
| 39 | |
| 40 // Attempts to start owning (if device isn't owned and isn't being owned). | 33 // Attempts to start owning (if device isn't owned and isn't being owned). |
| 41 virtual void TpmCanAttemptOwnership() = 0; | 34 virtual void TpmCanAttemptOwnership() = 0; |
| 42 | 35 |
| 43 // Clears Tpm password. Password should be cleared after it was generated and | 36 // Clears Tpm password. Password should be cleared after it was generated and |
| 44 // shown to user. | 37 // shown to user. |
| 45 virtual void TpmClearStoredPassword() = 0; | 38 virtual void TpmClearStoredPassword() = 0; |
| 46 | 39 |
| 47 virtual bool InstallAttributesGet(const std::string& name, | 40 virtual bool InstallAttributesGet(const std::string& name, |
| 48 std::string* value) = 0; | 41 std::string* value) = 0; |
| 49 virtual bool InstallAttributesSet(const std::string& name, | 42 virtual bool InstallAttributesSet(const std::string& name, |
| 50 const std::string& value) = 0; | 43 const std::string& value) = 0; |
| 51 virtual bool InstallAttributesFinalize() = 0; | 44 virtual bool InstallAttributesFinalize() = 0; |
| 52 virtual bool InstallAttributesIsReady() = 0; | 45 virtual bool InstallAttributesIsReady() = 0; |
| 53 virtual bool InstallAttributesIsInvalid() = 0; | 46 virtual bool InstallAttributesIsInvalid() = 0; |
| 54 virtual bool InstallAttributesIsFirstInstall() = 0; | 47 virtual bool InstallAttributesIsFirstInstall() = 0; |
| 55 | 48 |
| 56 // Returns system hash in hex encoded ascii format. | 49 // Returns system hash in hex encoded ascii format. |
| 57 virtual std::string GetSystemSalt() = 0; | 50 virtual std::string GetSystemSalt() = 0; |
| 58 | 51 |
| 59 // Factory function, creates a new instance and returns ownership. | 52 // Factory function, creates a new instance and returns ownership. |
| 60 // For normal usage, access the singleton via CrosLibrary::Get(). | 53 // For normal usage, access the singleton via CrosLibrary::Get(). |
| 61 static CryptohomeLibrary* GetImpl(bool stub); | 54 static CryptohomeLibrary* GetImpl(bool stub); |
| 62 }; | 55 }; |
| 63 | 56 |
| 64 } // namespace chromeos | 57 } // namespace chromeos |
| 65 | 58 |
| 66 #endif // CHROME_BROWSER_CHROMEOS_CROS_CRYPTOHOME_LIBRARY_H_ | 59 #endif // CHROME_BROWSER_CHROMEOS_CROS_CRYPTOHOME_LIBRARY_H_ |
| OLD | NEW |