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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 INCLUDE_STABLE_ID = 1, | 53 INCLUDE_STABLE_ID = 1, |
54 INCLUDE_DEVICE_STATE = 1 << 1 | 54 INCLUDE_DEVICE_STATE = 1 << 1 |
55 }; | 55 }; |
56 | 56 |
57 // Key types supported by the Chrome OS attestation subsystem. | 57 // Key types supported by the Chrome OS attestation subsystem. |
58 enum AttestationKeyType { | 58 enum AttestationKeyType { |
59 DEVICE_KEY, | 59 DEVICE_KEY, |
60 USER_KEY | 60 USER_KEY |
61 }; | 61 }; |
62 | 62 |
| 63 // Options available for customizing an attestation challenge response. |
| 64 enum AttestationChallengeOptions { |
| 65 CHALLENGE_RESPONSE_OPTION_NONE = 0, |
| 66 INCLUDE_SIGNED_PUBLIC_KEY = 1 |
| 67 }; |
| 68 |
63 virtual ~CryptohomeClient(); | 69 virtual ~CryptohomeClient(); |
64 | 70 |
65 // Factory function, creates a new instance and returns ownership. | 71 // Factory function, creates a new instance and returns ownership. |
66 // For normal usage, access the singleton via DBusThreadManager::Get(). | 72 // For normal usage, access the singleton via DBusThreadManager::Get(). |
67 static CryptohomeClient* Create(DBusClientImplementationType type, | 73 static CryptohomeClient* Create(DBusClientImplementationType type, |
68 dbus::Bus* bus); | 74 dbus::Bus* bus); |
69 | 75 |
70 // Sets AsyncCallStatus signal handlers. | 76 // Sets AsyncCallStatus signal handlers. |
71 // |handler| is called when results for AsyncXXX methods are returned. | 77 // |handler| is called when results for AsyncXXX methods are returned. |
72 // Cryptohome service will process the calls in a first-in-first-out manner | 78 // Cryptohome service will process the calls in a first-in-first-out manner |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 // PKCS #11 token. The |callback| will be called when the dbus call | 291 // PKCS #11 token. The |callback| will be called when the dbus call |
286 // completes. When the operation completes, the AsyncCallStatusHandler signal | 292 // completes. When the operation completes, the AsyncCallStatusHandler signal |
287 // handler is called. |key_type| and |key_name| specify the key to register. | 293 // handler is called. |key_type| and |key_name| specify the key to register. |
288 virtual void TpmAttestationRegisterKey( | 294 virtual void TpmAttestationRegisterKey( |
289 AttestationKeyType key_type, | 295 AttestationKeyType key_type, |
290 const std::string& key_name, | 296 const std::string& key_name, |
291 const AsyncMethodCallback& callback) = 0; | 297 const AsyncMethodCallback& callback) = 0; |
292 | 298 |
293 // Asynchronously signs an enterprise challenge with the key specified by | 299 // Asynchronously signs an enterprise challenge with the key specified by |
294 // |key_type| and |key_name|. |domain| and |device_id| will be included in | 300 // |key_type| and |key_name|. |domain| and |device_id| will be included in |
295 // the challenge response. |challenge| must be a valid enterprise attestation | 301 // the challenge response. |options| control how the challenge response is |
296 // challenge. The |callback| will be called when the dbus call completes. | 302 // generated. |challenge| must be a valid enterprise attestation challenge. |
297 // When the operation completes, the AsyncCallStatusWithDataHandler signal | 303 // The |callback| will be called when the dbus call completes. When the |
298 // handler is called. | 304 // operation completes, the AsyncCallStatusWithDataHandler signal handler is |
| 305 // called. |
299 virtual void TpmAttestationSignEnterpriseChallenge( | 306 virtual void TpmAttestationSignEnterpriseChallenge( |
300 AttestationKeyType key_type, | 307 AttestationKeyType key_type, |
301 const std::string& key_name, | 308 const std::string& key_name, |
302 const std::string& domain, | 309 const std::string& domain, |
303 const std::string& device_id, | 310 const std::string& device_id, |
| 311 AttestationChallengeOptions options, |
304 const std::string& challenge, | 312 const std::string& challenge, |
305 const AsyncMethodCallback& callback) = 0; | 313 const AsyncMethodCallback& callback) = 0; |
306 | 314 |
307 // Asynchronously signs a simple challenge with the key specified by | 315 // Asynchronously signs a simple challenge with the key specified by |
308 // |key_type| and |key_name|. |challenge| can be any set of arbitrary bytes. | 316 // |key_type| and |key_name|. |challenge| can be any set of arbitrary bytes. |
309 // A nonce will be appended to the challenge before signing; this method | 317 // A nonce will be appended to the challenge before signing; this method |
310 // cannot be used to sign arbitrary data. The |callback| will be called when | 318 // cannot be used to sign arbitrary data. The |callback| will be called when |
311 // the dbus call completes. When the operation completes, the | 319 // the dbus call completes. When the operation completes, the |
312 // AsyncCallStatusWithDataHandler signal handler is called. | 320 // AsyncCallStatusWithDataHandler signal handler is called. |
313 virtual void TpmAttestationSignSimpleChallenge( | 321 virtual void TpmAttestationSignSimpleChallenge( |
314 AttestationKeyType key_type, | 322 AttestationKeyType key_type, |
315 const std::string& key_name, | 323 const std::string& key_name, |
316 const std::string& challenge, | 324 const std::string& challenge, |
317 const AsyncMethodCallback& callback) = 0; | 325 const AsyncMethodCallback& callback) = 0; |
318 | 326 |
319 protected: | 327 protected: |
320 // Create() should be used instead. | 328 // Create() should be used instead. |
321 CryptohomeClient(); | 329 CryptohomeClient(); |
322 | 330 |
323 private: | 331 private: |
324 DISALLOW_COPY_AND_ASSIGN(CryptohomeClient); | 332 DISALLOW_COPY_AND_ASSIGN(CryptohomeClient); |
325 }; | 333 }; |
326 | 334 |
327 } // namespace chromeos | 335 } // namespace chromeos |
328 | 336 |
329 #endif // CHROMEOS_DBUS_CRYPTOHOME_CLIENT_H_ | 337 #endif // CHROMEOS_DBUS_CRYPTOHOME_CLIENT_H_ |
OLD | NEW |