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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 22 class AccountIdentifier; | 22 class AccountIdentifier; |
| 23 class AddKeyRequest; | 23 class AddKeyRequest; |
| 24 class AuthorizationRequest; | 24 class AuthorizationRequest; |
| 25 class BaseReply; | 25 class BaseReply; |
| 26 class CheckKeyRequest; | 26 class CheckKeyRequest; |
| 27 class FlushAndSignBootAttributesRequest; | 27 class FlushAndSignBootAttributesRequest; |
| 28 class GetBootAttributeRequest; | 28 class GetBootAttributeRequest; |
| 29 class GetKeyDataRequest; | 29 class GetKeyDataRequest; |
| 30 class MountRequest; | 30 class MountRequest; |
| 31 class RemoveKeyRequest; | 31 class RemoveKeyRequest; |
| 32 class RenameRequest; | |
| 32 class SetBootAttributeRequest; | 33 class SetBootAttributeRequest; |
| 33 class UpdateKeyRequest; | 34 class UpdateKeyRequest; |
| 34 | 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. |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 130 virtual void AsyncMigrateKey(const std::string& username, | 131 virtual void AsyncMigrateKey(const std::string& username, |
| 131 const std::string& from_key, | 132 const std::string& from_key, |
| 132 const std::string& to_key, | 133 const std::string& to_key, |
| 133 const AsyncMethodCallback& callback) = 0; | 134 const AsyncMethodCallback& callback) = 0; |
| 134 | 135 |
| 135 // Calls AsyncRemove method. |callback| is called after the method call | 136 // Calls AsyncRemove method. |callback| is called after the method call |
| 136 // succeeds. | 137 // succeeds. |
| 137 virtual void AsyncRemove(const std::string& username, | 138 virtual void AsyncRemove(const std::string& username, |
| 138 const AsyncMethodCallback& callback) = 0; | 139 const AsyncMethodCallback& callback) = 0; |
| 139 | 140 |
| 141 // Calls RenameCryptohome method. |callback| is called after the method | |
| 142 // call succeeds. | |
| 143 virtual void RenameCryptohome(const cryptohome::AccountIdentifier& id_from, | |
| 144 const cryptohome::AccountIdentifier& id_to, | |
| 145 const ProtobufMethodCallback& callback) = 0; | |
| 146 | |
| 140 // Calls GetSystemSalt method. |callback| is called after the method call | 147 // Calls GetSystemSalt method. |callback| is called after the method call |
| 141 // succeeds. | 148 // succeeds. |
| 142 virtual void GetSystemSalt(const GetSystemSaltCallback& callback) = 0; | 149 virtual void GetSystemSalt(const GetSystemSaltCallback& callback) = 0; |
| 143 | 150 |
| 144 // Calls GetSanitizedUsername method. |callback| is called after the method | 151 // Calls GetSanitizedUsername method. |callback| is called after the method |
| 145 // call succeeds. | 152 // call succeeds. |
| 146 virtual void GetSanitizedUsername( | 153 virtual void GetSanitizedUsername( |
| 147 const std::string& username, | 154 const std::string& username, |
| 148 const StringDBusMethodCallback& callback) = 0; | 155 const StringDBusMethodCallback& callback) = 0; |
| 149 | 156 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 234 const BoolDBusMethodCallback& callback) = 0; | 241 const BoolDBusMethodCallback& callback) = 0; |
| 235 | 242 |
| 236 // Calls Pkcs11GetTpmTokenInfo method. This method is deprecated, you should | 243 // Calls Pkcs11GetTpmTokenInfo method. This method is deprecated, you should |
| 237 // use Pkcs11GetTpmTokenInfoForUser instead. On success |callback| will | 244 // use Pkcs11GetTpmTokenInfoForUser instead. On success |callback| will |
| 238 // receive PKCS #11 token information for the token associated with the user | 245 // receive PKCS #11 token information for the token associated with the user |
| 239 // who originally signed in (i.e. PKCS #11 slot 0). | 246 // who originally signed in (i.e. PKCS #11 slot 0). |
| 240 virtual void Pkcs11GetTpmTokenInfo( | 247 virtual void Pkcs11GetTpmTokenInfo( |
| 241 const Pkcs11GetTpmTokenInfoCallback& callback) = 0; | 248 const Pkcs11GetTpmTokenInfoCallback& callback) = 0; |
| 242 | 249 |
| 243 // Calls Pkcs11GetTpmTokenInfoForUser method. On success |callback| will | 250 // Calls Pkcs11GetTpmTokenInfoForUser method. On success |callback| will |
| 244 // receive PKCS #11 token information for the user identified by |user_email|. | 251 // receive PKCS #11 token information for the user identified by |user_id|. |
| 245 // The |user_email| must be a canonical email address as returned by | 252 // The |user_id| must be a valid cryptohome user id. |
|
Darren Krahn
2016/02/17 20:48:05
Please clarify what is a 'valid cryptohome user id
Alexander Alekseev
2016/02/18 13:45:15
This is now replaced with cryptohome::Identificati
| |
| 246 // user_manager::User::email(). | |
| 247 virtual void Pkcs11GetTpmTokenInfoForUser( | 253 virtual void Pkcs11GetTpmTokenInfoForUser( |
| 248 const std::string& user_email, | 254 const std::string& user_id, |
| 249 const Pkcs11GetTpmTokenInfoCallback& callback) = 0; | 255 const Pkcs11GetTpmTokenInfoCallback& callback) = 0; |
| 250 | 256 |
| 251 // Calls InstallAttributesGet method and returns true when the call succeeds. | 257 // Calls InstallAttributesGet method and returns true when the call succeeds. |
| 252 // This method blocks until the call returns. | 258 // This method blocks until the call returns. |
| 253 // The original content of |value| is lost. | 259 // The original content of |value| is lost. |
| 254 virtual bool InstallAttributesGet(const std::string& name, | 260 virtual bool InstallAttributesGet(const std::string& name, |
| 255 std::vector<uint8_t>* value, | 261 std::vector<uint8_t>* value, |
| 256 bool* successful) = 0; | 262 bool* successful) = 0; |
| 257 | 263 |
| 258 // Calls InstallAttributesSet method and returns true when the call succeeds. | 264 // Calls InstallAttributesSet method and returns true when the call succeeds. |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 325 const AsyncMethodCallback& callback) = 0; | 331 const AsyncMethodCallback& callback) = 0; |
| 326 | 332 |
| 327 // Asynchronously finishes a certificate request operation. The callback will | 333 // Asynchronously finishes a certificate request operation. The callback will |
| 328 // be called when the dbus call completes. When the operation completes, the | 334 // be called when the dbus call completes. When the operation completes, the |
| 329 // AsyncCallStatusWithDataHandler signal handler is called. The data that is | 335 // AsyncCallStatusWithDataHandler signal handler is called. The data that is |
| 330 // sent with the signal is a certificate chain in PEM format. |pca_response| | 336 // 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. | 337 // 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 | 338 // |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 | 339 // 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. | 340 // KEY_USER, a |user_id| must be provided. Otherwise |user_id| is ignored. |
| 335 // For normal GAIA users the |user_id| is a canonical email address. | 341 // The |user_id| must be a valid cryptohome user id. |
| 336 virtual void AsyncTpmAttestationFinishCertRequest( | 342 virtual void AsyncTpmAttestationFinishCertRequest( |
| 337 const std::string& pca_response, | 343 const std::string& pca_response, |
| 338 attestation::AttestationKeyType key_type, | 344 attestation::AttestationKeyType key_type, |
| 339 const std::string& user_id, | 345 const std::string& user_id, |
| 340 const std::string& key_name, | 346 const std::string& key_name, |
| 341 const AsyncMethodCallback& callback) = 0; | 347 const AsyncMethodCallback& callback) = 0; |
| 342 | 348 |
| 343 // Checks if an attestation key already exists. If the key specified by | 349 // 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 | 350 // |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. | 351 // be true. If |key_type| is KEY_USER, a |user_id| must be provided. |
| 346 // Otherwise |user_id| is ignored. For normal GAIA users the |user_id| is a | 352 // Otherwise |user_id| is ignored. |
| 347 // canonical email address. | 353 // The |user_id| must be a valid cryptohome user id. |
| 348 virtual void TpmAttestationDoesKeyExist( | 354 virtual void TpmAttestationDoesKeyExist( |
| 349 attestation::AttestationKeyType key_type, | 355 attestation::AttestationKeyType key_type, |
| 350 const std::string& user_id, | 356 const std::string& user_id, |
| 351 const std::string& key_name, | 357 const std::string& key_name, |
| 352 const BoolDBusMethodCallback& callback) = 0; | 358 const BoolDBusMethodCallback& callback) = 0; |
| 353 | 359 |
| 354 // Gets the attestation certificate for the key specified by |key_type| and | 360 // Gets the attestation certificate for the key specified by |key_type| and |
| 355 // |key_name|. |callback| will be called when the operation completes. If | 361 // |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 | 362 // 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| | 363 // |key_type| is KEY_USER, a |user_id| must be provided. Otherwise |user_id| |
| 358 // is ignored. For normal GAIA users the |user_id| is a canonical email | 364 // is ignored. |
| 359 // address. | 365 // The |user_id| must be a valid cryptohome user id. |
| 360 virtual void TpmAttestationGetCertificate( | 366 virtual void TpmAttestationGetCertificate( |
| 361 attestation::AttestationKeyType key_type, | 367 attestation::AttestationKeyType key_type, |
| 362 const std::string& user_id, | 368 const std::string& user_id, |
| 363 const std::string& key_name, | 369 const std::string& key_name, |
| 364 const DataMethodCallback& callback) = 0; | 370 const DataMethodCallback& callback) = 0; |
| 365 | 371 |
| 366 // Gets the public key for the key specified by |key_type| and |key_name|. | 372 // 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 | 373 // |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 | 374 // 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. | 375 // KEY_USER, a |user_id| must be provided. Otherwise |user_id| is ignored. |
| 370 // For normal GAIA users the |user_id| is a canonical email address. | 376 // The |user_id| must be a valid cryptohome user id. |
| 371 virtual void TpmAttestationGetPublicKey( | 377 virtual void TpmAttestationGetPublicKey( |
| 372 attestation::AttestationKeyType key_type, | 378 attestation::AttestationKeyType key_type, |
| 373 const std::string& user_id, | 379 const std::string& user_id, |
| 374 const std::string& key_name, | 380 const std::string& key_name, |
| 375 const DataMethodCallback& callback) = 0; | 381 const DataMethodCallback& callback) = 0; |
| 376 | 382 |
| 377 // Asynchronously registers an attestation key with the current user's | 383 // Asynchronously registers an attestation key with the current user's |
| 378 // PKCS #11 token. The |callback| will be called when the dbus call | 384 // PKCS #11 token. The |callback| will be called when the dbus call |
| 379 // completes. When the operation completes, the AsyncCallStatusHandler signal | 385 // completes. When the operation completes, the AsyncCallStatusHandler signal |
| 380 // handler is called. |key_type| and |key_name| specify the key to register. | 386 // 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 | 387 // If |key_type| is KEY_USER, a |user_id| must be provided. Otherwise |
| 382 // |user_id| is ignored. For normal GAIA users the |user_id| is a canonical | 388 // |user_id| is ignored. |
| 383 // email address. | 389 // The |user_id| must be a valid cryptohome user id. |
| 384 virtual void TpmAttestationRegisterKey( | 390 virtual void TpmAttestationRegisterKey( |
| 385 attestation::AttestationKeyType key_type, | 391 attestation::AttestationKeyType key_type, |
| 386 const std::string& user_id, | 392 const std::string& user_id, |
| 387 const std::string& key_name, | 393 const std::string& key_name, |
| 388 const AsyncMethodCallback& callback) = 0; | 394 const AsyncMethodCallback& callback) = 0; |
| 389 | 395 |
| 390 // Asynchronously signs an enterprise challenge with the key specified by | 396 // Asynchronously signs an enterprise challenge with the key specified by |
| 391 // |key_type| and |key_name|. |domain| and |device_id| will be included in | 397 // |key_type| and |key_name|. |domain| and |device_id| will be included in |
| 392 // the challenge response. |options| control how the challenge response is | 398 // the challenge response. |options| control how the challenge response is |
| 393 // generated. |challenge| must be a valid enterprise attestation challenge. | 399 // generated. |challenge| must be a valid enterprise attestation challenge. |
| 394 // The |callback| will be called when the dbus call completes. When the | 400 // The |callback| will be called when the dbus call completes. When the |
| 395 // operation completes, the AsyncCallStatusWithDataHandler signal handler is | 401 // operation completes, the AsyncCallStatusWithDataHandler signal handler is |
| 396 // called. If |key_type| is KEY_USER, a |user_id| must be provided. | 402 // called. If |key_type| is KEY_USER, a |user_id| must be provided. |
| 397 // Otherwise |user_id| is ignored. For normal GAIA users the |user_id| is a | 403 // Otherwise |user_id| is ignored. |
| 398 // canonical email address. | 404 // The |user_id| must be a valid cryptohome user id. |
| 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 std::string& user_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 |user_id| must be provided. Otherwise |user_id| is ignored. |
| 416 // For normal GAIA users the |user_id| is a canonical email address. | 422 // The |user_id| must be a valid cryptohome user id. |
| 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 std::string& user_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 |user_id| must be provided. Otherwise |user_id| is ignored. |
| 430 // For normal GAIA users the |user_id| is a canonical email address. | 436 // The |user_id| must be a valid cryptohome user id. |
| 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 std::string& user_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 |user_id| must be provided. Otherwise |
| 441 // |user_id| is ignored. For normal GAIA users the |user_id| is a canonical | 447 // |user_id| is ignored. |
| 442 // email address. | 448 // The |user_id| must be a valid cryptohome user id. |
| 443 virtual void TpmAttestationSetKeyPayload( | 449 virtual void TpmAttestationSetKeyPayload( |
| 444 attestation::AttestationKeyType key_type, | 450 attestation::AttestationKeyType key_type, |
| 445 const std::string& user_id, | 451 const std::string& user_id, |
| 446 const std::string& key_name, | 452 const std::string& key_name, |
| 447 const std::string& payload, | 453 const std::string& payload, |
| 448 const BoolDBusMethodCallback& callback) = 0; | 454 const BoolDBusMethodCallback& callback) = 0; |
| 449 | 455 |
| 450 // Deletes certified keys as specified by |key_type| and |key_prefix|. The | 456 // Deletes certified keys as specified by |key_type| and |key_prefix|. The |
| 451 // |callback| will be called when the operation completes. If the operation | 457 // |callback| will be called when the operation completes. If the operation |
| 452 // succeeds, the callback |result| parameter will be true. If |key_type| is | 458 // 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. | 459 // KEY_USER, a |user_id| must be provided. Otherwise |user_id| is ignored. |
| 454 // For normal GAIA users the |user_id| is a canonical email address. All keys | 460 // The |user_id| must be a valid cryptohome user id. All keys |
| 455 // where the key name has a prefix matching |key_prefix| will be deleted. All | 461 // where the key name has a prefix matching |key_prefix| will be deleted. All |
| 456 // meta-data associated with the key, including certificates, will also be | 462 // meta-data associated with the key, including certificates, will also be |
| 457 // deleted. | 463 // deleted. |
| 458 virtual void TpmAttestationDeleteKeys( | 464 virtual void TpmAttestationDeleteKeys( |
| 459 attestation::AttestationKeyType key_type, | 465 attestation::AttestationKeyType key_type, |
| 460 const std::string& user_id, | 466 const std::string& user_id, |
| 461 const std::string& key_prefix, | 467 const std::string& key_prefix, |
| 462 const BoolDBusMethodCallback& callback) = 0; | 468 const BoolDBusMethodCallback& callback) = 0; |
| 463 | 469 |
| 464 // Asynchronously calls the GetKeyDataEx method. |callback| will be invoked | 470 // Asynchronously calls the GetKeyDataEx method. |callback| will be invoked |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 548 // Create() should be used instead. | 554 // Create() should be used instead. |
| 549 CryptohomeClient(); | 555 CryptohomeClient(); |
| 550 | 556 |
| 551 private: | 557 private: |
| 552 DISALLOW_COPY_AND_ASSIGN(CryptohomeClient); | 558 DISALLOW_COPY_AND_ASSIGN(CryptohomeClient); |
| 553 }; | 559 }; |
| 554 | 560 |
| 555 } // namespace chromeos | 561 } // namespace chromeos |
| 556 | 562 |
| 557 #endif // CHROMEOS_DBUS_CRYPTOHOME_CLIENT_H_ | 563 #endif // CHROMEOS_DBUS_CRYPTOHOME_CLIENT_H_ |
| OLD | NEW |