Chromium Code Reviews| 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 CHROMEOS_DBUS_CRYPTOHOME_CLIENT_H_ | 5 #ifndef CHROMEOS_DBUS_CRYPTOHOME_CLIENT_H_ |
| 6 #define CHROMEOS_DBUS_CRYPTOHOME_CLIENT_H_ | 6 #define CHROMEOS_DBUS_CRYPTOHOME_CLIENT_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 28 bool return_status, | 28 bool return_status, |
| 29 int return_code)> | 29 int return_code)> |
| 30 AsyncCallStatusHandler; | 30 AsyncCallStatusHandler; |
| 31 // A callback to handle AsyncCallStatusWithData signals. | 31 // A callback to handle AsyncCallStatusWithData signals. |
| 32 typedef base::Callback<void(int async_id, | 32 typedef base::Callback<void(int async_id, |
| 33 bool return_status, | 33 bool return_status, |
| 34 const std::string& data)> | 34 const std::string& data)> |
| 35 AsyncCallStatusWithDataHandler; | 35 AsyncCallStatusWithDataHandler; |
| 36 // A callback to handle responses of AsyncXXX methods. | 36 // A callback to handle responses of AsyncXXX methods. |
| 37 typedef base::Callback<void(int async_id)> AsyncMethodCallback; | 37 typedef base::Callback<void(int async_id)> AsyncMethodCallback; |
| 38 // A callback to handle responses of Pkcs11GetTpmTokenInfo method. | 38 // A callback to handle responses of Pkcs11GetTpmTokenInfo method. The result |
| 39 // of the D-Bus call is in |call_status|. On success, |label| holds the | |
| 40 // PKCS #11 token label. This is not useful in practice to identify a token | |
| 41 // but may be meaningful to a user. The |user_pin| can be used with the | |
| 42 // C_Login PKCS #11 function but is not necessary because tokens are logged in | |
| 43 // for the duration of a signed-in session. The |slot| corresponds to a | |
| 44 // CK_SLOT_ID for the PKCS #11 API and reliably identifies the token for the | |
| 45 // duration of the signed-in session. | |
|
satorux1
2013/10/08 23:46:31
thank you for adding this! we need more of these c
| |
| 39 typedef base::Callback<void( | 46 typedef base::Callback<void( |
| 40 DBusMethodCallStatus call_status, | 47 DBusMethodCallStatus call_status, |
| 41 const std::string& label, | 48 const std::string& label, |
| 42 const std::string& user_pin)> Pkcs11GetTpmTokenInfoCallback; | 49 const std::string& user_pin, |
| 50 int slot)> Pkcs11GetTpmTokenInfoCallback; | |
| 43 // A callback for methods which return both a bool result and data. | 51 // A callback for methods which return both a bool result and data. |
| 44 typedef base::Callback<void(DBusMethodCallStatus call_status, | 52 typedef base::Callback<void(DBusMethodCallStatus call_status, |
| 45 bool result, | 53 bool result, |
| 46 const std::string& data)> DataMethodCallback; | 54 const std::string& data)> DataMethodCallback; |
| 47 | 55 |
| 48 virtual ~CryptohomeClient(); | 56 virtual ~CryptohomeClient(); |
| 49 | 57 |
| 50 // Factory function, creates a new instance and returns ownership. | 58 // Factory function, creates a new instance and returns ownership. |
| 51 // For normal usage, access the singleton via DBusThreadManager::Get(). | 59 // For normal usage, access the singleton via DBusThreadManager::Get(). |
| 52 static CryptohomeClient* Create(DBusClientImplementationType type); | 60 static CryptohomeClient* Create(DBusClientImplementationType type); |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 179 | 187 |
| 180 // Calls TpmClearStoredPassword method and returns true when the call | 188 // Calls TpmClearStoredPassword method and returns true when the call |
| 181 // succeeds. This method blocks until the call returns. | 189 // succeeds. This method blocks until the call returns. |
| 182 // TODO(hashimoto): Remove this method. crbug.com/141010 | 190 // TODO(hashimoto): Remove this method. crbug.com/141010 |
| 183 virtual bool CallTpmClearStoredPasswordAndBlock() = 0; | 191 virtual bool CallTpmClearStoredPasswordAndBlock() = 0; |
| 184 | 192 |
| 185 // Calls Pkcs11IsTpmTokenReady method. | 193 // Calls Pkcs11IsTpmTokenReady method. |
| 186 virtual void Pkcs11IsTpmTokenReady( | 194 virtual void Pkcs11IsTpmTokenReady( |
| 187 const BoolDBusMethodCallback& callback) = 0; | 195 const BoolDBusMethodCallback& callback) = 0; |
| 188 | 196 |
| 189 // Calls Pkcs11GetTpmTokenInfo method. | 197 // Calls Pkcs11GetTpmTokenInfo method. This method is deprecated, you should |
| 198 // use Pkcs11GetTpmTokenInfoForUser instead. On success |callback| will | |
| 199 // receive PKCS #11 token information for the token associated with the user | |
| 200 // who originally signed in (i.e. PKCS #11 slot 0). | |
| 190 virtual void Pkcs11GetTpmTokenInfo( | 201 virtual void Pkcs11GetTpmTokenInfo( |
| 191 const Pkcs11GetTpmTokenInfoCallback& callback) = 0; | 202 const Pkcs11GetTpmTokenInfoCallback& callback) = 0; |
| 192 | 203 |
| 204 // Calls Pkcs11GetTpmTokenInfoForUser method. On success |callback| will | |
| 205 // receive PKCS #11 token information for the user identified by the canonical | |
| 206 // |username|. | |
| 207 virtual void Pkcs11GetTpmTokenInfoForUser( | |
| 208 const std::string& username, | |
|
mattm
2013/10/08 23:10:25
Is username the "u-<long hex string>" value like i
Darren Krahn
2013/10/08 23:29:38
No, it's a canonical email address as returned by
satorux1
2013/10/08 23:46:31
I think it's a good explanation about |username| p
| |
| 209 const Pkcs11GetTpmTokenInfoCallback& callback) = 0; | |
| 210 | |
| 193 // Calls InstallAttributesGet method and returns true when the call succeeds. | 211 // Calls InstallAttributesGet method and returns true when the call succeeds. |
| 194 // This method blocks until the call returns. | 212 // This method blocks until the call returns. |
| 195 // The original content of |value| is lost. | 213 // The original content of |value| is lost. |
| 196 virtual bool InstallAttributesGet(const std::string& name, | 214 virtual bool InstallAttributesGet(const std::string& name, |
| 197 std::vector<uint8>* value, | 215 std::vector<uint8>* value, |
| 198 bool* successful) = 0; | 216 bool* successful) = 0; |
| 199 | 217 |
| 200 // Calls InstallAttributesSet method and returns true when the call succeeds. | 218 // Calls InstallAttributesSet method and returns true when the call succeeds. |
| 201 // This method blocks until the call returns. | 219 // This method blocks until the call returns. |
| 202 virtual bool InstallAttributesSet(const std::string& name, | 220 virtual bool InstallAttributesSet(const std::string& name, |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 357 // Create() should be used instead. | 375 // Create() should be used instead. |
| 358 CryptohomeClient(); | 376 CryptohomeClient(); |
| 359 | 377 |
| 360 private: | 378 private: |
| 361 DISALLOW_COPY_AND_ASSIGN(CryptohomeClient); | 379 DISALLOW_COPY_AND_ASSIGN(CryptohomeClient); |
| 362 }; | 380 }; |
| 363 | 381 |
| 364 } // namespace chromeos | 382 } // namespace chromeos |
| 365 | 383 |
| 366 #endif // CHROMEOS_DBUS_CRYPTOHOME_CLIENT_H_ | 384 #endif // CHROMEOS_DBUS_CRYPTOHOME_CLIENT_H_ |
| OLD | NEW |