| 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> |
| 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 Loading... |
| 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 |
| 140 // Calls GetSystemSalt method. |callback| is called after the method call | 142 // Calls GetSystemSalt method. |callback| is called after the method call |
| 141 // succeeds. | 143 // succeeds. |
| 142 virtual void GetSystemSalt(const GetSystemSaltCallback& callback) = 0; | 144 virtual void GetSystemSalt(const GetSystemSaltCallback& callback) = 0; |
| 143 | 145 |
| 144 // Calls GetSanitizedUsername method. |callback| is called after the method | 146 // Calls GetSanitizedUsername method. |callback| is called after the method |
| 145 // call succeeds. | 147 // call succeeds. |
| 146 virtual void GetSanitizedUsername( | 148 virtual void GetSanitizedUsername( |
| 147 const std::string& username, | 149 const cryptohome::Identification& cryptohome_id, |
| 148 const StringDBusMethodCallback& callback) = 0; | 150 const StringDBusMethodCallback& callback) = 0; |
| 149 | 151 |
| 150 // Same as GetSanitizedUsername() but blocks until a reply is received, and | 152 // Same as GetSanitizedUsername() but blocks until a reply is received, and |
| 151 // returns the sanitized username synchronously. Returns an empty string if | 153 // returns the sanitized username synchronously. Returns an empty string if |
| 152 // the method call fails. | 154 // the method call fails. |
| 153 // 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 |
| 154 // 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 |
| 155 // a flag change). | 157 // a flag change). |
| 156 virtual std::string BlockingGetSanitizedUsername( | 158 virtual std::string BlockingGetSanitizedUsername( |
| 157 const std::string& username) = 0; | 159 const cryptohome::Identification& cryptohome_id) = 0; |
| 158 | 160 |
| 159 // Calls the AsyncMount method to asynchronously mount the cryptohome for | 161 // Calls the AsyncMount method to asynchronously mount the cryptohome for |
| 160 // |username|, using |key| to unlock it. For supported |flags|, see the | 162 // |username|, using |key| to unlock it. For supported |flags|, see the |
| 161 // documentation of AsyncMethodCaller::AsyncMount(). | 163 // documentation of AsyncMethodCaller::AsyncMount(). |
| 162 // |callback| is called after the method call succeeds. | 164 // |callback| is called after the method call succeeds. |
| 163 virtual void AsyncMount(const std::string& username, | 165 virtual void AsyncMount(const cryptohome::Identification& cryptohome_id, |
| 164 const std::string& key, | 166 const std::string& key, |
| 165 int flags, | 167 int flags, |
| 166 const AsyncMethodCallback& callback) = 0; | 168 const AsyncMethodCallback& callback) = 0; |
| 167 | 169 |
| 168 // Calls the AsyncAddKey method to asynchronously add another |new_key| for | 170 // Calls the AsyncAddKey method to asynchronously add another |new_key| for |
| 169 // |username|, using |key| to unlock it first. | 171 // |username|, using |key| to unlock it first. |
| 170 // |callback| is called after the method call succeeds. | 172 // |callback| is called after the method call succeeds. |
| 171 virtual void AsyncAddKey(const std::string& username, | 173 virtual void AsyncAddKey(const cryptohome::Identification& cryptohome_id, |
| 172 const std::string& key, | 174 const std::string& key, |
| 173 const std::string& new_key, | 175 const std::string& new_key, |
| 174 const AsyncMethodCallback& callback) = 0; | 176 const AsyncMethodCallback& callback) = 0; |
| 175 | 177 |
| 176 // Calls AsyncMountGuest method. |callback| is called after the method call | 178 // Calls AsyncMountGuest method. |callback| is called after the method call |
| 177 // succeeds. | 179 // succeeds. |
| 178 virtual void AsyncMountGuest(const AsyncMethodCallback& callback) = 0; | 180 virtual void AsyncMountGuest(const AsyncMethodCallback& callback) = 0; |
| 179 | 181 |
| 180 // Calls the AsyncMount method to asynchronously mount the cryptohome for | 182 // Calls the AsyncMount method to asynchronously mount the cryptohome for |
| 181 // |public_mount_id|. For supported |flags|, see the documentation of | 183 // |public_mount_id|. For supported |flags|, see the documentation of |
| 182 // AsyncMethodCaller::AsyncMount(). |callback| is called after the method | 184 // AsyncMethodCaller::AsyncMount(). |callback| is called after the method |
| 183 // call succeeds. | 185 // call succeeds. |
| 184 virtual void AsyncMountPublic(const std::string& public_mount_id, | 186 virtual void AsyncMountPublic( |
| 185 int flags, | 187 const cryptohome::Identification& public_mount_id, |
| 186 const AsyncMethodCallback& callback) = 0; | 188 int flags, |
| 189 const AsyncMethodCallback& callback) = 0; |
| 187 | 190 |
| 188 // Calls TpmIsReady method. | 191 // Calls TpmIsReady method. |
| 189 virtual void TpmIsReady(const BoolDBusMethodCallback& callback) = 0; | 192 virtual void TpmIsReady(const BoolDBusMethodCallback& callback) = 0; |
| 190 | 193 |
| 191 // Calls TpmIsEnabled method. | 194 // Calls TpmIsEnabled method. |
| 192 virtual void TpmIsEnabled(const BoolDBusMethodCallback& callback) = 0; | 195 virtual void TpmIsEnabled(const BoolDBusMethodCallback& callback) = 0; |
| 193 | 196 |
| 194 // Calls TpmIsEnabled method and returns true when the call succeeds. | 197 // Calls TpmIsEnabled method and returns true when the call succeeds. |
| 195 // This method blocks until the call returns. | 198 // This method blocks until the call returns. |
| 196 // TODO(hashimoto): Remove this method. crbug.com/141006 | 199 // TODO(hashimoto): Remove this method. crbug.com/141006 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 const BoolDBusMethodCallback& callback) = 0; | 237 const BoolDBusMethodCallback& callback) = 0; |
| 235 | 238 |
| 236 // Calls Pkcs11GetTpmTokenInfo method. This method is deprecated, you should | 239 // Calls Pkcs11GetTpmTokenInfo method. This method is deprecated, you should |
| 237 // use Pkcs11GetTpmTokenInfoForUser instead. On success |callback| will | 240 // use Pkcs11GetTpmTokenInfoForUser instead. On success |callback| will |
| 238 // receive PKCS #11 token information for the token associated with the user | 241 // receive PKCS #11 token information for the token associated with the user |
| 239 // who originally signed in (i.e. PKCS #11 slot 0). | 242 // who originally signed in (i.e. PKCS #11 slot 0). |
| 240 virtual void Pkcs11GetTpmTokenInfo( | 243 virtual void Pkcs11GetTpmTokenInfo( |
| 241 const Pkcs11GetTpmTokenInfoCallback& callback) = 0; | 244 const Pkcs11GetTpmTokenInfoCallback& callback) = 0; |
| 242 | 245 |
| 243 // Calls Pkcs11GetTpmTokenInfoForUser method. On success |callback| will | 246 // Calls Pkcs11GetTpmTokenInfoForUser method. On success |callback| will |
| 244 // receive PKCS #11 token information for the user identified by |user_email|. | 247 // receive PKCS #11 token information for the user identified by |
| 245 // The |user_email| must be a canonical email address as returned by | 248 // |cryptohome_id|. |
| 246 // user_manager::User::email(). | |
| 247 virtual void Pkcs11GetTpmTokenInfoForUser( | 249 virtual void Pkcs11GetTpmTokenInfoForUser( |
| 248 const std::string& user_email, | 250 const cryptohome::Identification& cryptohome_id, |
| 249 const Pkcs11GetTpmTokenInfoCallback& callback) = 0; | 251 const Pkcs11GetTpmTokenInfoCallback& callback) = 0; |
| 250 | 252 |
| 251 // Calls InstallAttributesGet method and returns true when the call succeeds. | 253 // Calls InstallAttributesGet method and returns true when the call succeeds. |
| 252 // This method blocks until the call returns. | 254 // This method blocks until the call returns. |
| 253 // The original content of |value| is lost. | 255 // The original content of |value| is lost. |
| 254 virtual bool InstallAttributesGet(const std::string& name, | 256 virtual bool InstallAttributesGet(const std::string& name, |
| 255 std::vector<uint8_t>* value, | 257 std::vector<uint8_t>* value, |
| 256 bool* successful) = 0; | 258 bool* successful) = 0; |
| 257 | 259 |
| 258 // Calls InstallAttributesSet method and returns true when the call succeeds. | 260 // Calls InstallAttributesSet method and returns true when the call succeeds. |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 // will be called when the dbus call completes. When the operation completes, | 303 // will be called when the dbus call completes. When the operation completes, |
| 302 // the AsyncCallStatusHandler signal handler is called. |pca_response| is the | 304 // the AsyncCallStatusHandler signal handler is called. |pca_response| is the |
| 303 // response to the enrollment request emitted by the Privacy CA of type | 305 // response to the enrollment request emitted by the Privacy CA of type |
| 304 // |pca_type|. | 306 // |pca_type|. |
| 305 virtual void AsyncTpmAttestationEnroll( | 307 virtual void AsyncTpmAttestationEnroll( |
| 306 chromeos::attestation::PrivacyCAType pca_type, | 308 chromeos::attestation::PrivacyCAType pca_type, |
| 307 const std::string& pca_response, | 309 const std::string& pca_response, |
| 308 const AsyncMethodCallback& callback) = 0; | 310 const AsyncMethodCallback& callback) = 0; |
| 309 | 311 |
| 310 // Asynchronously creates an attestation certificate request according to | 312 // Asynchronously creates an attestation certificate request according to |
| 311 // |certificate_profile|. Some profiles require that the |user_id| of the | 313 // |certificate_profile|. Some profiles require that the |cryptohome_id| of |
| 312 // currently active user and an identifier of the |request_origin| be | 314 // the currently active user and an identifier of the |request_origin| be |
| 313 // provided. |callback| will be called when the dbus call completes. When | 315 // provided. |callback| will be called when the dbus call completes. When |
| 314 // the operation completes, the AsyncCallStatusWithDataHandler signal handler | 316 // the operation completes, the AsyncCallStatusWithDataHandler signal handler |
| 315 // 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 |
| 316 // 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 |
| 317 // is completed by calling AsyncTpmAttestationFinishCertRequest. The | 319 // is completed by calling AsyncTpmAttestationFinishCertRequest. The |
| 318 // |user_id| will not be included in the certificate request for the Privacy | 320 // |cryptohome_id| will not be included in the certificate request for the |
| 319 // CA. | 321 // Privacy CA. |
| 320 virtual void AsyncTpmAttestationCreateCertRequest( | 322 virtual void AsyncTpmAttestationCreateCertRequest( |
| 321 chromeos::attestation::PrivacyCAType pca_type, | 323 chromeos::attestation::PrivacyCAType pca_type, |
| 322 attestation::AttestationCertificateProfile certificate_profile, | 324 attestation::AttestationCertificateProfile certificate_profile, |
| 323 const std::string& user_id, | 325 const cryptohome::Identification& cryptohome_id, |
| 324 const std::string& request_origin, | 326 const std::string& request_origin, |
| 325 const AsyncMethodCallback& callback) = 0; | 327 const AsyncMethodCallback& callback) = 0; |
| 326 | 328 |
| 327 // Asynchronously finishes a certificate request operation. The callback will | 329 // Asynchronously finishes a certificate request operation. The callback will |
| 328 // 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 |
| 329 // AsyncCallStatusWithDataHandler signal handler is called. The data that is | 331 // AsyncCallStatusWithDataHandler signal handler is called. The data that is |
| 330 // 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| |
| 331 // 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. |
| 332 // |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 |
| 333 // 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 |
| 334 // KEY_USER, a |user_id| must be provided. Otherwise |user_id| is ignored. | 336 // KEY_USER, a |cryptohome_id| must be provided. Otherwise |cryptohome_id| |
| 335 // For normal GAIA users the |user_id| is a canonical email address. | 337 // is ignored. |
| 336 virtual void AsyncTpmAttestationFinishCertRequest( | 338 virtual void AsyncTpmAttestationFinishCertRequest( |
| 337 const std::string& pca_response, | 339 const std::string& pca_response, |
| 338 attestation::AttestationKeyType key_type, | 340 attestation::AttestationKeyType key_type, |
| 339 const std::string& user_id, | 341 const cryptohome::Identification& cryptohome_id, |
| 340 const std::string& key_name, | 342 const std::string& key_name, |
| 341 const AsyncMethodCallback& callback) = 0; | 343 const AsyncMethodCallback& callback) = 0; |
| 342 | 344 |
| 343 // 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 |
| 344 // |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 |
| 345 // be true. If |key_type| is KEY_USER, a |user_id| must be provided. | 347 // 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 | 348 // Otherwise |cryptohome_id| is ignored. |
| 347 // canonical email address. | |
| 348 virtual void TpmAttestationDoesKeyExist( | 349 virtual void TpmAttestationDoesKeyExist( |
| 349 attestation::AttestationKeyType key_type, | 350 attestation::AttestationKeyType key_type, |
| 350 const std::string& user_id, | 351 const cryptohome::Identification& cryptohome_id, |
| 351 const std::string& key_name, | 352 const std::string& key_name, |
| 352 const BoolDBusMethodCallback& callback) = 0; | 353 const BoolDBusMethodCallback& callback) = 0; |
| 353 | 354 |
| 354 // Gets the attestation certificate for the key specified by |key_type| and | 355 // Gets the attestation certificate for the key specified by |key_type| and |
| 355 // |key_name|. |callback| will be called when the operation completes. If | 356 // |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 | 357 // 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| | 358 // |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 | 359 // |cryptohome_id| |
| 359 // address. | 360 // is ignored. |
| 360 virtual void TpmAttestationGetCertificate( | 361 virtual void TpmAttestationGetCertificate( |
| 361 attestation::AttestationKeyType key_type, | 362 attestation::AttestationKeyType key_type, |
| 362 const std::string& user_id, | 363 const cryptohome::Identification& cryptohome_id, |
| 363 const std::string& key_name, | 364 const std::string& key_name, |
| 364 const DataMethodCallback& callback) = 0; | 365 const DataMethodCallback& callback) = 0; |
| 365 | 366 |
| 366 // Gets the public key for the key specified by |key_type| and |key_name|. | 367 // 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 | 368 // |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 | 369 // 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. | 370 // KEY_USER, a |cryptohome_id| must be provided. Otherwise |cryptohome_id| |
| 370 // For normal GAIA users the |user_id| is a canonical email address. | 371 // is ignored. |
| 371 virtual void TpmAttestationGetPublicKey( | 372 virtual void TpmAttestationGetPublicKey( |
| 372 attestation::AttestationKeyType key_type, | 373 attestation::AttestationKeyType key_type, |
| 373 const std::string& user_id, | 374 const cryptohome::Identification& cryptohome_id, |
| 374 const std::string& key_name, | 375 const std::string& key_name, |
| 375 const DataMethodCallback& callback) = 0; | 376 const DataMethodCallback& callback) = 0; |
| 376 | 377 |
| 377 // Asynchronously registers an attestation key with the current user's | 378 // Asynchronously registers an attestation key with the current user's |
| 378 // PKCS #11 token. The |callback| will be called when the dbus call | 379 // PKCS #11 token. The |callback| will be called when the dbus call |
| 379 // completes. When the operation completes, the AsyncCallStatusHandler signal | 380 // completes. When the operation completes, the AsyncCallStatusHandler signal |
| 380 // handler is called. |key_type| and |key_name| specify the key to register. | 381 // 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 | 382 // 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 | 383 // |cryptohome_id| is ignored. |
| 383 // email address. | |
| 384 virtual void TpmAttestationRegisterKey( | 384 virtual void TpmAttestationRegisterKey( |
| 385 attestation::AttestationKeyType key_type, | 385 attestation::AttestationKeyType key_type, |
| 386 const std::string& user_id, | 386 const cryptohome::Identification& cryptohome_id, |
| 387 const std::string& key_name, | 387 const std::string& key_name, |
| 388 const AsyncMethodCallback& callback) = 0; | 388 const AsyncMethodCallback& callback) = 0; |
| 389 | 389 |
| 390 // Asynchronously signs an enterprise challenge with the key specified by | 390 // Asynchronously signs an enterprise challenge with the key specified by |
| 391 // |key_type| and |key_name|. |domain| and |device_id| will be included in | 391 // |key_type| and |key_name|. |domain| and |device_id| will be included in |
| 392 // the challenge response. |options| control how the challenge response is | 392 // the challenge response. |options| control how the challenge response is |
| 393 // generated. |challenge| must be a valid enterprise attestation challenge. | 393 // generated. |challenge| must be a valid enterprise attestation challenge. |
| 394 // The |callback| will be called when the dbus call completes. When the | 394 // The |callback| will be called when the dbus call completes. When the |
| 395 // operation completes, the AsyncCallStatusWithDataHandler signal handler is | 395 // operation completes, the AsyncCallStatusWithDataHandler signal handler is |
| 396 // called. If |key_type| is KEY_USER, a |user_id| must be provided. | 396 // 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 | 397 // Otherwise |cryptohome_id| is ignored. |
| 398 // canonical email address. | |
| 399 virtual void TpmAttestationSignEnterpriseChallenge( | 398 virtual void TpmAttestationSignEnterpriseChallenge( |
| 400 attestation::AttestationKeyType key_type, | 399 attestation::AttestationKeyType key_type, |
| 401 const std::string& user_id, | 400 const cryptohome::Identification& cryptohome_id, |
| 402 const std::string& key_name, | 401 const std::string& key_name, |
| 403 const std::string& domain, | 402 const std::string& domain, |
| 404 const std::string& device_id, | 403 const std::string& device_id, |
| 405 attestation::AttestationChallengeOptions options, | 404 attestation::AttestationChallengeOptions options, |
| 406 const std::string& challenge, | 405 const std::string& challenge, |
| 407 const AsyncMethodCallback& callback) = 0; | 406 const AsyncMethodCallback& callback) = 0; |
| 408 | 407 |
| 409 // Asynchronously signs a simple challenge with the key specified by | 408 // Asynchronously signs a simple challenge with the key specified by |
| 410 // |key_type| and |key_name|. |challenge| can be any set of arbitrary bytes. | 409 // |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 | 410 // 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 | 411 // cannot be used to sign arbitrary data. The |callback| will be called when |
| 413 // the dbus call completes. When the operation completes, the | 412 // the dbus call completes. When the operation completes, the |
| 414 // AsyncCallStatusWithDataHandler signal handler is called. If |key_type| is | 413 // AsyncCallStatusWithDataHandler signal handler is called. If |key_type| is |
| 415 // KEY_USER, a |user_id| must be provided. Otherwise |user_id| is ignored. | 414 // KEY_USER, a |cryptohome_id| must be provided. Otherwise |cryptohome_id| |
| 416 // For normal GAIA users the |user_id| is a canonical email address. | 415 // is ignored. |
| 417 virtual void TpmAttestationSignSimpleChallenge( | 416 virtual void TpmAttestationSignSimpleChallenge( |
| 418 attestation::AttestationKeyType key_type, | 417 attestation::AttestationKeyType key_type, |
| 419 const std::string& user_id, | 418 const cryptohome::Identification& cryptohome_id, |
| 420 const std::string& key_name, | 419 const std::string& key_name, |
| 421 const std::string& challenge, | 420 const std::string& challenge, |
| 422 const AsyncMethodCallback& callback) = 0; | 421 const AsyncMethodCallback& callback) = 0; |
| 423 | 422 |
| 424 // Gets the payload associated with the key specified by |key_type| and | 423 // Gets the payload associated with the key specified by |key_type| and |
| 425 // |key_name|. The |callback| will be called when the operation completes. | 424 // |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. | 425 // 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 | 426 // 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 | 427 // 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. | 428 // KEY_USER, a |cryptohome_id| must be provided. Otherwise |cryptohome_id| |
| 430 // For normal GAIA users the |user_id| is a canonical email address. | 429 // is ignored. |
| 431 virtual void TpmAttestationGetKeyPayload( | 430 virtual void TpmAttestationGetKeyPayload( |
| 432 attestation::AttestationKeyType key_type, | 431 attestation::AttestationKeyType key_type, |
| 433 const std::string& user_id, | 432 const cryptohome::Identification& cryptohome_id, |
| 434 const std::string& key_name, | 433 const std::string& key_name, |
| 435 const DataMethodCallback& callback) = 0; | 434 const DataMethodCallback& callback) = 0; |
| 436 | 435 |
| 437 // Sets the |payload| associated with the key specified by |key_type| and | 436 // Sets the |payload| associated with the key specified by |key_type| and |
| 438 // |key_name|. The |callback| will be called when the operation completes. | 437 // |key_name|. The |callback| will be called when the operation completes. |
| 439 // If the operation succeeds, the callback |result| parameter will be true. | 438 // 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 | 439 // 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 | 440 // |cryptohome_id| is ignored. |
| 442 // email address. | |
| 443 virtual void TpmAttestationSetKeyPayload( | 441 virtual void TpmAttestationSetKeyPayload( |
| 444 attestation::AttestationKeyType key_type, | 442 attestation::AttestationKeyType key_type, |
| 445 const std::string& user_id, | 443 const cryptohome::Identification& cryptohome_id, |
| 446 const std::string& key_name, | 444 const std::string& key_name, |
| 447 const std::string& payload, | 445 const std::string& payload, |
| 448 const BoolDBusMethodCallback& callback) = 0; | 446 const BoolDBusMethodCallback& callback) = 0; |
| 449 | 447 |
| 450 // Deletes certified keys as specified by |key_type| and |key_prefix|. The | 448 // Deletes certified keys as specified by |key_type| and |key_prefix|. The |
| 451 // |callback| will be called when the operation completes. If the operation | 449 // |callback| will be called when the operation completes. If the operation |
| 452 // succeeds, the callback |result| parameter will be true. If |key_type| is | 450 // 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. | 451 // 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 | 452 // is ignored. |
| 455 // where the key name has a prefix matching |key_prefix| will be deleted. All | 453 // 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 | 454 // deleted. All meta-data associated with the key, including certificates, |
| 457 // deleted. | 455 // will also be deleted. |
| 458 virtual void TpmAttestationDeleteKeys( | 456 virtual void TpmAttestationDeleteKeys( |
| 459 attestation::AttestationKeyType key_type, | 457 attestation::AttestationKeyType key_type, |
| 460 const std::string& user_id, | 458 const cryptohome::Identification& cryptohome_id, |
| 461 const std::string& key_prefix, | 459 const std::string& key_prefix, |
| 462 const BoolDBusMethodCallback& callback) = 0; | 460 const BoolDBusMethodCallback& callback) = 0; |
| 463 | 461 |
| 464 // Asynchronously calls the GetKeyDataEx method. |callback| will be invoked | 462 // Asynchronously calls the GetKeyDataEx method. |callback| will be invoked |
| 465 // with the reply protobuf. | 463 // with the reply protobuf. |
| 466 // GetKeyDataEx returns information about the key specified in |request|. At | 464 // GetKeyDataEx returns information about the key specified in |request|. At |
| 467 // present, this does not include any secret information and the call should | 465 // present, this does not include any secret information and the call should |
| 468 // not be authenticated (|auth| should be empty). | 466 // not be authenticated (|auth| should be empty). |
| 469 virtual void GetKeyDataEx( | 467 virtual void GetKeyDataEx(const cryptohome::Identification& cryptohome_id, |
| 470 const cryptohome::AccountIdentifier& id, | 468 const cryptohome::AuthorizationRequest& auth, |
| 471 const cryptohome::AuthorizationRequest& auth, | 469 const cryptohome::GetKeyDataRequest& request, |
| 472 const cryptohome::GetKeyDataRequest& request, | 470 const ProtobufMethodCallback& callback) = 0; |
| 473 const ProtobufMethodCallback& callback) = 0; | |
| 474 | 471 |
| 475 // Asynchronously calls CheckKeyEx method. |callback| is called after method | 472 // Asynchronously calls CheckKeyEx method. |callback| is called after method |
| 476 // call, and with reply protobuf. | 473 // call, and with reply protobuf. |
| 477 // CheckKeyEx just checks if authorization information is valid. | 474 // CheckKeyEx just checks if authorization information is valid. |
| 478 virtual void CheckKeyEx( | 475 virtual void CheckKeyEx(const cryptohome::Identification& cryptohome_id, |
| 479 const cryptohome::AccountIdentifier& id, | 476 const cryptohome::AuthorizationRequest& auth, |
| 480 const cryptohome::AuthorizationRequest& auth, | 477 const cryptohome::CheckKeyRequest& request, |
| 481 const cryptohome::CheckKeyRequest& request, | 478 const ProtobufMethodCallback& callback) = 0; |
| 482 const ProtobufMethodCallback& callback) = 0; | |
| 483 | 479 |
| 484 // Asynchronously calls MountEx method. |callback| is called after method | 480 // Asynchronously calls MountEx method. |callback| is called after method |
| 485 // call, and with reply protobuf. | 481 // call, and with reply protobuf. |
| 486 // MountEx attempts to mount home dir using given authorization, and can | 482 // MountEx attempts to mount home dir using given authorization, and can |
| 487 // create new home dir if necessary values are specified in |request|. | 483 // create new home dir if necessary values are specified in |request|. |
| 488 virtual void MountEx( | 484 virtual void MountEx(const cryptohome::Identification& cryptohome_id, |
| 489 const cryptohome::AccountIdentifier& id, | 485 const cryptohome::AuthorizationRequest& auth, |
| 490 const cryptohome::AuthorizationRequest& auth, | 486 const cryptohome::MountRequest& request, |
| 491 const cryptohome::MountRequest& request, | 487 const ProtobufMethodCallback& callback) = 0; |
| 492 const ProtobufMethodCallback& callback) = 0; | |
| 493 | 488 |
| 494 // Asynchronously calls AddKeyEx method. |callback| is called after method | 489 // Asynchronously calls AddKeyEx method. |callback| is called after method |
| 495 // call, and with reply protobuf. | 490 // call, and with reply protobuf. |
| 496 // AddKeyEx adds another key to the given key set. |request| also defines | 491 // AddKeyEx adds another key to the given key set. |request| also defines |
| 497 // behavior in case when key with specified label already exist. | 492 // behavior in case when key with specified label already exist. |
| 498 virtual void AddKeyEx( | 493 virtual void AddKeyEx(const cryptohome::Identification& cryptohome_id, |
| 499 const cryptohome::AccountIdentifier& id, | 494 const cryptohome::AuthorizationRequest& auth, |
| 500 const cryptohome::AuthorizationRequest& auth, | 495 const cryptohome::AddKeyRequest& request, |
| 501 const cryptohome::AddKeyRequest& request, | 496 const ProtobufMethodCallback& callback) = 0; |
| 502 const ProtobufMethodCallback& callback) = 0; | |
| 503 | 497 |
| 504 // Asynchronously calls UpdateKeyEx method. |callback| is called after method | 498 // Asynchronously calls UpdateKeyEx method. |callback| is called after method |
| 505 // call, and with reply protobuf. Reply will contain MountReply extension. | 499 // call, and with reply protobuf. Reply will contain MountReply extension. |
| 506 // UpdateKeyEx replaces key used for authorization, without affecting any | 500 // UpdateKeyEx replaces key used for authorization, without affecting any |
| 507 // other keys. If specified at home dir creation time, new key may have | 501 // other keys. If specified at home dir creation time, new key may have |
| 508 // to be signed and/or encrypted. | 502 // to be signed and/or encrypted. |
| 509 virtual void UpdateKeyEx( | 503 virtual void UpdateKeyEx(const cryptohome::Identification& cryptohome_id, |
| 510 const cryptohome::AccountIdentifier& id, | 504 const cryptohome::AuthorizationRequest& auth, |
| 511 const cryptohome::AuthorizationRequest& auth, | 505 const cryptohome::UpdateKeyRequest& request, |
| 512 const cryptohome::UpdateKeyRequest& request, | 506 const ProtobufMethodCallback& callback) = 0; |
| 513 const ProtobufMethodCallback& callback) = 0; | |
| 514 | 507 |
| 515 // Asynchronously calls RemoveKeyEx method. |callback| is called after method | 508 // Asynchronously calls RemoveKeyEx method. |callback| is called after method |
| 516 // call, and with reply protobuf. | 509 // call, and with reply protobuf. |
| 517 // RemoveKeyEx removes key from the given key set. | 510 // RemoveKeyEx removes key from the given key set. |
| 518 virtual void RemoveKeyEx(const cryptohome::AccountIdentifier& id, | 511 virtual void RemoveKeyEx(const cryptohome::Identification& cryptohome_id, |
| 519 const cryptohome::AuthorizationRequest& auth, | 512 const cryptohome::AuthorizationRequest& auth, |
| 520 const cryptohome::RemoveKeyRequest& request, | 513 const cryptohome::RemoveKeyRequest& request, |
| 521 const ProtobufMethodCallback& callback) = 0; | 514 const ProtobufMethodCallback& callback) = 0; |
| 522 | 515 |
| 523 // Asynchronously calls GetBootAttribute method. |callback| is called after | 516 // Asynchronously calls GetBootAttribute method. |callback| is called after |
| 524 // method call, and with reply protobuf. | 517 // method call, and with reply protobuf. |
| 525 // GetBootAttribute gets the value of the specified boot attribute. | 518 // GetBootAttribute gets the value of the specified boot attribute. |
| 526 virtual void GetBootAttribute( | 519 virtual void GetBootAttribute( |
| 527 const cryptohome::GetBootAttributeRequest& request, | 520 const cryptohome::GetBootAttributeRequest& request, |
| 528 const ProtobufMethodCallback& callback) = 0; | 521 const ProtobufMethodCallback& callback) = 0; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 548 // Create() should be used instead. | 541 // Create() should be used instead. |
| 549 CryptohomeClient(); | 542 CryptohomeClient(); |
| 550 | 543 |
| 551 private: | 544 private: |
| 552 DISALLOW_COPY_AND_ASSIGN(CryptohomeClient); | 545 DISALLOW_COPY_AND_ASSIGN(CryptohomeClient); |
| 553 }; | 546 }; |
| 554 | 547 |
| 555 } // namespace chromeos | 548 } // namespace chromeos |
| 556 | 549 |
| 557 #endif // CHROMEOS_DBUS_CRYPTOHOME_CLIENT_H_ | 550 #endif // CHROMEOS_DBUS_CRYPTOHOME_CLIENT_H_ |
| OLD | NEW |