OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CHROME_BROWSER_CHROMEOS_ATTESTATION_PLATFORM_VERIFICATION_FLOW_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_ATTESTATION_PLATFORM_VERIFICATION_FLOW_H_ |
6 #define CHROME_BROWSER_CHROMEOS_ATTESTATION_PLATFORM_VERIFICATION_FLOW_H_ | 6 #define CHROME_BROWSER_CHROMEOS_ATTESTATION_PLATFORM_VERIFICATION_FLOW_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
16 #include "base/timer/timer.h" | 16 #include "base/timer/timer.h" |
17 #include "url/gurl.h" | 17 #include "url/gurl.h" |
18 | 18 |
| 19 class AccountId; |
| 20 |
19 namespace content { | 21 namespace content { |
20 class WebContents; | 22 class WebContents; |
21 } | 23 } |
22 | 24 |
23 namespace cryptohome { | 25 namespace cryptohome { |
24 class AsyncMethodCaller; | 26 class AsyncMethodCaller; |
25 } | 27 } |
26 | 28 |
27 namespace user_manager { | 29 namespace user_manager { |
28 class User; | 30 class User; |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 | 171 |
170 ~PlatformVerificationFlow(); | 172 ~PlatformVerificationFlow(); |
171 | 173 |
172 // Callback for attestation preparation. The arguments to ChallengePlatformKey | 174 // Callback for attestation preparation. The arguments to ChallengePlatformKey |
173 // are in |context|, and |attestation_prepared| specifies whether attestation | 175 // are in |context|, and |attestation_prepared| specifies whether attestation |
174 // has been prepared on this device. | 176 // has been prepared on this device. |
175 void OnAttestationPrepared(const ChallengeContext& context, | 177 void OnAttestationPrepared(const ChallengeContext& context, |
176 bool attestation_prepared); | 178 bool attestation_prepared); |
177 | 179 |
178 // Initiates the flow to get a platform key certificate. The arguments to | 180 // Initiates the flow to get a platform key certificate. The arguments to |
179 // ChallengePlatformKey are in |context|. |user_id| identifies the user for | 181 // ChallengePlatformKey are in |context|. |account_id| identifies the user |
180 // which to get a certificate. If |force_new_key| is true then any existing | 182 // for which to get a certificate. If |force_new_key| is true then any |
181 // key for the same user and service will be ignored and a new key will be | 183 // existing key for the same user and service will be ignored and a new key |
182 // generated and certified. | 184 // will be generated and certified. |
183 void GetCertificate(const ChallengeContext& context, | 185 void GetCertificate(const ChallengeContext& context, |
184 const std::string& user_id, | 186 const AccountId& account_id, |
185 bool force_new_key); | 187 bool force_new_key); |
186 | 188 |
187 // A callback called when an attestation certificate request operation | 189 // A callback called when an attestation certificate request operation |
188 // completes. The arguments to ChallengePlatformKey are in |context|. | 190 // completes. The arguments to ChallengePlatformKey are in |context|. |
189 // |user_id| identifies the user for which the certificate was requested. | 191 // |account_id| identifies the user for which the certificate was requested. |
190 // |operation_success| is true iff the certificate request operation | 192 // |operation_success| is true iff the certificate request operation |
191 // succeeded. |certificate_chain| holds the certificate for the platform key | 193 // succeeded. |certificate_chain| holds the certificate for the platform key |
192 // on success. If the certificate request was successful, this method invokes | 194 // on success. If the certificate request was successful, this method invokes |
193 // a request to sign the challenge. If the operation timed out prior to this | 195 // a request to sign the challenge. If the operation timed out prior to this |
194 // method being called, this method does nothing - notably, the callback is | 196 // method being called, this method does nothing - notably, the callback is |
195 // not invoked. | 197 // not invoked. |
196 void OnCertificateReady(const ChallengeContext& context, | 198 void OnCertificateReady(const ChallengeContext& context, |
197 const std::string& user_id, | 199 const AccountId& account_id, |
198 scoped_ptr<base::Timer> timer, | 200 scoped_ptr<base::Timer> timer, |
199 bool operation_success, | 201 bool operation_success, |
200 const std::string& certificate_chain); | 202 const std::string& certificate_chain); |
201 | 203 |
202 // A callback run after a constant delay to handle timeouts for lengthy | 204 // A callback run after a constant delay to handle timeouts for lengthy |
203 // certificate requests. |context.callback| will be invoked with a TIMEOUT | 205 // certificate requests. |context.callback| will be invoked with a TIMEOUT |
204 // result. | 206 // result. |
205 void OnCertificateTimeout(const ChallengeContext& context); | 207 void OnCertificateTimeout(const ChallengeContext& context); |
206 | 208 |
207 // A callback called when a challenge signing request has completed. The | 209 // A callback called when a challenge signing request has completed. The |
208 // |certificate_chain| is the platform certificate chain for the key which | 210 // |certificate_chain| is the platform certificate chain for the key which |
209 // signed the |challenge|. The arguments to ChallengePlatformKey are in | 211 // signed the |challenge|. The arguments to ChallengePlatformKey are in |
210 // |context|. |user_id| identifies the user for which the certificate was | 212 // |context|. |account_id| identifies the user for which the certificate was |
211 // requested. |is_expiring_soon| will be set iff a certificate in the | 213 // requested. |is_expiring_soon| will be set iff a certificate in the |
212 // |certificate_chain| is expiring soon. |operation_success| is true iff the | 214 // |certificate_chain| is expiring soon. |operation_success| is true iff the |
213 // challenge signing operation was successful. If it was successful, | 215 // challenge signing operation was successful. If it was successful, |
214 // |response_data| holds the challenge response and the method will invoke | 216 // |response_data| holds the challenge response and the method will invoke |
215 // |context.callback|. | 217 // |context.callback|. |
216 void OnChallengeReady(const ChallengeContext& context, | 218 void OnChallengeReady(const ChallengeContext& context, |
217 const std::string& user_id, | 219 const AccountId& account_id, |
218 const std::string& certificate_chain, | 220 const std::string& certificate_chain, |
219 bool is_expiring_soon, | 221 bool is_expiring_soon, |
220 bool operation_success, | 222 bool operation_success, |
221 const std::string& response_data); | 223 const std::string& response_data); |
222 | 224 |
223 // Checks whether attestation for content protection is allowed by policy. | 225 // Checks whether attestation for content protection is allowed by policy. |
224 bool IsAttestationAllowedByPolicy(); | 226 bool IsAttestationAllowedByPolicy(); |
225 | 227 |
226 // Checks if |certificate_chain| is a PEM certificate chain that contains a | 228 // Checks if |certificate_chain| is a PEM certificate chain that contains a |
227 // certificate this is expired or expiring soon. Returns the expiry status. | 229 // certificate this is expired or expiring soon. Returns the expiry status. |
(...skipping 14 matching lines...) Expand all Loading... |
242 base::TimeDelta timeout_delay_; | 244 base::TimeDelta timeout_delay_; |
243 std::set<std::string> renewals_in_progress_; | 245 std::set<std::string> renewals_in_progress_; |
244 | 246 |
245 DISALLOW_COPY_AND_ASSIGN(PlatformVerificationFlow); | 247 DISALLOW_COPY_AND_ASSIGN(PlatformVerificationFlow); |
246 }; | 248 }; |
247 | 249 |
248 } // namespace attestation | 250 } // namespace attestation |
249 } // namespace chromeos | 251 } // namespace chromeos |
250 | 252 |
251 #endif // CHROME_BROWSER_CHROMEOS_ATTESTATION_PLATFORM_VERIFICATION_FLOW_H_ | 253 #endif // CHROME_BROWSER_CHROMEOS_ATTESTATION_PLATFORM_VERIFICATION_FLOW_H_ |
OLD | NEW |