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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 | 258 |
259 // Asynchronously finishes an attestation enrollment operation. The callback | 259 // Asynchronously finishes an attestation enrollment operation. The callback |
260 // will be called when the dbus call completes. When the operation completes, | 260 // will be called when the dbus call completes. When the operation completes, |
261 // the AsyncCallStatusHandler signal handler is called. |pca_response| is the | 261 // the AsyncCallStatusHandler signal handler is called. |pca_response| is the |
262 // response to the enrollment request emitted by the Privacy CA. | 262 // response to the enrollment request emitted by the Privacy CA. |
263 virtual void AsyncTpmAttestationEnroll( | 263 virtual void AsyncTpmAttestationEnroll( |
264 const std::string& pca_response, | 264 const std::string& pca_response, |
265 const AsyncMethodCallback& callback) = 0; | 265 const AsyncMethodCallback& callback) = 0; |
266 | 266 |
267 // Asynchronously creates an attestation certificate request according to | 267 // Asynchronously creates an attestation certificate request according to |
268 // |certificate_profile|. Some profiles require that the |user_email| of the | 268 // |certificate_profile|. Some profiles require that the |user_id| of the |
269 // currently active user and an identifier of the |request_origin| be | 269 // currently active user and an identifier of the |request_origin| be |
270 // provided. |callback| will be called when the dbus call completes. When | 270 // provided. |callback| will be called when the dbus call completes. When |
271 // the operation completes, the AsyncCallStatusWithDataHandler signal handler | 271 // the operation completes, the AsyncCallStatusWithDataHandler signal handler |
272 // is called. The data that is sent with the signal is a certificate request | 272 // is called. The data that is sent with the signal is a certificate request |
273 // to be sent to the Privacy CA. The certificate request is completed by | 273 // to be sent to the Privacy CA. The certificate request is completed by |
274 // calling AsyncTpmAttestationFinishCertRequest. The |user_email| will not | 274 // calling AsyncTpmAttestationFinishCertRequest. The |user_id| will not |
275 // be included in the certificate request for the Privacy CA. | 275 // be included in the certificate request for the Privacy CA. |
276 virtual void AsyncTpmAttestationCreateCertRequest( | 276 virtual void AsyncTpmAttestationCreateCertRequest( |
277 attestation::AttestationCertificateProfile certificate_profile, | 277 attestation::AttestationCertificateProfile certificate_profile, |
278 const std::string& user_email, | 278 const std::string& user_id, |
279 const std::string& request_origin, | 279 const std::string& request_origin, |
280 const AsyncMethodCallback& callback) = 0; | 280 const AsyncMethodCallback& callback) = 0; |
281 | 281 |
282 // Asynchronously finishes a certificate request operation. The callback will | 282 // Asynchronously finishes a certificate request operation. The callback will |
283 // be called when the dbus call completes. When the operation completes, the | 283 // be called when the dbus call completes. When the operation completes, the |
284 // AsyncCallStatusWithDataHandler signal handler is called. The data that is | 284 // AsyncCallStatusWithDataHandler signal handler is called. The data that is |
285 // sent with the signal is a certificate chain in PEM format. |pca_response| | 285 // sent with the signal is a certificate chain in PEM format. |pca_response| |
286 // is the response to the certificate request emitted by the Privacy CA. | 286 // is the response to the certificate request emitted by the Privacy CA. |
287 // |key_type| determines whether the certified key is to be associated with | 287 // |key_type| determines whether the certified key is to be associated with |
288 // the current user. |key_name| is a name for the key. | 288 // the current user. |key_name| is a name for the key. If |key_type| is |
| 289 // KEY_USER, a |user_id| must be provided. Otherwise |user_id| is ignored. |
| 290 // For normal GAIA users the |user_id| is a canonical email address. |
289 virtual void AsyncTpmAttestationFinishCertRequest( | 291 virtual void AsyncTpmAttestationFinishCertRequest( |
290 const std::string& pca_response, | 292 const std::string& pca_response, |
291 attestation::AttestationKeyType key_type, | 293 attestation::AttestationKeyType key_type, |
| 294 const std::string& user_id, |
292 const std::string& key_name, | 295 const std::string& key_name, |
293 const AsyncMethodCallback& callback) = 0; | 296 const AsyncMethodCallback& callback) = 0; |
294 | 297 |
295 // Checks if an attestation key already exists. If the key specified by | 298 // Checks if an attestation key already exists. If the key specified by |
296 // |key_type| and |key_name| exists, then the result sent to the callback will | 299 // |key_type| and |key_name| exists, then the result sent to the callback will |
297 // be true. | 300 // be true. If |key_type| is KEY_USER, a |user_id| must be provided. |
| 301 // Otherwise |user_id| is ignored. For normal GAIA users the |user_id| is a |
| 302 // canonical email address. |
298 virtual void TpmAttestationDoesKeyExist( | 303 virtual void TpmAttestationDoesKeyExist( |
299 attestation::AttestationKeyType key_type, | 304 attestation::AttestationKeyType key_type, |
| 305 const std::string& user_id, |
300 const std::string& key_name, | 306 const std::string& key_name, |
301 const BoolDBusMethodCallback& callback) = 0; | 307 const BoolDBusMethodCallback& callback) = 0; |
302 | 308 |
303 // Gets the attestation certificate for the key specified by |key_type| and | 309 // Gets the attestation certificate for the key specified by |key_type| and |
304 // |key_name|. |callback| will be called when the operation completes. If | 310 // |key_name|. |callback| will be called when the operation completes. If |
305 // the key does not exist the callback |result| parameter will be false. | 311 // the key does not exist the callback |result| parameter will be false. If |
| 312 // |key_type| is KEY_USER, a |user_id| must be provided. Otherwise |user_id| |
| 313 // is ignored. For normal GAIA users the |user_id| is a canonical email |
| 314 // address. |
306 virtual void TpmAttestationGetCertificate( | 315 virtual void TpmAttestationGetCertificate( |
307 attestation::AttestationKeyType key_type, | 316 attestation::AttestationKeyType key_type, |
| 317 const std::string& user_id, |
308 const std::string& key_name, | 318 const std::string& key_name, |
309 const DataMethodCallback& callback) = 0; | 319 const DataMethodCallback& callback) = 0; |
310 | 320 |
311 // Gets the public key for the key specified by |key_type| and |key_name|. | 321 // Gets the public key for the key specified by |key_type| and |key_name|. |
312 // |callback| will be called when the operation completes. If the key does | 322 // |callback| will be called when the operation completes. If the key does |
313 // not exist the callback |result| parameter will be false. | 323 // not exist the callback |result| parameter will be false. If |key_type| is |
| 324 // KEY_USER, a |user_id| must be provided. Otherwise |user_id| is ignored. |
| 325 // For normal GAIA users the |user_id| is a canonical email address. |
314 virtual void TpmAttestationGetPublicKey( | 326 virtual void TpmAttestationGetPublicKey( |
315 attestation::AttestationKeyType key_type, | 327 attestation::AttestationKeyType key_type, |
| 328 const std::string& user_id, |
316 const std::string& key_name, | 329 const std::string& key_name, |
317 const DataMethodCallback& callback) = 0; | 330 const DataMethodCallback& callback) = 0; |
318 | 331 |
319 // Asynchronously registers an attestation key with the current user's | 332 // Asynchronously registers an attestation key with the current user's |
320 // PKCS #11 token. The |callback| will be called when the dbus call | 333 // PKCS #11 token. The |callback| will be called when the dbus call |
321 // completes. When the operation completes, the AsyncCallStatusHandler signal | 334 // completes. When the operation completes, the AsyncCallStatusHandler signal |
322 // handler is called. |key_type| and |key_name| specify the key to register. | 335 // handler is called. |key_type| and |key_name| specify the key to register. |
| 336 // If |key_type| is KEY_USER, a |user_id| must be provided. Otherwise |
| 337 // |user_id| is ignored. For normal GAIA users the |user_id| is a canonical |
| 338 // email address. |
323 virtual void TpmAttestationRegisterKey( | 339 virtual void TpmAttestationRegisterKey( |
324 attestation::AttestationKeyType key_type, | 340 attestation::AttestationKeyType key_type, |
| 341 const std::string& user_id, |
325 const std::string& key_name, | 342 const std::string& key_name, |
326 const AsyncMethodCallback& callback) = 0; | 343 const AsyncMethodCallback& callback) = 0; |
327 | 344 |
328 // Asynchronously signs an enterprise challenge with the key specified by | 345 // Asynchronously signs an enterprise challenge with the key specified by |
329 // |key_type| and |key_name|. |domain| and |device_id| will be included in | 346 // |key_type| and |key_name|. |domain| and |device_id| will be included in |
330 // the challenge response. |options| control how the challenge response is | 347 // the challenge response. |options| control how the challenge response is |
331 // generated. |challenge| must be a valid enterprise attestation challenge. | 348 // generated. |challenge| must be a valid enterprise attestation challenge. |
332 // The |callback| will be called when the dbus call completes. When the | 349 // The |callback| will be called when the dbus call completes. When the |
333 // operation completes, the AsyncCallStatusWithDataHandler signal handler is | 350 // operation completes, the AsyncCallStatusWithDataHandler signal handler is |
334 // called. | 351 // called. If |key_type| is KEY_USER, a |user_id| must be provided. |
| 352 // Otherwise |user_id| is ignored. For normal GAIA users the |user_id| is a |
| 353 // canonical email address. |
335 virtual void TpmAttestationSignEnterpriseChallenge( | 354 virtual void TpmAttestationSignEnterpriseChallenge( |
336 attestation::AttestationKeyType key_type, | 355 attestation::AttestationKeyType key_type, |
| 356 const std::string& user_id, |
337 const std::string& key_name, | 357 const std::string& key_name, |
338 const std::string& domain, | 358 const std::string& domain, |
339 const std::string& device_id, | 359 const std::string& device_id, |
340 attestation::AttestationChallengeOptions options, | 360 attestation::AttestationChallengeOptions options, |
341 const std::string& challenge, | 361 const std::string& challenge, |
342 const AsyncMethodCallback& callback) = 0; | 362 const AsyncMethodCallback& callback) = 0; |
343 | 363 |
344 // Asynchronously signs a simple challenge with the key specified by | 364 // Asynchronously signs a simple challenge with the key specified by |
345 // |key_type| and |key_name|. |challenge| can be any set of arbitrary bytes. | 365 // |key_type| and |key_name|. |challenge| can be any set of arbitrary bytes. |
346 // A nonce will be appended to the challenge before signing; this method | 366 // A nonce will be appended to the challenge before signing; this method |
347 // cannot be used to sign arbitrary data. The |callback| will be called when | 367 // cannot be used to sign arbitrary data. The |callback| will be called when |
348 // the dbus call completes. When the operation completes, the | 368 // the dbus call completes. When the operation completes, the |
349 // AsyncCallStatusWithDataHandler signal handler is called. | 369 // AsyncCallStatusWithDataHandler signal handler is called. If |key_type| is |
| 370 // KEY_USER, a |user_id| must be provided. Otherwise |user_id| is ignored. |
| 371 // For normal GAIA users the |user_id| is a canonical email address. |
350 virtual void TpmAttestationSignSimpleChallenge( | 372 virtual void TpmAttestationSignSimpleChallenge( |
351 attestation::AttestationKeyType key_type, | 373 attestation::AttestationKeyType key_type, |
| 374 const std::string& user_id, |
352 const std::string& key_name, | 375 const std::string& key_name, |
353 const std::string& challenge, | 376 const std::string& challenge, |
354 const AsyncMethodCallback& callback) = 0; | 377 const AsyncMethodCallback& callback) = 0; |
355 | 378 |
356 // Gets the payload associated with the key specified by |key_type| and | 379 // Gets the payload associated with the key specified by |key_type| and |
357 // |key_name|. The |callback| will be called when the operation completes. | 380 // |key_name|. The |callback| will be called when the operation completes. |
358 // If the key does not exist the callback |result| parameter will be false. | 381 // If the key does not exist the callback |result| parameter will be false. |
359 // If no payload has been set for the key the callback |result| parameter will | 382 // If no payload has been set for the key the callback |result| parameter will |
360 // be true and the |data| parameter will be empty. | 383 // be true and the |data| parameter will be empty. If |key_type| is |
| 384 // KEY_USER, a |user_id| must be provided. Otherwise |user_id| is ignored. |
| 385 // For normal GAIA users the |user_id| is a canonical email address. |
361 virtual void TpmAttestationGetKeyPayload( | 386 virtual void TpmAttestationGetKeyPayload( |
362 attestation::AttestationKeyType key_type, | 387 attestation::AttestationKeyType key_type, |
| 388 const std::string& user_id, |
363 const std::string& key_name, | 389 const std::string& key_name, |
364 const DataMethodCallback& callback) = 0; | 390 const DataMethodCallback& callback) = 0; |
365 | 391 |
366 // Sets the |payload| associated with the key specified by |key_type| and | 392 // Sets the |payload| associated with the key specified by |key_type| and |
367 // |key_name|. The |callback| will be called when the operation completes. | 393 // |key_name|. The |callback| will be called when the operation completes. |
368 // If the operation succeeds, the callback |result| parameter will be true. | 394 // If the operation succeeds, the callback |result| parameter will be true. |
| 395 // If |key_type| is KEY_USER, a |user_id| must be provided. Otherwise |
| 396 // |user_id| is ignored. For normal GAIA users the |user_id| is a canonical |
| 397 // email address. |
369 virtual void TpmAttestationSetKeyPayload( | 398 virtual void TpmAttestationSetKeyPayload( |
370 attestation::AttestationKeyType key_type, | 399 attestation::AttestationKeyType key_type, |
| 400 const std::string& user_id, |
371 const std::string& key_name, | 401 const std::string& key_name, |
372 const std::string& payload, | 402 const std::string& payload, |
373 const BoolDBusMethodCallback& callback) = 0; | 403 const BoolDBusMethodCallback& callback) = 0; |
374 | 404 |
375 protected: | 405 protected: |
376 // Create() should be used instead. | 406 // Create() should be used instead. |
377 CryptohomeClient(); | 407 CryptohomeClient(); |
378 | 408 |
379 private: | 409 private: |
380 DISALLOW_COPY_AND_ASSIGN(CryptohomeClient); | 410 DISALLOW_COPY_AND_ASSIGN(CryptohomeClient); |
381 }; | 411 }; |
382 | 412 |
383 } // namespace chromeos | 413 } // namespace chromeos |
384 | 414 |
385 #endif // CHROMEOS_DBUS_CRYPTOHOME_CLIENT_H_ | 415 #endif // CHROMEOS_DBUS_CRYPTOHOME_CLIENT_H_ |
OLD | NEW |