OLD | NEW |
1 // Copyright (c) 2011 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium OS 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 LOGIN_MANAGER_OWNER_KEY_H_ | 5 #ifndef LOGIN_MANAGER_OWNER_KEY_H_ |
6 #define LOGIN_MANAGER_OWNER_KEY_H_ | 6 #define LOGIN_MANAGER_OWNER_KEY_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include <base/basictypes.h> | 10 #include <base/basictypes.h> |
(...skipping 16 matching lines...) Expand all Loading... |
27 // present, we will allow the owner's key to be set programmatically, | 27 // present, we will allow the owner's key to be set programmatically, |
28 // and will persist it to disk upon request. Attempts to set the key | 28 // and will persist it to disk upon request. Attempts to set the key |
29 // before on-disk storage has been checked will be denied. | 29 // before on-disk storage has been checked will be denied. |
30 class OwnerKey { | 30 class OwnerKey { |
31 public: | 31 public: |
32 explicit OwnerKey(const FilePath& key_file); | 32 explicit OwnerKey(const FilePath& key_file); |
33 virtual ~OwnerKey(); | 33 virtual ~OwnerKey(); |
34 | 34 |
35 virtual bool Equals(const std::string& key_der) const; | 35 virtual bool Equals(const std::string& key_der) const; |
36 virtual bool VEquals(const std::vector<uint8>& key_der) const; | 36 virtual bool VEquals(const std::vector<uint8>& key_der) const; |
37 virtual bool HaveCheckedDisk(); | 37 virtual bool HaveCheckedDisk() const; |
38 virtual bool IsPopulated(); | 38 virtual bool IsPopulated() const; |
39 | 39 |
40 // If |key_file_| exists, populate the object with the contents of the file. | 40 // If |key_file_| exists, populate the object with the contents of the file. |
41 // If the file isn't there, that's ok. | 41 // If the file isn't there, that's ok. |
42 // Will return false if the file exists and there are errors reading it. | 42 // Will return false if the file exists and there are errors reading it. |
43 // If this returns true, call IsPopulated() to tell whether or not data was | 43 // If this returns true, call IsPopulated() to tell whether or not data was |
44 // loaded off of disk. | 44 // loaded off of disk. |
45 virtual bool PopulateFromDiskIfPossible(); | 45 virtual bool PopulateFromDiskIfPossible(); |
46 | 46 |
47 // Load key material from |public_key_der|. | 47 // Load key material from |public_key_der|. |
48 // We will _deny_ such an attempt if we have not yet checked disk for a key, | 48 // We will _deny_ such an attempt if we have not yet checked disk for a key, |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 bool have_checked_disk_; | 102 bool have_checked_disk_; |
103 bool have_replaced_; | 103 bool have_replaced_; |
104 std::vector<uint8> key_; | 104 std::vector<uint8> key_; |
105 scoped_ptr<SystemUtils> utils_; | 105 scoped_ptr<SystemUtils> utils_; |
106 | 106 |
107 DISALLOW_COPY_AND_ASSIGN(OwnerKey); | 107 DISALLOW_COPY_AND_ASSIGN(OwnerKey); |
108 }; | 108 }; |
109 } // namespace login_manager | 109 } // namespace login_manager |
110 | 110 |
111 #endif // LOGIN_MANAGER_OWNER_KEY_H_ | 111 #endif // LOGIN_MANAGER_OWNER_KEY_H_ |
OLD | NEW |