OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CHROMEOS_CRYPTOHOME_CRYPTOHOME_PARAMETERS_H_ | 5 #ifndef CHROMEOS_CRYPTOHOME_CRYPTOHOME_PARAMETERS_H_ |
6 #define CHROMEOS_CRYPTOHOME_CRYPTOHOME_PARAMETERS_H_ | 6 #define CHROMEOS_CRYPTOHOME_CRYPTOHOME_PARAMETERS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/memory/scoped_ptr.h" | |
13 #include "base/memory/scoped_vector.h" | |
12 #include "chromeos/chromeos_export.h" | 14 #include "chromeos/chromeos_export.h" |
13 | 15 |
14 namespace cryptohome { | 16 namespace cryptohome { |
15 | 17 |
16 enum AuthKeyPrivileges { | 18 enum AuthKeyPrivileges { |
17 PRIV_MOUNT = 1 << 0, // Can mount with this key. | 19 PRIV_MOUNT = 1 << 0, // Can mount with this key. |
18 PRIV_ADD = 1 << 1, // Can add new keys. | 20 PRIV_ADD = 1 << 1, // Can add new keys. |
19 PRIV_REMOVE = 1 << 2, // Can remove other keys. | 21 PRIV_REMOVE = 1 << 2, // Can remove other keys. |
20 PRIV_MIGRATE = 1 << 3, // Destroy all keys and replace with new. | 22 PRIV_MIGRATE = 1 << 3, // Destroy all keys and replace with new. |
21 PRIV_AUTHORIZED_UPDATE = 1 << 4, // Key can be updated in place. | 23 PRIV_AUTHORIZED_UPDATE = 1 << 4, // Key can be updated in place. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
57 struct CHROMEOS_EXPORT Authorization { | 59 struct CHROMEOS_EXPORT Authorization { |
58 Authorization(const std::string& key, const std::string& label); | 60 Authorization(const std::string& key, const std::string& label); |
59 explicit Authorization(const KeyDefinition& key); | 61 explicit Authorization(const KeyDefinition& key); |
60 | 62 |
61 bool operator==(const Authorization& other) const; | 63 bool operator==(const Authorization& other) const; |
62 | 64 |
63 std::string key; | 65 std::string key; |
64 std::string label; | 66 std::string label; |
65 }; | 67 }; |
66 | 68 |
69 // Information about keys returned by GetKeyDataEx(). | |
70 struct CHROMEOS_EXPORT RetrievedKeyData { | |
Darren Krahn
2014/08/26 20:14:21
This seems to simply dup the classes generated by
bartfab (slow)
2014/08/27 11:53:15
I followed the design of the other calls abstracte
| |
71 enum Type { | |
72 TYPE_PASSWORD = 0 | |
73 }; | |
74 | |
75 enum AuthorizationType { | |
76 AUTHORIZATION_TYPE_HMACSHA256 = 0, | |
77 AUTHORIZATION_TYPE_AES256CBC_HMACSHA256 | |
78 }; | |
79 | |
80 struct ProviderData { | |
81 explicit ProviderData(const std::string& name); | |
82 | |
83 std::string name; | |
84 scoped_ptr<int64> number; | |
85 scoped_ptr<std::string> bytes; | |
86 }; | |
87 | |
88 RetrievedKeyData(Type type, const std::string& label, int64 revision); | |
89 | |
90 Type type; | |
91 std::string label; | |
92 // Privileges associated with key. Combination of |AuthKeyPrivileges| values. | |
93 int privileges; | |
94 int64 revision; | |
95 std::vector<AuthorizationType> authorization_types; | |
96 ScopedVector<ProviderData> provider_data; | |
97 }; | |
98 | |
67 // Parameters for Mount call. | 99 // Parameters for Mount call. |
68 class CHROMEOS_EXPORT MountParameters { | 100 class CHROMEOS_EXPORT MountParameters { |
69 public: | 101 public: |
70 explicit MountParameters(bool ephemeral); | 102 explicit MountParameters(bool ephemeral); |
71 ~MountParameters(); | 103 ~MountParameters(); |
72 | 104 |
73 bool operator==(const MountParameters& other) const; | 105 bool operator==(const MountParameters& other) const; |
74 | 106 |
75 // If |true|, the mounted home dir will be backed by tmpfs. If |false|, the | 107 // If |true|, the mounted home dir will be backed by tmpfs. If |false|, the |
76 // ephemeral users policy decides whether tmpfs or an encrypted directory is | 108 // ephemeral users policy decides whether tmpfs or an encrypted directory is |
77 // used as the backend. | 109 // used as the backend. |
78 bool ephemeral; | 110 bool ephemeral; |
79 | 111 |
80 // If not empty, home dir will be created with these keys if it exist. | 112 // If not empty, home dir will be created with these keys if it exist. |
81 std::vector<KeyDefinition> create_keys; | 113 std::vector<KeyDefinition> create_keys; |
82 }; | 114 }; |
83 | 115 |
84 } // namespace cryptohome | 116 } // namespace cryptohome |
85 | 117 |
86 #endif // CHROMEOS_CRYPTOHOME_CRYPTOHOME_PARAMETERS_H_ | 118 #endif // CHROMEOS_CRYPTOHOME_CRYPTOHOME_PARAMETERS_H_ |
OLD | NEW |