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