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

Unified Diff: device/u2f/u2f_sign.h

Issue 2821263005: Add U2F request state machines (Closed)
Patch Set: Call Start before adding devices Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/u2f/u2f_return_code.h ('k') | device/u2f/u2f_sign.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/u2f/u2f_sign.h
diff --git a/device/u2f/u2f_sign.h b/device/u2f/u2f_sign.h
new file mode 100644
index 0000000000000000000000000000000000000000..e924137f81324e3a4d4ba05eafa602152379eac0
--- /dev/null
+++ b/device/u2f/u2f_sign.h
@@ -0,0 +1,51 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef DEVICE_U2F_U2F_SIGN_H_
+#define DEVICE_U2F_U2F_SIGN_H_
+
+#include <vector>
+
+#include "u2f_request.h"
+
+namespace device {
+
+class U2fSign : public U2fRequest {
+ public:
+ U2fSign(const std::vector<std::vector<uint8_t>>& registered_keys,
+ const std::vector<uint8_t>& challenge_hash,
+ const std::vector<uint8_t>& app_param,
+ const ResponseCallback& cb);
+ ~U2fSign() override;
+
+ static std::unique_ptr<U2fRequest> TrySign(
+ const std::vector<std::vector<uint8_t>>& registered_keys,
+ const std::vector<uint8_t>& challenge_hash,
+ const std::vector<uint8_t>& app_param,
+ const ResponseCallback& cb);
+
+ private:
+ void TryDevice() override;
+ void OnTryDevice(std::vector<std::vector<uint8_t>>::const_iterator,
+ U2fReturnCode,
+ std::vector<uint8_t>);
+
+ const std::vector<std::vector<uint8_t>> registered_keys_;
+ std::vector<uint8_t> challenge_hash_;
+ std::vector<uint8_t> app_param_;
+ const std::vector<uint8_t> kBogusAppParam = {
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41};
+ const std::vector<uint8_t> kBogusChallenge = {
+ 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42,
+ 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42,
+ 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42};
+
+ base::WeakPtrFactory<U2fSign> weak_factory_;
+};
+
+} // namespace device
+
+#endif // DEVICE_U2F_U2F_SIGN_H_
« no previous file with comments | « device/u2f/u2f_return_code.h ('k') | device/u2f/u2f_sign.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698