| 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 14 matching lines...) Expand all Loading... |
| 25 class FlushAndSignBootAttributesRequest; | 25 class FlushAndSignBootAttributesRequest; |
| 26 class GetBootAttributeRequest; | 26 class GetBootAttributeRequest; |
| 27 class GetKeyDataRequest; | 27 class GetKeyDataRequest; |
| 28 class MountRequest; | 28 class MountRequest; |
| 29 class RemoveKeyRequest; | 29 class RemoveKeyRequest; |
| 30 class SetBootAttributeRequest; | 30 class SetBootAttributeRequest; |
| 31 class UpdateKeyRequest; | 31 class UpdateKeyRequest; |
| 32 | 32 |
| 33 } // namespace cryptohome | 33 } // namespace cryptohome |
| 34 | 34 |
| 35 namespace user_manager { |
| 36 class UserID; |
| 37 } // namespace user_manager |
| 38 |
| 35 namespace chromeos { | 39 namespace chromeos { |
| 36 | 40 |
| 37 // CryptohomeClient is used to communicate with the Cryptohome service. | 41 // CryptohomeClient is used to communicate with the Cryptohome service. |
| 38 // All method should be called from the origin thread (UI thread) which | 42 // All method should be called from the origin thread (UI thread) which |
| 39 // initializes the DBusThreadManager instance. | 43 // initializes the DBusThreadManager instance. |
| 40 class CHROMEOS_EXPORT CryptohomeClient : public DBusClient { | 44 class CHROMEOS_EXPORT CryptohomeClient : public DBusClient { |
| 41 public: | 45 public: |
| 42 // Constant that will be passed to AsyncMethodCallback to indicate that | 46 // Constant that will be passed to AsyncMethodCallback to indicate that |
| 43 // cryptohome is not ready yet. | 47 // cryptohome is not ready yet. |
| 44 static const int kNotReadyAsyncId; | 48 static const int kNotReadyAsyncId; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 bool result, | 90 bool result, |
| 87 const cryptohome::BaseReply& reply)> ProtobufMethodCallback; | 91 const cryptohome::BaseReply& reply)> ProtobufMethodCallback; |
| 88 | 92 |
| 89 ~CryptohomeClient() override; | 93 ~CryptohomeClient() override; |
| 90 | 94 |
| 91 // Factory function, creates a new instance and returns ownership. | 95 // Factory function, creates a new instance and returns ownership. |
| 92 // For normal usage, access the singleton via DBusThreadManager::Get(). | 96 // For normal usage, access the singleton via DBusThreadManager::Get(). |
| 93 static CryptohomeClient* Create(); | 97 static CryptohomeClient* Create(); |
| 94 | 98 |
| 95 // Returns the sanitized |username| that the stub implementation would return. | 99 // Returns the sanitized |username| that the stub implementation would return. |
| 96 static std::string GetStubSanitizedUsername(const std::string& username); | 100 static std::string GetStubSanitizedUsername(const user_manager::UserID& user_i
d); |
| 97 | 101 |
| 98 // Sets AsyncCallStatus signal handlers. | 102 // Sets AsyncCallStatus signal handlers. |
| 99 // |handler| is called when results for AsyncXXX methods are returned. | 103 // |handler| is called when results for AsyncXXX methods are returned. |
| 100 // 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 |
| 101 // when they are made in parallel. | 105 // when they are made in parallel. |
| 102 virtual void SetAsyncCallStatusHandlers( | 106 virtual void SetAsyncCallStatusHandlers( |
| 103 const AsyncCallStatusHandler& handler, | 107 const AsyncCallStatusHandler& handler, |
| 104 const AsyncCallStatusWithDataHandler& data_handler) = 0; | 108 const AsyncCallStatusWithDataHandler& data_handler) = 0; |
| 105 | 109 |
| 106 // Resets AsyncCallStatus signal handlers. | 110 // Resets AsyncCallStatus signal handlers. |
| 107 virtual void ResetAsyncCallStatusHandlers() = 0; | 111 virtual void ResetAsyncCallStatusHandlers() = 0; |
| 108 | 112 |
| 109 // Runs the callback as soon as the service becomes available. | 113 // Runs the callback as soon as the service becomes available. |
| 110 virtual void WaitForServiceToBeAvailable( | 114 virtual void WaitForServiceToBeAvailable( |
| 111 const WaitForServiceToBeAvailableCallback& callback) = 0; | 115 const WaitForServiceToBeAvailableCallback& callback) = 0; |
| 112 | 116 |
| 113 // Calls IsMounted method and returns true when the call succeeds. | 117 // Calls IsMounted method and returns true when the call succeeds. |
| 114 virtual void IsMounted(const BoolDBusMethodCallback& callback) = 0; | 118 virtual void IsMounted(const BoolDBusMethodCallback& callback) = 0; |
| 115 | 119 |
| 116 // Calls Unmount method and returns true when the call succeeds. | 120 // Calls Unmount method and returns true when the call succeeds. |
| 117 // This method blocks until the call returns. | 121 // This method blocks until the call returns. |
| 118 virtual bool Unmount(bool* success) = 0; | 122 virtual bool Unmount(bool* success) = 0; |
| 119 | 123 |
| 120 // Calls AsyncCheckKey method. |callback| is called after the method call | 124 // Calls AsyncCheckKey method. |callback| is called after the method call |
| 121 // succeeds. | 125 // succeeds. |
| 122 virtual void AsyncCheckKey(const std::string& username, | 126 virtual void AsyncCheckKey(const user_manager::UserID& user_id, |
| 123 const std::string& key, | 127 const std::string& key, |
| 124 const AsyncMethodCallback& callback) = 0; | 128 const AsyncMethodCallback& callback) = 0; |
| 125 | 129 |
| 126 // Calls AsyncMigrateKey method. |callback| is called after the method call | 130 // Calls AsyncMigrateKey method. |callback| is called after the method call |
| 127 // succeeds. | 131 // succeeds. |
| 128 virtual void AsyncMigrateKey(const std::string& username, | 132 virtual void AsyncMigrateKey(const user_manager::UserID& user_id, |
| 129 const std::string& from_key, | 133 const std::string& from_key, |
| 130 const std::string& to_key, | 134 const std::string& to_key, |
| 131 const AsyncMethodCallback& callback) = 0; | 135 const AsyncMethodCallback& callback) = 0; |
| 132 | 136 |
| 133 // Calls AsyncRemove method. |callback| is called after the method call | 137 // Calls AsyncRemove method. |callback| is called after the method call |
| 134 // succeeds. | 138 // succeeds. |
| 135 virtual void AsyncRemove(const std::string& username, | 139 virtual void AsyncRemove(const user_manager::UserID& user_id, |
| 136 const AsyncMethodCallback& callback) = 0; | 140 const AsyncMethodCallback& callback) = 0; |
| 137 | 141 |
| 138 // Calls GetSystemSalt method. |callback| is called after the method call | 142 // Calls GetSystemSalt method. |callback| is called after the method call |
| 139 // succeeds. | 143 // succeeds. |
| 140 virtual void GetSystemSalt(const GetSystemSaltCallback& callback) = 0; | 144 virtual void GetSystemSalt(const GetSystemSaltCallback& callback) = 0; |
| 141 | 145 |
| 142 // Calls GetSanitizedUsername method. |callback| is called after the method | 146 // Calls GetSanitizedUsername method. |callback| is called after the method |
| 143 // call succeeds. | 147 // call succeeds. |
| 144 virtual void GetSanitizedUsername( | 148 virtual void GetSanitizedUsername( |
| 145 const std::string& username, | 149 const user_manager::UserID& user_id, |
| 146 const StringDBusMethodCallback& callback) = 0; | 150 const StringDBusMethodCallback& callback) = 0; |
| 147 | 151 |
| 148 // Same as GetSanitizedUsername() but blocks until a reply is received, and | 152 // Same as GetSanitizedUsername() but blocks until a reply is received, and |
| 149 // returns the sanitized username synchronously. Returns an empty string if | 153 // returns the sanitized username synchronously. Returns an empty string if |
| 150 // the method call fails. | 154 // the method call fails. |
| 151 // This may only be called in situations where blocking the UI thread is | 155 // This may only be called in situations where blocking the UI thread is |
| 152 // considered acceptable (e.g. restarting the browser after a crash or after | 156 // considered acceptable (e.g. restarting the browser after a crash or after |
| 153 // a flag change). | 157 // a flag change). |
| 154 virtual std::string BlockingGetSanitizedUsername( | 158 virtual std::string BlockingGetSanitizedUsername( |
| 155 const std::string& username) = 0; | 159 const user_manager::UserID& user_id) = 0; |
| 156 | 160 |
| 157 // Calls the AsyncMount method to asynchronously mount the cryptohome for | 161 // Calls the AsyncMount method to asynchronously mount the cryptohome for |
| 158 // |username|, using |key| to unlock it. For supported |flags|, see the | 162 // |user_id|, using |key| to unlock it. For supported |flags|, see the |
| 159 // documentation of AsyncMethodCaller::AsyncMount(). | 163 // documentation of AsyncMethodCaller::AsyncMount(). |
| 160 // |callback| is called after the method call succeeds. | 164 // |callback| is called after the method call succeeds. |
| 161 virtual void AsyncMount(const std::string& username, | 165 virtual void AsyncMount(const user_manager::UserID& user_id, |
| 162 const std::string& key, | 166 const std::string& key, |
| 163 int flags, | 167 int flags, |
| 164 const AsyncMethodCallback& callback) = 0; | 168 const AsyncMethodCallback& callback) = 0; |
| 165 | 169 |
| 166 // Calls the AsyncAddKey method to asynchronously add another |new_key| for | 170 // Calls the AsyncAddKey method to asynchronously add another |new_key| for |
| 167 // |username|, using |key| to unlock it first. | 171 // |username|, using |key| to unlock it first. |
| 168 // |callback| is called after the method call succeeds. | 172 // |callback| is called after the method call succeeds. |
| 169 virtual void AsyncAddKey(const std::string& username, | 173 virtual void AsyncAddKey(const user_manager::UserID& user_id, |
| 170 const std::string& key, | 174 const std::string& key, |
| 171 const std::string& new_key, | 175 const std::string& new_key, |
| 172 const AsyncMethodCallback& callback) = 0; | 176 const AsyncMethodCallback& callback) = 0; |
| 173 | 177 |
| 174 // Calls AsyncMountGuest method. |callback| is called after the method call | 178 // Calls AsyncMountGuest method. |callback| is called after the method call |
| 175 // succeeds. | 179 // succeeds. |
| 176 virtual void AsyncMountGuest(const AsyncMethodCallback& callback) = 0; | 180 virtual void AsyncMountGuest(const AsyncMethodCallback& callback) = 0; |
| 177 | 181 |
| 178 // Calls the AsyncMount method to asynchronously mount the cryptohome for | 182 // Calls the AsyncMount method to asynchronously mount the cryptohome for |
| 179 // |public_mount_id|. For supported |flags|, see the documentation of | 183 // |public_mount_id|. For supported |flags|, see the documentation of |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 // receive PKCS #11 token information for the token associated with the user | 240 // receive PKCS #11 token information for the token associated with the user |
| 237 // who originally signed in (i.e. PKCS #11 slot 0). | 241 // who originally signed in (i.e. PKCS #11 slot 0). |
| 238 virtual void Pkcs11GetTpmTokenInfo( | 242 virtual void Pkcs11GetTpmTokenInfo( |
| 239 const Pkcs11GetTpmTokenInfoCallback& callback) = 0; | 243 const Pkcs11GetTpmTokenInfoCallback& callback) = 0; |
| 240 | 244 |
| 241 // Calls Pkcs11GetTpmTokenInfoForUser method. On success |callback| will | 245 // Calls Pkcs11GetTpmTokenInfoForUser method. On success |callback| will |
| 242 // receive PKCS #11 token information for the user identified by |user_email|. | 246 // receive PKCS #11 token information for the user identified by |user_email|. |
| 243 // The |user_email| must be a canonical email address as returned by | 247 // The |user_email| must be a canonical email address as returned by |
| 244 // user_manager::User::email(). | 248 // user_manager::User::email(). |
| 245 virtual void Pkcs11GetTpmTokenInfoForUser( | 249 virtual void Pkcs11GetTpmTokenInfoForUser( |
| 246 const std::string& user_email, | 250 const user_manager::UserID& user_id, |
| 247 const Pkcs11GetTpmTokenInfoCallback& callback) = 0; | 251 const Pkcs11GetTpmTokenInfoCallback& callback) = 0; |
| 248 | 252 |
| 249 // Calls InstallAttributesGet method and returns true when the call succeeds. | 253 // Calls InstallAttributesGet method and returns true when the call succeeds. |
| 250 // This method blocks until the call returns. | 254 // This method blocks until the call returns. |
| 251 // The original content of |value| is lost. | 255 // The original content of |value| is lost. |
| 252 virtual bool InstallAttributesGet(const std::string& name, | 256 virtual bool InstallAttributesGet(const std::string& name, |
| 253 std::vector<uint8>* value, | 257 std::vector<uint8>* value, |
| 254 bool* successful) = 0; | 258 bool* successful) = 0; |
| 255 | 259 |
| 256 // Calls InstallAttributesSet method and returns true when the call succeeds. | 260 // Calls InstallAttributesSet method and returns true when the call succeeds. |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 // provided. |callback| will be called when the dbus call completes. When | 315 // provided. |callback| will be called when the dbus call completes. When |
| 312 // the operation completes, the AsyncCallStatusWithDataHandler signal handler | 316 // the operation completes, the AsyncCallStatusWithDataHandler signal handler |
| 313 // is called. The data that is sent with the signal is a certificate request | 317 // is called. The data that is sent with the signal is a certificate request |
| 314 // to be sent to the Privacy CA of type |pca_type|. The certificate request | 318 // to be sent to the Privacy CA of type |pca_type|. The certificate request |
| 315 // is completed by calling AsyncTpmAttestationFinishCertRequest. The | 319 // is completed by calling AsyncTpmAttestationFinishCertRequest. The |
| 316 // |user_id| will not be included in the certificate request for the Privacy | 320 // |user_id| will not be included in the certificate request for the Privacy |
| 317 // CA. | 321 // CA. |
| 318 virtual void AsyncTpmAttestationCreateCertRequest( | 322 virtual void AsyncTpmAttestationCreateCertRequest( |
| 319 chromeos::attestation::PrivacyCAType pca_type, | 323 chromeos::attestation::PrivacyCAType pca_type, |
| 320 attestation::AttestationCertificateProfile certificate_profile, | 324 attestation::AttestationCertificateProfile certificate_profile, |
| 321 const std::string& user_id, | 325 const user_manager::UserID& user_id, |
| 322 const std::string& request_origin, | 326 const std::string& request_origin, |
| 323 const AsyncMethodCallback& callback) = 0; | 327 const AsyncMethodCallback& callback) = 0; |
| 324 | 328 |
| 325 // Asynchronously finishes a certificate request operation. The callback will | 329 // Asynchronously finishes a certificate request operation. The callback will |
| 326 // be called when the dbus call completes. When the operation completes, the | 330 // be called when the dbus call completes. When the operation completes, the |
| 327 // AsyncCallStatusWithDataHandler signal handler is called. The data that is | 331 // AsyncCallStatusWithDataHandler signal handler is called. The data that is |
| 328 // sent with the signal is a certificate chain in PEM format. |pca_response| | 332 // sent with the signal is a certificate chain in PEM format. |pca_response| |
| 329 // is the response to the certificate request emitted by the Privacy CA. | 333 // is the response to the certificate request emitted by the Privacy CA. |
| 330 // |key_type| determines whether the certified key is to be associated with | 334 // |key_type| determines whether the certified key is to be associated with |
| 331 // the current user. |key_name| is a name for the key. If |key_type| is | 335 // the current user. |key_name| is a name for the key. If |key_type| is |
| 332 // KEY_USER, a |user_id| must be provided. Otherwise |user_id| is ignored. | 336 // KEY_USER, a |user_id| must be provided. Otherwise |user_id| is ignored. |
| 333 // For normal GAIA users the |user_id| is a canonical email address. | 337 // For normal GAIA users the |user_id| is a canonical email address. |
| 334 virtual void AsyncTpmAttestationFinishCertRequest( | 338 virtual void AsyncTpmAttestationFinishCertRequest( |
| 335 const std::string& pca_response, | 339 const std::string& pca_response, |
| 336 attestation::AttestationKeyType key_type, | 340 attestation::AttestationKeyType key_type, |
| 337 const std::string& user_id, | 341 const user_manager::UserID& user_id, |
| 338 const std::string& key_name, | 342 const std::string& key_name, |
| 339 const AsyncMethodCallback& callback) = 0; | 343 const AsyncMethodCallback& callback) = 0; |
| 340 | 344 |
| 341 // Checks if an attestation key already exists. If the key specified by | 345 // Checks if an attestation key already exists. If the key specified by |
| 342 // |key_type| and |key_name| exists, then the result sent to the callback will | 346 // |key_type| and |key_name| exists, then the result sent to the callback will |
| 343 // be true. If |key_type| is KEY_USER, a |user_id| must be provided. | 347 // be true. If |key_type| is KEY_USER, a |user_id| must be provided. |
| 344 // Otherwise |user_id| is ignored. For normal GAIA users the |user_id| is a | 348 // Otherwise |user_id| is ignored. For normal GAIA users the |user_id| is a |
| 345 // canonical email address. | 349 // canonical email address. |
| 346 virtual void TpmAttestationDoesKeyExist( | 350 virtual void TpmAttestationDoesKeyExist( |
| 347 attestation::AttestationKeyType key_type, | 351 attestation::AttestationKeyType key_type, |
| 348 const std::string& user_id, | 352 const user_manager::UserID& user_id, |
| 349 const std::string& key_name, | 353 const std::string& key_name, |
| 350 const BoolDBusMethodCallback& callback) = 0; | 354 const BoolDBusMethodCallback& callback) = 0; |
| 351 | 355 |
| 352 // Gets the attestation certificate for the key specified by |key_type| and | 356 // Gets the attestation certificate for the key specified by |key_type| and |
| 353 // |key_name|. |callback| will be called when the operation completes. If | 357 // |key_name|. |callback| will be called when the operation completes. If |
| 354 // the key does not exist the callback |result| parameter will be false. If | 358 // the key does not exist the callback |result| parameter will be false. If |
| 355 // |key_type| is KEY_USER, a |user_id| must be provided. Otherwise |user_id| | 359 // |key_type| is KEY_USER, a |user_id| must be provided. Otherwise |user_id| |
| 356 // is ignored. For normal GAIA users the |user_id| is a canonical email | 360 // is ignored. For normal GAIA users the |user_id| is a canonical email |
| 357 // address. | 361 // address. |
| 358 virtual void TpmAttestationGetCertificate( | 362 virtual void TpmAttestationGetCertificate( |
| 359 attestation::AttestationKeyType key_type, | 363 attestation::AttestationKeyType key_type, |
| 360 const std::string& user_id, | 364 const user_manager::UserID& user_id, |
| 361 const std::string& key_name, | 365 const std::string& key_name, |
| 362 const DataMethodCallback& callback) = 0; | 366 const DataMethodCallback& callback) = 0; |
| 363 | 367 |
| 364 // Gets the public key for the key specified by |key_type| and |key_name|. | 368 // Gets the public key for the key specified by |key_type| and |key_name|. |
| 365 // |callback| will be called when the operation completes. If the key does | 369 // |callback| will be called when the operation completes. If the key does |
| 366 // not exist the callback |result| parameter will be false. If |key_type| is | 370 // not exist the callback |result| parameter will be false. If |key_type| is |
| 367 // KEY_USER, a |user_id| must be provided. Otherwise |user_id| is ignored. | 371 // KEY_USER, a |user_id| must be provided. Otherwise |user_id| is ignored. |
| 368 // For normal GAIA users the |user_id| is a canonical email address. | 372 // For normal GAIA users the |user_id| is a canonical email address. |
| 369 virtual void TpmAttestationGetPublicKey( | 373 virtual void TpmAttestationGetPublicKey( |
| 370 attestation::AttestationKeyType key_type, | 374 attestation::AttestationKeyType key_type, |
| 371 const std::string& user_id, | 375 const user_manager::UserID& user_id, |
| 372 const std::string& key_name, | 376 const std::string& key_name, |
| 373 const DataMethodCallback& callback) = 0; | 377 const DataMethodCallback& callback) = 0; |
| 374 | 378 |
| 375 // Asynchronously registers an attestation key with the current user's | 379 // Asynchronously registers an attestation key with the current user's |
| 376 // PKCS #11 token. The |callback| will be called when the dbus call | 380 // PKCS #11 token. The |callback| will be called when the dbus call |
| 377 // completes. When the operation completes, the AsyncCallStatusHandler signal | 381 // completes. When the operation completes, the AsyncCallStatusHandler signal |
| 378 // handler is called. |key_type| and |key_name| specify the key to register. | 382 // handler is called. |key_type| and |key_name| specify the key to register. |
| 379 // If |key_type| is KEY_USER, a |user_id| must be provided. Otherwise | 383 // If |key_type| is KEY_USER, a |user_id| must be provided. Otherwise |
| 380 // |user_id| is ignored. For normal GAIA users the |user_id| is a canonical | 384 // |user_id| is ignored. For normal GAIA users the |user_id| is a canonical |
| 381 // email address. | 385 // email address. |
| 382 virtual void TpmAttestationRegisterKey( | 386 virtual void TpmAttestationRegisterKey( |
| 383 attestation::AttestationKeyType key_type, | 387 attestation::AttestationKeyType key_type, |
| 384 const std::string& user_id, | 388 const user_manager::UserID& user_id, |
| 385 const std::string& key_name, | 389 const std::string& key_name, |
| 386 const AsyncMethodCallback& callback) = 0; | 390 const AsyncMethodCallback& callback) = 0; |
| 387 | 391 |
| 388 // Asynchronously signs an enterprise challenge with the key specified by | 392 // Asynchronously signs an enterprise challenge with the key specified by |
| 389 // |key_type| and |key_name|. |domain| and |device_id| will be included in | 393 // |key_type| and |key_name|. |domain| and |device_id| will be included in |
| 390 // the challenge response. |options| control how the challenge response is | 394 // the challenge response. |options| control how the challenge response is |
| 391 // generated. |challenge| must be a valid enterprise attestation challenge. | 395 // generated. |challenge| must be a valid enterprise attestation challenge. |
| 392 // The |callback| will be called when the dbus call completes. When the | 396 // The |callback| will be called when the dbus call completes. When the |
| 393 // operation completes, the AsyncCallStatusWithDataHandler signal handler is | 397 // operation completes, the AsyncCallStatusWithDataHandler signal handler is |
| 394 // called. If |key_type| is KEY_USER, a |user_id| must be provided. | 398 // called. If |key_type| is KEY_USER, a |user_id| must be provided. |
| 395 // Otherwise |user_id| is ignored. For normal GAIA users the |user_id| is a | 399 // Otherwise |user_id| is ignored. For normal GAIA users the |user_id| is a |
| 396 // canonical email address. | 400 // canonical email address. |
| 397 virtual void TpmAttestationSignEnterpriseChallenge( | 401 virtual void TpmAttestationSignEnterpriseChallenge( |
| 398 attestation::AttestationKeyType key_type, | 402 attestation::AttestationKeyType key_type, |
| 399 const std::string& user_id, | 403 const user_manager::UserID& user_id, |
| 400 const std::string& key_name, | 404 const std::string& key_name, |
| 401 const std::string& domain, | 405 const std::string& domain, |
| 402 const std::string& device_id, | 406 const std::string& device_id, |
| 403 attestation::AttestationChallengeOptions options, | 407 attestation::AttestationChallengeOptions options, |
| 404 const std::string& challenge, | 408 const std::string& challenge, |
| 405 const AsyncMethodCallback& callback) = 0; | 409 const AsyncMethodCallback& callback) = 0; |
| 406 | 410 |
| 407 // Asynchronously signs a simple challenge with the key specified by | 411 // Asynchronously signs a simple challenge with the key specified by |
| 408 // |key_type| and |key_name|. |challenge| can be any set of arbitrary bytes. | 412 // |key_type| and |key_name|. |challenge| can be any set of arbitrary bytes. |
| 409 // A nonce will be appended to the challenge before signing; this method | 413 // A nonce will be appended to the challenge before signing; this method |
| 410 // cannot be used to sign arbitrary data. The |callback| will be called when | 414 // cannot be used to sign arbitrary data. The |callback| will be called when |
| 411 // the dbus call completes. When the operation completes, the | 415 // the dbus call completes. When the operation completes, the |
| 412 // AsyncCallStatusWithDataHandler signal handler is called. If |key_type| is | 416 // AsyncCallStatusWithDataHandler signal handler is called. If |key_type| is |
| 413 // KEY_USER, a |user_id| must be provided. Otherwise |user_id| is ignored. | 417 // KEY_USER, a |user_id| must be provided. Otherwise |user_id| is ignored. |
| 414 // For normal GAIA users the |user_id| is a canonical email address. | 418 // For normal GAIA users the |user_id| is a canonical email address. |
| 415 virtual void TpmAttestationSignSimpleChallenge( | 419 virtual void TpmAttestationSignSimpleChallenge( |
| 416 attestation::AttestationKeyType key_type, | 420 attestation::AttestationKeyType key_type, |
| 417 const std::string& user_id, | 421 const user_manager::UserID& user_id, |
| 418 const std::string& key_name, | 422 const std::string& key_name, |
| 419 const std::string& challenge, | 423 const std::string& challenge, |
| 420 const AsyncMethodCallback& callback) = 0; | 424 const AsyncMethodCallback& callback) = 0; |
| 421 | 425 |
| 422 // Gets the payload associated with the key specified by |key_type| and | 426 // Gets the payload associated with the key specified by |key_type| and |
| 423 // |key_name|. The |callback| will be called when the operation completes. | 427 // |key_name|. The |callback| will be called when the operation completes. |
| 424 // If the key does not exist the callback |result| parameter will be false. | 428 // If the key does not exist the callback |result| parameter will be false. |
| 425 // If no payload has been set for the key the callback |result| parameter will | 429 // If no payload has been set for the key the callback |result| parameter will |
| 426 // be true and the |data| parameter will be empty. If |key_type| is | 430 // be true and the |data| parameter will be empty. If |key_type| is |
| 427 // KEY_USER, a |user_id| must be provided. Otherwise |user_id| is ignored. | 431 // KEY_USER, a |user_id| must be provided. Otherwise |user_id| is ignored. |
| 428 // For normal GAIA users the |user_id| is a canonical email address. | 432 // For normal GAIA users the |user_id| is a canonical email address. |
| 429 virtual void TpmAttestationGetKeyPayload( | 433 virtual void TpmAttestationGetKeyPayload( |
| 430 attestation::AttestationKeyType key_type, | 434 attestation::AttestationKeyType key_type, |
| 431 const std::string& user_id, | 435 const user_manager::UserID& user_id, |
| 432 const std::string& key_name, | 436 const std::string& key_name, |
| 433 const DataMethodCallback& callback) = 0; | 437 const DataMethodCallback& callback) = 0; |
| 434 | 438 |
| 435 // Sets the |payload| associated with the key specified by |key_type| and | 439 // Sets the |payload| associated with the key specified by |key_type| and |
| 436 // |key_name|. The |callback| will be called when the operation completes. | 440 // |key_name|. The |callback| will be called when the operation completes. |
| 437 // If the operation succeeds, the callback |result| parameter will be true. | 441 // If the operation succeeds, the callback |result| parameter will be true. |
| 438 // If |key_type| is KEY_USER, a |user_id| must be provided. Otherwise | 442 // If |key_type| is KEY_USER, a |user_id| must be provided. Otherwise |
| 439 // |user_id| is ignored. For normal GAIA users the |user_id| is a canonical | 443 // |user_id| is ignored. For normal GAIA users the |user_id| is a canonical |
| 440 // email address. | 444 // email address. |
| 441 virtual void TpmAttestationSetKeyPayload( | 445 virtual void TpmAttestationSetKeyPayload( |
| 442 attestation::AttestationKeyType key_type, | 446 attestation::AttestationKeyType key_type, |
| 443 const std::string& user_id, | 447 const user_manager::UserID& user_id, |
| 444 const std::string& key_name, | 448 const std::string& key_name, |
| 445 const std::string& payload, | 449 const std::string& payload, |
| 446 const BoolDBusMethodCallback& callback) = 0; | 450 const BoolDBusMethodCallback& callback) = 0; |
| 447 | 451 |
| 448 // Deletes certified keys as specified by |key_type| and |key_prefix|. The | 452 // Deletes certified keys as specified by |key_type| and |key_prefix|. The |
| 449 // |callback| will be called when the operation completes. If the operation | 453 // |callback| will be called when the operation completes. If the operation |
| 450 // succeeds, the callback |result| parameter will be true. If |key_type| is | 454 // succeeds, the callback |result| parameter will be true. If |key_type| is |
| 451 // KEY_USER, a |user_id| must be provided. Otherwise |user_id| is ignored. | 455 // KEY_USER, a |user_id| must be provided. Otherwise |user_id| is ignored. |
| 452 // For normal GAIA users the |user_id| is a canonical email address. All keys | 456 // For normal GAIA users the |user_id| is a canonical email address. All keys |
| 453 // where the key name has a prefix matching |key_prefix| will be deleted. All | 457 // where the key name has a prefix matching |key_prefix| will be deleted. All |
| 454 // meta-data associated with the key, including certificates, will also be | 458 // meta-data associated with the key, including certificates, will also be |
| 455 // deleted. | 459 // deleted. |
| 456 virtual void TpmAttestationDeleteKeys( | 460 virtual void TpmAttestationDeleteKeys( |
| 457 attestation::AttestationKeyType key_type, | 461 attestation::AttestationKeyType key_type, |
| 458 const std::string& user_id, | 462 const user_manager::UserID& user_id, |
| 459 const std::string& key_prefix, | 463 const std::string& key_prefix, |
| 460 const BoolDBusMethodCallback& callback) = 0; | 464 const BoolDBusMethodCallback& callback) = 0; |
| 461 | 465 |
| 462 // Asynchronously calls the GetKeyDataEx method. |callback| will be invoked | 466 // Asynchronously calls the GetKeyDataEx method. |callback| will be invoked |
| 463 // with the reply protobuf. | 467 // with the reply protobuf. |
| 464 // GetKeyDataEx returns information about the key specified in |request|. At | 468 // GetKeyDataEx returns information about the key specified in |request|. At |
| 465 // present, this does not include any secret information and the call should | 469 // present, this does not include any secret information and the call should |
| 466 // not be authenticated (|auth| should be empty). | 470 // not be authenticated (|auth| should be empty). |
| 467 virtual void GetKeyDataEx( | 471 virtual void GetKeyDataEx( |
| 468 const cryptohome::AccountIdentifier& id, | 472 const cryptohome::AccountIdentifier& id, |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 // Create() should be used instead. | 550 // Create() should be used instead. |
| 547 CryptohomeClient(); | 551 CryptohomeClient(); |
| 548 | 552 |
| 549 private: | 553 private: |
| 550 DISALLOW_COPY_AND_ASSIGN(CryptohomeClient); | 554 DISALLOW_COPY_AND_ASSIGN(CryptohomeClient); |
| 551 }; | 555 }; |
| 552 | 556 |
| 553 } // namespace chromeos | 557 } // namespace chromeos |
| 554 | 558 |
| 555 #endif // CHROMEOS_DBUS_CRYPTOHOME_CLIENT_H_ | 559 #endif // CHROMEOS_DBUS_CRYPTOHOME_CLIENT_H_ |
| OLD | NEW |