Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Side by Side Diff: chromeos/attestation/attestation.h

Issue 11932004: Implemented attestation message flow for Chrome OS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chromeos/attestation/attestation.cc » ('j') | chromeos/attestation/attestation.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROMEOS_ATTESTATION_ATTESTATION_H_
6 #define CHROMEOS_ATTESTATION_ATTESTATION_H_
7
8 #include <string>
9
10 #include "base/basictypes.h"
11 #include "base/callback_forward.h"
12 #include "base/memory/weak_ptr.h"
13 #include "chromeos/chromeos_export.h"
14 #include "chromeos/dbus/dbus_method_call_status.h"
15 #include "third_party/cros_system_api/dbus/service_constants.h"
Mattias Nissler (ping if slow) 2013/01/16 10:39:26 needed in this file?
dkrahn 2013/01/17 23:36:24 Yes, for cryptohome::MountError...
16
17
Mattias Nissler (ping if slow) 2013/01/16 10:39:26 nit: remove extra blank line
dkrahn 2013/01/17 23:36:24 Done.
18 namespace cryptohome {
19
20 class AsyncMethodCaller;
21
22 } // namespace cryptohome
23
Mattias Nissler (ping if slow) 2013/01/16 10:39:26 nit: remove extra blank line.
dkrahn 2013/01/17 23:36:24 Done.
24
25 namespace chromeos {
26
27 class CryptohomeClient;
28
29 namespace attestation {
30
31 // Interface for access to the Privacy CA server.
32 class CHROMEOS_EXPORT ServerProxy {
33 public:
Mattias Nissler (ping if slow) 2013/01/16 10:39:26 This needs a virtual dtor.
dkrahn 2013/01/17 23:36:24 Done.
34 typedef base::Callback<void(bool success,
35 const std::string& data)> DataCallback;
36 virtual void SendEnrollRequest(const std::string& request,
37 const DataCallback& on_response) = 0;
38 virtual void SendCertificateRequest(const std::string& request,
39 const DataCallback& on_response) = 0;
40 };
41
42 // Implements ChromeOS-specific attestation tasks.
43 class CHROMEOS_EXPORT Attestation {
Mattias Nissler (ping if slow) 2013/01/16 10:39:26 nit: I think the name is a bit generic, seeing it
dkrahn 2013/01/17 23:36:24 Done.
44 public:
45 typedef base::Callback<void(bool success)> StatusCallback;
Mattias Nissler (ping if slow) 2013/01/16 10:39:26 unused?
dkrahn 2013/01/17 23:36:24 Done.
46 typedef base::Callback<void(bool success,
47 const std::string& pem_certificate_chain)>
48 CertificateCallback;
49
50 Attestation(cryptohome::AsyncMethodCaller* async_caller,
51 CryptohomeClient* cryptohome_client,
52 ServerProxy* server_proxy);
53 virtual ~Attestation();
Mattias Nissler (ping if slow) 2013/01/16 10:39:26 Why all the virtualness in this class?
dkrahn 2013/01/17 23:36:24 Removed. Was at one time thinking of allowing mock
54
55 // Asynchronously gets an attestation certificate bound to the given name.
56 // If no certificate has been associated with the name, a new certificate is
57 // issued.
58 //
59 // Parameters
60 // name - The name of the key for which to retrieve a certificate. The
61 // following key names are available:
62 // "attest-ent-machine" - The enterprise machine key.
63 // "attest-ent-user" - An enterprise user key for the current user.
64 // "content-[origin]" - A content protection key bound to a
65 // specific origin for the current user.
66 // callback - A callback which will be called when the operation completes.
67 virtual void GetCertificate(const std::string& name,
68 const CertificateCallback& callback);
69
70 private:
71 static const char* kEnterpriseMachineKey;
72
73 // Redirects to one of three callbacks based on a boolean value and dbus call
74 // status.
75 //
76 // Parameters
77 // on_true - Called when status=succes and value=true.
78 // on_false - Called when status=success and value=false.
79 // on_fail - Called when status=failure.
80 // status - The D-Bus operation status.
81 // value - The value returned by the D-Bus operation.
82 virtual void DBusBoolRedirectCallback(const base::Closure& on_true,
83 const base::Closure& on_false,
84 const base::Closure& on_fail,
85 DBusMethodCallStatus status,
86 bool value);
87
88 // Asynchronously initiates the attestation enrollment flow.
89 //
90 // Parameters
91 // on_failure - Called if any failure occurs.
92 // next_task - Called on successful enrollment.
93 virtual void StartEnroll(const base::Closure& on_failure,
94 const base::Closure& next_task);
95
96 // Called when the attestation daemon has finished creating an enrollment
97 // request for the Privacy CA. The request is asynchronously forwarded as-is
98 // to the PCA.
99 //
100 // Parameters
101 // on_failure - Called if any failure occurs.
102 // next_task - Called on successful enrollment.
103 // success - The status of request creation.
104 // data - The request data for the Privacy CA.
105 virtual void OnCreateEnrollRequest(const base::Closure& on_failure,
Mattias Nissler (ping if slow) 2013/01/16 10:39:26 Maybe rename to SendEnrollRequest?
dkrahn 2013/01/17 23:36:24 Done. This was actually the original name of the m
106 const base::Closure& next_task,
107 bool success,
108 const std::string& data);
109
110 // Called when the Privacy CA responds to an enrollment request. The response
111 // is asynchronously forwarded as-is to the attestation daemon in order to
112 // complete the enrollment operation.
113 //
114 // Parameters
115 // on_failure - Called if any failure occurs.
116 // next_task - Called on successful enrollment.
117 // success - The status of the Privacy CA operation.
118 // data - The response data from the Privacy CA.
119 virtual void OnEnrollResponse(const base::Closure& on_failure,
120 const base::Closure& next_task,
121 bool success,
122 const std::string& data);
123
124 // Called when the attestation daemon completes an enrollment operation. If
125 // the operation was successful, the next_task callback is called.
126 //
127 // Parameters
128 // on_failure - Called if any failure occurs.
129 // next_task - Called on successful enrollment.
130 // success - The status of the enrollment operation.
131 // not_used - An artifact of the cryptohome D-Bus interface; ignored.
132 virtual void OnEnrollComplete(const base::Closure& on_failure,
133 const base::Closure& next_task,
134 bool success,
135 cryptohome::MountError not_used);
136
137 // Asynchronously initiates the certificate request flow. Attestation
138 // enrollment must success before this operation can succeed.
Mattias Nissler (ping if slow) 2013/01/16 10:39:26 fix "must success"
dkrahn 2013/01/17 23:36:24 Done.
139 //
140 // Parameters
141 // name - The name of the key for which a certificate is requested.
142 // callback - Called when the operation completes.
143 virtual void StartCertificateRequest(const std::string& name,
144 const CertificateCallback& callback);
145
146 // Called when the attestation daemon has finished creating a certificate
147 // request for the Privacy CA. The request is asynchronously forwarded as-is
148 // to the PCA.
149 //
150 // Parameters
151 // callback - Called when the operation completes.
152 // success - The status of request creation.
153 // data - The request data for the Privacy CA.
154 virtual void OnCreateCertificateRequest(const CertificateCallback& callback,
Mattias Nissler (ping if slow) 2013/01/16 10:39:26 Maybe rename to SendCertificateRequestToPCA?
dkrahn 2013/01/17 23:36:24 Done.
155 bool success,
156 const std::string& data);
157
158 // Called when the Privacy CA responds to a certificate request. The response
159 // is asynchronously forwarded as-is to the attestation daemon in order to
160 // complete the operation.
161 //
162 // Parameters
163 // callback - Called when the operation completes.
164 // success - The status of the Privacy CA operation.
165 // data - The response data from the Privacy CA.
166 virtual void OnCertificateResponse(const CertificateCallback& callback,
167 bool success,
168 const std::string& data);
169
170 base::WeakPtrFactory<Attestation> weak_factory_;
171 cryptohome::AsyncMethodCaller* async_caller_;
172 CryptohomeClient* cryptohome_client_;
173 ServerProxy* server_proxy_;
174
175 DISALLOW_COPY_AND_ASSIGN(Attestation);
176 };
177
178 } // namespace attestation
179 } // namespace chromeos
180
181 #endif // CHROMEOS_ATTESTATION_ATTESTATION_H_
OLDNEW
« no previous file with comments | « no previous file | chromeos/attestation/attestation.cc » ('j') | chromeos/attestation/attestation.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698