Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(323)

Side by Side Diff: chromeos/dbus/cryptohome_client.h

Issue 1693383003: ChromeOS cryptohome should be able to use gaia id as user identifier. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add cryptohome::Identification() . Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "chromeos/attestation/attestation_constants.h" 15 #include "chromeos/attestation/attestation_constants.h"
16 #include "chromeos/chromeos_export.h" 16 #include "chromeos/chromeos_export.h"
17 #include "chromeos/dbus/dbus_client.h" 17 #include "chromeos/dbus/dbus_client.h"
18 #include "chromeos/dbus/dbus_method_call_status.h" 18 #include "chromeos/dbus/dbus_method_call_status.h"
19 19
20 namespace cryptohome { 20 namespace cryptohome {
21 21
22 class AccountIdentifier;
23 class AddKeyRequest; 22 class AddKeyRequest;
24 class AuthorizationRequest; 23 class AuthorizationRequest;
25 class BaseReply; 24 class BaseReply;
26 class CheckKeyRequest; 25 class CheckKeyRequest;
27 class FlushAndSignBootAttributesRequest; 26 class FlushAndSignBootAttributesRequest;
28 class GetBootAttributeRequest; 27 class GetBootAttributeRequest;
29 class GetKeyDataRequest; 28 class GetKeyDataRequest;
30 class MountRequest; 29 class MountRequest;
31 class RemoveKeyRequest; 30 class RemoveKeyRequest;
32 class SetBootAttributeRequest; 31 class SetBootAttributeRequest;
33 class UpdateKeyRequest; 32 class UpdateKeyRequest;
34 33
34 class Identification;
35
35 } // namespace cryptohome 36 } // namespace cryptohome
36 37
37 namespace chromeos { 38 namespace chromeos {
38 39
39 // CryptohomeClient is used to communicate with the Cryptohome service. 40 // CryptohomeClient is used to communicate with the Cryptohome service.
40 // All method should be called from the origin thread (UI thread) which 41 // All method should be called from the origin thread (UI thread) which
41 // initializes the DBusThreadManager instance. 42 // initializes the DBusThreadManager instance.
42 class CHROMEOS_EXPORT CryptohomeClient : public DBusClient { 43 class CHROMEOS_EXPORT CryptohomeClient : public DBusClient {
43 public: 44 public:
44 // Constant that will be passed to AsyncMethodCallback to indicate that 45 // Constant that will be passed to AsyncMethodCallback to indicate that
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 bool result, 89 bool result,
89 const cryptohome::BaseReply& reply)> ProtobufMethodCallback; 90 const cryptohome::BaseReply& reply)> ProtobufMethodCallback;
90 91
91 ~CryptohomeClient() override; 92 ~CryptohomeClient() override;
92 93
93 // Factory function, creates a new instance and returns ownership. 94 // Factory function, creates a new instance and returns ownership.
94 // For normal usage, access the singleton via DBusThreadManager::Get(). 95 // For normal usage, access the singleton via DBusThreadManager::Get().
95 static CryptohomeClient* Create(); 96 static CryptohomeClient* Create();
96 97
97 // Returns the sanitized |username| that the stub implementation would return. 98 // Returns the sanitized |username| that the stub implementation would return.
98 static std::string GetStubSanitizedUsername(const std::string& username); 99 static std::string GetStubSanitizedUsername(
100 const cryptohome::Identification& cryptohome_id);
99 101
100 // Sets AsyncCallStatus signal handlers. 102 // Sets AsyncCallStatus signal handlers.
101 // |handler| is called when results for AsyncXXX methods are returned. 103 // |handler| is called when results for AsyncXXX methods are returned.
102 // Cryptohome service will process the calls in a first-in-first-out manner 104 // Cryptohome service will process the calls in a first-in-first-out manner
103 // when they are made in parallel. 105 // when they are made in parallel.
104 virtual void SetAsyncCallStatusHandlers( 106 virtual void SetAsyncCallStatusHandlers(
105 const AsyncCallStatusHandler& handler, 107 const AsyncCallStatusHandler& handler,
106 const AsyncCallStatusWithDataHandler& data_handler) = 0; 108 const AsyncCallStatusWithDataHandler& data_handler) = 0;
107 109
108 // Resets AsyncCallStatus signal handlers. 110 // Resets AsyncCallStatus signal handlers.
109 virtual void ResetAsyncCallStatusHandlers() = 0; 111 virtual void ResetAsyncCallStatusHandlers() = 0;
110 112
111 // Runs the callback as soon as the service becomes available. 113 // Runs the callback as soon as the service becomes available.
112 virtual void WaitForServiceToBeAvailable( 114 virtual void WaitForServiceToBeAvailable(
113 const WaitForServiceToBeAvailableCallback& callback) = 0; 115 const WaitForServiceToBeAvailableCallback& callback) = 0;
114 116
115 // Calls IsMounted method and returns true when the call succeeds. 117 // Calls IsMounted method and returns true when the call succeeds.
116 virtual void IsMounted(const BoolDBusMethodCallback& callback) = 0; 118 virtual void IsMounted(const BoolDBusMethodCallback& callback) = 0;
117 119
118 // Calls Unmount method and returns true when the call succeeds. 120 // Calls Unmount method and returns true when the call succeeds.
119 // This method blocks until the call returns. 121 // This method blocks until the call returns.
120 virtual bool Unmount(bool* success) = 0; 122 virtual bool Unmount(bool* success) = 0;
121 123
122 // Calls AsyncCheckKey method. |callback| is called after the method call 124 // Calls AsyncCheckKey method. |callback| is called after the method call
123 // succeeds. 125 // succeeds.
124 virtual void AsyncCheckKey(const std::string& username, 126 virtual void AsyncCheckKey(const cryptohome::Identification& cryptohome_id,
125 const std::string& key, 127 const std::string& key,
126 const AsyncMethodCallback& callback) = 0; 128 const AsyncMethodCallback& callback) = 0;
127 129
128 // Calls AsyncMigrateKey method. |callback| is called after the method call 130 // Calls AsyncMigrateKey method. |callback| is called after the method call
129 // succeeds. 131 // succeeds.
130 virtual void AsyncMigrateKey(const std::string& username, 132 virtual void AsyncMigrateKey(const cryptohome::Identification& cryptohome_id,
131 const std::string& from_key, 133 const std::string& from_key,
132 const std::string& to_key, 134 const std::string& to_key,
133 const AsyncMethodCallback& callback) = 0; 135 const AsyncMethodCallback& callback) = 0;
134 136
135 // Calls AsyncRemove method. |callback| is called after the method call 137 // Calls AsyncRemove method. |callback| is called after the method call
136 // succeeds. 138 // succeeds.
137 virtual void AsyncRemove(const std::string& username, 139 virtual void AsyncRemove(const cryptohome::Identification& cryptohome_id,
138 const AsyncMethodCallback& callback) = 0; 140 const AsyncMethodCallback& callback) = 0;
139 141
142 // Calls RenameCryptohome method. |callback| is called after the method
143 // call succeeds.
144 virtual void RenameCryptohome(
145 const cryptohome::Identification& cryptohome_id_from,
146 const cryptohome::Identification& cryptohome_id_to,
147 const ProtobufMethodCallback& callback) = 0;
148
140 // Calls GetSystemSalt method. |callback| is called after the method call 149 // Calls GetSystemSalt method. |callback| is called after the method call
141 // succeeds. 150 // succeeds.
142 virtual void GetSystemSalt(const GetSystemSaltCallback& callback) = 0; 151 virtual void GetSystemSalt(const GetSystemSaltCallback& callback) = 0;
143 152
144 // Calls GetSanitizedUsername method. |callback| is called after the method 153 // Calls GetSanitizedUsername method. |callback| is called after the method
145 // call succeeds. 154 // call succeeds.
146 virtual void GetSanitizedUsername( 155 virtual void GetSanitizedUsername(
147 const std::string& username, 156 const cryptohome::Identification& cryptohome_id,
148 const StringDBusMethodCallback& callback) = 0; 157 const StringDBusMethodCallback& callback) = 0;
149 158
150 // Same as GetSanitizedUsername() but blocks until a reply is received, and 159 // Same as GetSanitizedUsername() but blocks until a reply is received, and
151 // returns the sanitized username synchronously. Returns an empty string if 160 // returns the sanitized username synchronously. Returns an empty string if
152 // the method call fails. 161 // the method call fails.
153 // This may only be called in situations where blocking the UI thread is 162 // This may only be called in situations where blocking the UI thread is
154 // considered acceptable (e.g. restarting the browser after a crash or after 163 // considered acceptable (e.g. restarting the browser after a crash or after
155 // a flag change). 164 // a flag change).
156 virtual std::string BlockingGetSanitizedUsername( 165 virtual std::string BlockingGetSanitizedUsername(
157 const std::string& username) = 0; 166 const cryptohome::Identification& cryptohome_id) = 0;
158 167
159 // Calls the AsyncMount method to asynchronously mount the cryptohome for 168 // Calls the AsyncMount method to asynchronously mount the cryptohome for
160 // |username|, using |key| to unlock it. For supported |flags|, see the 169 // |username|, using |key| to unlock it. For supported |flags|, see the
161 // documentation of AsyncMethodCaller::AsyncMount(). 170 // documentation of AsyncMethodCaller::AsyncMount().
162 // |callback| is called after the method call succeeds. 171 // |callback| is called after the method call succeeds.
163 virtual void AsyncMount(const std::string& username, 172 virtual void AsyncMount(const cryptohome::Identification& cryptohome_id,
164 const std::string& key, 173 const std::string& key,
165 int flags, 174 int flags,
166 const AsyncMethodCallback& callback) = 0; 175 const AsyncMethodCallback& callback) = 0;
167 176
168 // Calls the AsyncAddKey method to asynchronously add another |new_key| for 177 // Calls the AsyncAddKey method to asynchronously add another |new_key| for
169 // |username|, using |key| to unlock it first. 178 // |username|, using |key| to unlock it first.
170 // |callback| is called after the method call succeeds. 179 // |callback| is called after the method call succeeds.
171 virtual void AsyncAddKey(const std::string& username, 180 virtual void AsyncAddKey(const cryptohome::Identification& cryptohome_id,
172 const std::string& key, 181 const std::string& key,
173 const std::string& new_key, 182 const std::string& new_key,
174 const AsyncMethodCallback& callback) = 0; 183 const AsyncMethodCallback& callback) = 0;
175 184
176 // Calls AsyncMountGuest method. |callback| is called after the method call 185 // Calls AsyncMountGuest method. |callback| is called after the method call
177 // succeeds. 186 // succeeds.
178 virtual void AsyncMountGuest(const AsyncMethodCallback& callback) = 0; 187 virtual void AsyncMountGuest(const AsyncMethodCallback& callback) = 0;
179 188
180 // Calls the AsyncMount method to asynchronously mount the cryptohome for 189 // Calls the AsyncMount method to asynchronously mount the cryptohome for
181 // |public_mount_id|. For supported |flags|, see the documentation of 190 // |public_mount_id|. For supported |flags|, see the documentation of
182 // AsyncMethodCaller::AsyncMount(). |callback| is called after the method 191 // AsyncMethodCaller::AsyncMount(). |callback| is called after the method
183 // call succeeds. 192 // call succeeds.
184 virtual void AsyncMountPublic(const std::string& public_mount_id, 193 virtual void AsyncMountPublic(
185 int flags, 194 const cryptohome::Identification& public_mount_id,
186 const AsyncMethodCallback& callback) = 0; 195 int flags,
196 const AsyncMethodCallback& callback) = 0;
187 197
188 // Calls TpmIsReady method. 198 // Calls TpmIsReady method.
189 virtual void TpmIsReady(const BoolDBusMethodCallback& callback) = 0; 199 virtual void TpmIsReady(const BoolDBusMethodCallback& callback) = 0;
190 200
191 // Calls TpmIsEnabled method. 201 // Calls TpmIsEnabled method.
192 virtual void TpmIsEnabled(const BoolDBusMethodCallback& callback) = 0; 202 virtual void TpmIsEnabled(const BoolDBusMethodCallback& callback) = 0;
193 203
194 // Calls TpmIsEnabled method and returns true when the call succeeds. 204 // Calls TpmIsEnabled method and returns true when the call succeeds.
195 // This method blocks until the call returns. 205 // This method blocks until the call returns.
196 // TODO(hashimoto): Remove this method. crbug.com/141006 206 // TODO(hashimoto): Remove this method. crbug.com/141006
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 const BoolDBusMethodCallback& callback) = 0; 244 const BoolDBusMethodCallback& callback) = 0;
235 245
236 // Calls Pkcs11GetTpmTokenInfo method. This method is deprecated, you should 246 // Calls Pkcs11GetTpmTokenInfo method. This method is deprecated, you should
237 // use Pkcs11GetTpmTokenInfoForUser instead. On success |callback| will 247 // use Pkcs11GetTpmTokenInfoForUser instead. On success |callback| will
238 // receive PKCS #11 token information for the token associated with the user 248 // receive PKCS #11 token information for the token associated with the user
239 // who originally signed in (i.e. PKCS #11 slot 0). 249 // who originally signed in (i.e. PKCS #11 slot 0).
240 virtual void Pkcs11GetTpmTokenInfo( 250 virtual void Pkcs11GetTpmTokenInfo(
241 const Pkcs11GetTpmTokenInfoCallback& callback) = 0; 251 const Pkcs11GetTpmTokenInfoCallback& callback) = 0;
242 252
243 // Calls Pkcs11GetTpmTokenInfoForUser method. On success |callback| will 253 // Calls Pkcs11GetTpmTokenInfoForUser method. On success |callback| will
244 // receive PKCS #11 token information for the user identified by |user_email|. 254 // receive PKCS #11 token information for the user identified by
245 // The |user_email| must be a canonical email address as returned by 255 // |cryptohome_id|.
246 // user_manager::User::email().
247 virtual void Pkcs11GetTpmTokenInfoForUser( 256 virtual void Pkcs11GetTpmTokenInfoForUser(
248 const std::string& user_email, 257 const cryptohome::Identification& cryptohome_id,
249 const Pkcs11GetTpmTokenInfoCallback& callback) = 0; 258 const Pkcs11GetTpmTokenInfoCallback& callback) = 0;
250 259
251 // Calls InstallAttributesGet method and returns true when the call succeeds. 260 // Calls InstallAttributesGet method and returns true when the call succeeds.
252 // This method blocks until the call returns. 261 // This method blocks until the call returns.
253 // The original content of |value| is lost. 262 // The original content of |value| is lost.
254 virtual bool InstallAttributesGet(const std::string& name, 263 virtual bool InstallAttributesGet(const std::string& name,
255 std::vector<uint8_t>* value, 264 std::vector<uint8_t>* value,
256 bool* successful) = 0; 265 bool* successful) = 0;
257 266
258 // Calls InstallAttributesSet method and returns true when the call succeeds. 267 // Calls InstallAttributesSet method and returns true when the call succeeds.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 // will be called when the dbus call completes. When the operation completes, 310 // will be called when the dbus call completes. When the operation completes,
302 // the AsyncCallStatusHandler signal handler is called. |pca_response| is the 311 // the AsyncCallStatusHandler signal handler is called. |pca_response| is the
303 // response to the enrollment request emitted by the Privacy CA of type 312 // response to the enrollment request emitted by the Privacy CA of type
304 // |pca_type|. 313 // |pca_type|.
305 virtual void AsyncTpmAttestationEnroll( 314 virtual void AsyncTpmAttestationEnroll(
306 chromeos::attestation::PrivacyCAType pca_type, 315 chromeos::attestation::PrivacyCAType pca_type,
307 const std::string& pca_response, 316 const std::string& pca_response,
308 const AsyncMethodCallback& callback) = 0; 317 const AsyncMethodCallback& callback) = 0;
309 318
310 // Asynchronously creates an attestation certificate request according to 319 // Asynchronously creates an attestation certificate request according to
311 // |certificate_profile|. Some profiles require that the |user_id| of the 320 // |certificate_profile|. Some profiles require that the |cryptohome_id| of
312 // currently active user and an identifier of the |request_origin| be 321 // the currently active user and an identifier of the |request_origin| be
313 // provided. |callback| will be called when the dbus call completes. When 322 // provided. |callback| will be called when the dbus call completes. When
314 // the operation completes, the AsyncCallStatusWithDataHandler signal handler 323 // the operation completes, the AsyncCallStatusWithDataHandler signal handler
315 // is called. The data that is sent with the signal is a certificate request 324 // is called. The data that is sent with the signal is a certificate request
316 // to be sent to the Privacy CA of type |pca_type|. The certificate request 325 // to be sent to the Privacy CA of type |pca_type|. The certificate request
317 // is completed by calling AsyncTpmAttestationFinishCertRequest. The 326 // is completed by calling AsyncTpmAttestationFinishCertRequest. The
318 // |user_id| will not be included in the certificate request for the Privacy 327 // |cryptohome_id| will not be included in the certificate request for the
319 // CA. 328 // Privacy CA.
320 virtual void AsyncTpmAttestationCreateCertRequest( 329 virtual void AsyncTpmAttestationCreateCertRequest(
321 chromeos::attestation::PrivacyCAType pca_type, 330 chromeos::attestation::PrivacyCAType pca_type,
322 attestation::AttestationCertificateProfile certificate_profile, 331 attestation::AttestationCertificateProfile certificate_profile,
323 const std::string& user_id, 332 const cryptohome::Identification& cryptohome_id,
324 const std::string& request_origin, 333 const std::string& request_origin,
325 const AsyncMethodCallback& callback) = 0; 334 const AsyncMethodCallback& callback) = 0;
326 335
327 // Asynchronously finishes a certificate request operation. The callback will 336 // Asynchronously finishes a certificate request operation. The callback will
328 // be called when the dbus call completes. When the operation completes, the 337 // be called when the dbus call completes. When the operation completes, the
329 // AsyncCallStatusWithDataHandler signal handler is called. The data that is 338 // AsyncCallStatusWithDataHandler signal handler is called. The data that is
330 // sent with the signal is a certificate chain in PEM format. |pca_response| 339 // sent with the signal is a certificate chain in PEM format. |pca_response|
331 // is the response to the certificate request emitted by the Privacy CA. 340 // is the response to the certificate request emitted by the Privacy CA.
332 // |key_type| determines whether the certified key is to be associated with 341 // |key_type| determines whether the certified key is to be associated with
333 // the current user. |key_name| is a name for the key. If |key_type| is 342 // the current user. |key_name| is a name for the key. If |key_type| is
334 // KEY_USER, a |user_id| must be provided. Otherwise |user_id| is ignored. 343 // KEY_USER, a |cryptohome_id| must be provided. Otherwise |cryptohome_id|
335 // For normal GAIA users the |user_id| is a canonical email address. 344 // is ignored.
336 virtual void AsyncTpmAttestationFinishCertRequest( 345 virtual void AsyncTpmAttestationFinishCertRequest(
337 const std::string& pca_response, 346 const std::string& pca_response,
338 attestation::AttestationKeyType key_type, 347 attestation::AttestationKeyType key_type,
339 const std::string& user_id, 348 const cryptohome::Identification& cryptohome_id,
340 const std::string& key_name, 349 const std::string& key_name,
341 const AsyncMethodCallback& callback) = 0; 350 const AsyncMethodCallback& callback) = 0;
342 351
343 // Checks if an attestation key already exists. If the key specified by 352 // Checks if an attestation key already exists. If the key specified by
344 // |key_type| and |key_name| exists, then the result sent to the callback will 353 // |key_type| and |key_name| exists, then the result sent to the callback will
345 // be true. If |key_type| is KEY_USER, a |user_id| must be provided. 354 // be true. If |key_type| is KEY_USER, a |cryptohome_id| must be provided.
346 // Otherwise |user_id| is ignored. For normal GAIA users the |user_id| is a 355 // Otherwise |cryptohome_id| is ignored.
347 // canonical email address.
348 virtual void TpmAttestationDoesKeyExist( 356 virtual void TpmAttestationDoesKeyExist(
349 attestation::AttestationKeyType key_type, 357 attestation::AttestationKeyType key_type,
350 const std::string& user_id, 358 const cryptohome::Identification& cryptohome_id,
351 const std::string& key_name, 359 const std::string& key_name,
352 const BoolDBusMethodCallback& callback) = 0; 360 const BoolDBusMethodCallback& callback) = 0;
353 361
354 // Gets the attestation certificate for the key specified by |key_type| and 362 // Gets the attestation certificate for the key specified by |key_type| and
355 // |key_name|. |callback| will be called when the operation completes. If 363 // |key_name|. |callback| will be called when the operation completes. If
356 // the key does not exist the callback |result| parameter will be false. If 364 // the key does not exist the callback |result| parameter will be false. If
357 // |key_type| is KEY_USER, a |user_id| must be provided. Otherwise |user_id| 365 // |key_type| is KEY_USER, a |cryptohome_id| must be provided. Otherwise
358 // is ignored. For normal GAIA users the |user_id| is a canonical email 366 // |cryptohome_id|
359 // address. 367 // is ignored.
360 virtual void TpmAttestationGetCertificate( 368 virtual void TpmAttestationGetCertificate(
361 attestation::AttestationKeyType key_type, 369 attestation::AttestationKeyType key_type,
362 const std::string& user_id, 370 const cryptohome::Identification& cryptohome_id,
363 const std::string& key_name, 371 const std::string& key_name,
364 const DataMethodCallback& callback) = 0; 372 const DataMethodCallback& callback) = 0;
365 373
366 // Gets the public key for the key specified by |key_type| and |key_name|. 374 // Gets the public key for the key specified by |key_type| and |key_name|.
367 // |callback| will be called when the operation completes. If the key does 375 // |callback| will be called when the operation completes. If the key does
368 // not exist the callback |result| parameter will be false. If |key_type| is 376 // not exist the callback |result| parameter will be false. If |key_type| is
369 // KEY_USER, a |user_id| must be provided. Otherwise |user_id| is ignored. 377 // KEY_USER, a |cryptohome_id| must be provided. Otherwise |cryptohome_id|
370 // For normal GAIA users the |user_id| is a canonical email address. 378 // is ignored.
371 virtual void TpmAttestationGetPublicKey( 379 virtual void TpmAttestationGetPublicKey(
372 attestation::AttestationKeyType key_type, 380 attestation::AttestationKeyType key_type,
373 const std::string& user_id, 381 const cryptohome::Identification& cryptohome_id,
374 const std::string& key_name, 382 const std::string& key_name,
375 const DataMethodCallback& callback) = 0; 383 const DataMethodCallback& callback) = 0;
376 384
377 // Asynchronously registers an attestation key with the current user's 385 // Asynchronously registers an attestation key with the current user's
378 // PKCS #11 token. The |callback| will be called when the dbus call 386 // PKCS #11 token. The |callback| will be called when the dbus call
379 // completes. When the operation completes, the AsyncCallStatusHandler signal 387 // completes. When the operation completes, the AsyncCallStatusHandler signal
380 // handler is called. |key_type| and |key_name| specify the key to register. 388 // handler is called. |key_type| and |key_name| specify the key to register.
381 // If |key_type| is KEY_USER, a |user_id| must be provided. Otherwise 389 // If |key_type| is KEY_USER, a |cryptohome_id| must be provided. Otherwise
382 // |user_id| is ignored. For normal GAIA users the |user_id| is a canonical 390 // |cryptohome_id| is ignored.
383 // email address.
384 virtual void TpmAttestationRegisterKey( 391 virtual void TpmAttestationRegisterKey(
385 attestation::AttestationKeyType key_type, 392 attestation::AttestationKeyType key_type,
386 const std::string& user_id, 393 const cryptohome::Identification& cryptohome_id,
387 const std::string& key_name, 394 const std::string& key_name,
388 const AsyncMethodCallback& callback) = 0; 395 const AsyncMethodCallback& callback) = 0;
389 396
390 // Asynchronously signs an enterprise challenge with the key specified by 397 // Asynchronously signs an enterprise challenge with the key specified by
391 // |key_type| and |key_name|. |domain| and |device_id| will be included in 398 // |key_type| and |key_name|. |domain| and |device_id| will be included in
392 // the challenge response. |options| control how the challenge response is 399 // the challenge response. |options| control how the challenge response is
393 // generated. |challenge| must be a valid enterprise attestation challenge. 400 // generated. |challenge| must be a valid enterprise attestation challenge.
394 // The |callback| will be called when the dbus call completes. When the 401 // The |callback| will be called when the dbus call completes. When the
395 // operation completes, the AsyncCallStatusWithDataHandler signal handler is 402 // operation completes, the AsyncCallStatusWithDataHandler signal handler is
396 // called. If |key_type| is KEY_USER, a |user_id| must be provided. 403 // called. If |key_type| is KEY_USER, a |cryptohome_id| must be provided.
397 // Otherwise |user_id| is ignored. For normal GAIA users the |user_id| is a 404 // Otherwise |cryptohome_id| is ignored.
398 // canonical email address.
399 virtual void TpmAttestationSignEnterpriseChallenge( 405 virtual void TpmAttestationSignEnterpriseChallenge(
400 attestation::AttestationKeyType key_type, 406 attestation::AttestationKeyType key_type,
401 const std::string& user_id, 407 const cryptohome::Identification& cryptohome_id,
402 const std::string& key_name, 408 const std::string& key_name,
403 const std::string& domain, 409 const std::string& domain,
404 const std::string& device_id, 410 const std::string& device_id,
405 attestation::AttestationChallengeOptions options, 411 attestation::AttestationChallengeOptions options,
406 const std::string& challenge, 412 const std::string& challenge,
407 const AsyncMethodCallback& callback) = 0; 413 const AsyncMethodCallback& callback) = 0;
408 414
409 // Asynchronously signs a simple challenge with the key specified by 415 // Asynchronously signs a simple challenge with the key specified by
410 // |key_type| and |key_name|. |challenge| can be any set of arbitrary bytes. 416 // |key_type| and |key_name|. |challenge| can be any set of arbitrary bytes.
411 // A nonce will be appended to the challenge before signing; this method 417 // A nonce will be appended to the challenge before signing; this method
412 // cannot be used to sign arbitrary data. The |callback| will be called when 418 // cannot be used to sign arbitrary data. The |callback| will be called when
413 // the dbus call completes. When the operation completes, the 419 // the dbus call completes. When the operation completes, the
414 // AsyncCallStatusWithDataHandler signal handler is called. If |key_type| is 420 // AsyncCallStatusWithDataHandler signal handler is called. If |key_type| is
415 // KEY_USER, a |user_id| must be provided. Otherwise |user_id| is ignored. 421 // KEY_USER, a |cryptohome_id| must be provided. Otherwise |cryptohome_id|
416 // For normal GAIA users the |user_id| is a canonical email address. 422 // is ignored.
417 virtual void TpmAttestationSignSimpleChallenge( 423 virtual void TpmAttestationSignSimpleChallenge(
418 attestation::AttestationKeyType key_type, 424 attestation::AttestationKeyType key_type,
419 const std::string& user_id, 425 const cryptohome::Identification& cryptohome_id,
420 const std::string& key_name, 426 const std::string& key_name,
421 const std::string& challenge, 427 const std::string& challenge,
422 const AsyncMethodCallback& callback) = 0; 428 const AsyncMethodCallback& callback) = 0;
423 429
424 // Gets the payload associated with the key specified by |key_type| and 430 // Gets the payload associated with the key specified by |key_type| and
425 // |key_name|. The |callback| will be called when the operation completes. 431 // |key_name|. The |callback| will be called when the operation completes.
426 // If the key does not exist the callback |result| parameter will be false. 432 // If the key does not exist the callback |result| parameter will be false.
427 // If no payload has been set for the key the callback |result| parameter will 433 // If no payload has been set for the key the callback |result| parameter will
428 // be true and the |data| parameter will be empty. If |key_type| is 434 // be true and the |data| parameter will be empty. If |key_type| is
429 // KEY_USER, a |user_id| must be provided. Otherwise |user_id| is ignored. 435 // KEY_USER, a |cryptohome_id| must be provided. Otherwise |cryptohome_id|
430 // For normal GAIA users the |user_id| is a canonical email address. 436 // is ignored.
431 virtual void TpmAttestationGetKeyPayload( 437 virtual void TpmAttestationGetKeyPayload(
432 attestation::AttestationKeyType key_type, 438 attestation::AttestationKeyType key_type,
433 const std::string& user_id, 439 const cryptohome::Identification& cryptohome_id,
434 const std::string& key_name, 440 const std::string& key_name,
435 const DataMethodCallback& callback) = 0; 441 const DataMethodCallback& callback) = 0;
436 442
437 // Sets the |payload| associated with the key specified by |key_type| and 443 // Sets the |payload| associated with the key specified by |key_type| and
438 // |key_name|. The |callback| will be called when the operation completes. 444 // |key_name|. The |callback| will be called when the operation completes.
439 // If the operation succeeds, the callback |result| parameter will be true. 445 // If the operation succeeds, the callback |result| parameter will be true.
440 // If |key_type| is KEY_USER, a |user_id| must be provided. Otherwise 446 // If |key_type| is KEY_USER, a |cryptohome_id| must be provided. Otherwise
441 // |user_id| is ignored. For normal GAIA users the |user_id| is a canonical 447 // |cryptohome_id| is ignored.
442 // email address.
443 virtual void TpmAttestationSetKeyPayload( 448 virtual void TpmAttestationSetKeyPayload(
444 attestation::AttestationKeyType key_type, 449 attestation::AttestationKeyType key_type,
445 const std::string& user_id, 450 const cryptohome::Identification& cryptohome_id,
446 const std::string& key_name, 451 const std::string& key_name,
447 const std::string& payload, 452 const std::string& payload,
448 const BoolDBusMethodCallback& callback) = 0; 453 const BoolDBusMethodCallback& callback) = 0;
449 454
450 // Deletes certified keys as specified by |key_type| and |key_prefix|. The 455 // Deletes certified keys as specified by |key_type| and |key_prefix|. The
451 // |callback| will be called when the operation completes. If the operation 456 // |callback| will be called when the operation completes. If the operation
452 // succeeds, the callback |result| parameter will be true. If |key_type| is 457 // succeeds, the callback |result| parameter will be true. If |key_type| is
453 // KEY_USER, a |user_id| must be provided. Otherwise |user_id| is ignored. 458 // KEY_USER, a |cryptohome_id| must be provided. Otherwise |cryptohome_id|
454 // For normal GAIA users the |user_id| is a canonical email address. All keys 459 // is ignored.
455 // where the key name has a prefix matching |key_prefix| will be deleted. All 460 // All keys where the key name has a prefix matching |key_prefix| will be
456 // meta-data associated with the key, including certificates, will also be 461 // deleted. All meta-data associated with the key, including certificates,
457 // deleted. 462 // will also be deleted.
458 virtual void TpmAttestationDeleteKeys( 463 virtual void TpmAttestationDeleteKeys(
459 attestation::AttestationKeyType key_type, 464 attestation::AttestationKeyType key_type,
460 const std::string& user_id, 465 const cryptohome::Identification& cryptohome_id,
461 const std::string& key_prefix, 466 const std::string& key_prefix,
462 const BoolDBusMethodCallback& callback) = 0; 467 const BoolDBusMethodCallback& callback) = 0;
463 468
464 // Asynchronously calls the GetKeyDataEx method. |callback| will be invoked 469 // Asynchronously calls the GetKeyDataEx method. |callback| will be invoked
465 // with the reply protobuf. 470 // with the reply protobuf.
466 // GetKeyDataEx returns information about the key specified in |request|. At 471 // GetKeyDataEx returns information about the key specified in |request|. At
467 // present, this does not include any secret information and the call should 472 // present, this does not include any secret information and the call should
468 // not be authenticated (|auth| should be empty). 473 // not be authenticated (|auth| should be empty).
469 virtual void GetKeyDataEx( 474 virtual void GetKeyDataEx(const cryptohome::Identification& cryptohome_id,
470 const cryptohome::AccountIdentifier& id, 475 const cryptohome::AuthorizationRequest& auth,
471 const cryptohome::AuthorizationRequest& auth, 476 const cryptohome::GetKeyDataRequest& request,
472 const cryptohome::GetKeyDataRequest& request, 477 const ProtobufMethodCallback& callback) = 0;
473 const ProtobufMethodCallback& callback) = 0;
474 478
475 // Asynchronously calls CheckKeyEx method. |callback| is called after method 479 // Asynchronously calls CheckKeyEx method. |callback| is called after method
476 // call, and with reply protobuf. 480 // call, and with reply protobuf.
477 // CheckKeyEx just checks if authorization information is valid. 481 // CheckKeyEx just checks if authorization information is valid.
478 virtual void CheckKeyEx( 482 virtual void CheckKeyEx(const cryptohome::Identification& cryptohome_id,
479 const cryptohome::AccountIdentifier& id, 483 const cryptohome::AuthorizationRequest& auth,
480 const cryptohome::AuthorizationRequest& auth, 484 const cryptohome::CheckKeyRequest& request,
481 const cryptohome::CheckKeyRequest& request, 485 const ProtobufMethodCallback& callback) = 0;
482 const ProtobufMethodCallback& callback) = 0;
483 486
484 // Asynchronously calls MountEx method. |callback| is called after method 487 // Asynchronously calls MountEx method. |callback| is called after method
485 // call, and with reply protobuf. 488 // call, and with reply protobuf.
486 // MountEx attempts to mount home dir using given authorization, and can 489 // MountEx attempts to mount home dir using given authorization, and can
487 // create new home dir if necessary values are specified in |request|. 490 // create new home dir if necessary values are specified in |request|.
488 virtual void MountEx( 491 virtual void MountEx(const cryptohome::Identification& cryptohome_id,
489 const cryptohome::AccountIdentifier& id, 492 const cryptohome::AuthorizationRequest& auth,
490 const cryptohome::AuthorizationRequest& auth, 493 const cryptohome::MountRequest& request,
491 const cryptohome::MountRequest& request, 494 const ProtobufMethodCallback& callback) = 0;
492 const ProtobufMethodCallback& callback) = 0;
493 495
494 // Asynchronously calls AddKeyEx method. |callback| is called after method 496 // Asynchronously calls AddKeyEx method. |callback| is called after method
495 // call, and with reply protobuf. 497 // call, and with reply protobuf.
496 // AddKeyEx adds another key to the given key set. |request| also defines 498 // AddKeyEx adds another key to the given key set. |request| also defines
497 // behavior in case when key with specified label already exist. 499 // behavior in case when key with specified label already exist.
498 virtual void AddKeyEx( 500 virtual void AddKeyEx(const cryptohome::Identification& cryptohome_id,
499 const cryptohome::AccountIdentifier& id, 501 const cryptohome::AuthorizationRequest& auth,
500 const cryptohome::AuthorizationRequest& auth, 502 const cryptohome::AddKeyRequest& request,
501 const cryptohome::AddKeyRequest& request, 503 const ProtobufMethodCallback& callback) = 0;
502 const ProtobufMethodCallback& callback) = 0;
503 504
504 // Asynchronously calls UpdateKeyEx method. |callback| is called after method 505 // Asynchronously calls UpdateKeyEx method. |callback| is called after method
505 // call, and with reply protobuf. Reply will contain MountReply extension. 506 // call, and with reply protobuf. Reply will contain MountReply extension.
506 // UpdateKeyEx replaces key used for authorization, without affecting any 507 // UpdateKeyEx replaces key used for authorization, without affecting any
507 // other keys. If specified at home dir creation time, new key may have 508 // other keys. If specified at home dir creation time, new key may have
508 // to be signed and/or encrypted. 509 // to be signed and/or encrypted.
509 virtual void UpdateKeyEx( 510 virtual void UpdateKeyEx(const cryptohome::Identification& cryptohome_id,
510 const cryptohome::AccountIdentifier& id, 511 const cryptohome::AuthorizationRequest& auth,
511 const cryptohome::AuthorizationRequest& auth, 512 const cryptohome::UpdateKeyRequest& request,
512 const cryptohome::UpdateKeyRequest& request, 513 const ProtobufMethodCallback& callback) = 0;
513 const ProtobufMethodCallback& callback) = 0;
514 514
515 // Asynchronously calls RemoveKeyEx method. |callback| is called after method 515 // Asynchronously calls RemoveKeyEx method. |callback| is called after method
516 // call, and with reply protobuf. 516 // call, and with reply protobuf.
517 // RemoveKeyEx removes key from the given key set. 517 // RemoveKeyEx removes key from the given key set.
518 virtual void RemoveKeyEx(const cryptohome::AccountIdentifier& id, 518 virtual void RemoveKeyEx(const cryptohome::Identification& cryptohome_id,
519 const cryptohome::AuthorizationRequest& auth, 519 const cryptohome::AuthorizationRequest& auth,
520 const cryptohome::RemoveKeyRequest& request, 520 const cryptohome::RemoveKeyRequest& request,
521 const ProtobufMethodCallback& callback) = 0; 521 const ProtobufMethodCallback& callback) = 0;
522 522
523 // Asynchronously calls GetBootAttribute method. |callback| is called after 523 // Asynchronously calls GetBootAttribute method. |callback| is called after
524 // method call, and with reply protobuf. 524 // method call, and with reply protobuf.
525 // GetBootAttribute gets the value of the specified boot attribute. 525 // GetBootAttribute gets the value of the specified boot attribute.
526 virtual void GetBootAttribute( 526 virtual void GetBootAttribute(
527 const cryptohome::GetBootAttributeRequest& request, 527 const cryptohome::GetBootAttributeRequest& request,
528 const ProtobufMethodCallback& callback) = 0; 528 const ProtobufMethodCallback& callback) = 0;
(...skipping 19 matching lines...) Expand all
548 // Create() should be used instead. 548 // Create() should be used instead.
549 CryptohomeClient(); 549 CryptohomeClient();
550 550
551 private: 551 private:
552 DISALLOW_COPY_AND_ASSIGN(CryptohomeClient); 552 DISALLOW_COPY_AND_ASSIGN(CryptohomeClient);
553 }; 553 };
554 554
555 } // namespace chromeos 555 } // namespace chromeos
556 556
557 #endif // CHROMEOS_DBUS_CRYPTOHOME_CLIENT_H_ 557 #endif // CHROMEOS_DBUS_CRYPTOHOME_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698