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

Unified Diff: device/u2f/u2f_responses.h

Issue 2655853006: Define FIDO U2f Device abstraction (Closed)
Patch Set: Define FIDO U2f Device abstraction Created 3 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 side-by-side diff with in-line comments
Download patch
Index: device/u2f/u2f_responses.h
diff --git a/device/u2f/u2f_responses.h b/device/u2f/u2f_responses.h
new file mode 100644
index 0000000000000000000000000000000000000000..52275b075ee363b7f66e1e034b8df171964ca5ab
--- /dev/null
+++ b/device/u2f/u2f_responses.h
@@ -0,0 +1,86 @@
+// 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_RESPONSES_H_
+#define DEVICE_U2F_U2F_RESPONSES_H_
+
+#include <vector>
+
+#include "device/u2f/u2f_apdu_response.h"
+
+namespace device {
+
+// Parameter object defining the response to a U2fDevice::Register message. Raw
+// messages parameters are defined by the specification at
+// https://fidoalliance.org/specs/fido-u2f-v1.0-nfc-bt-amendment-20150514/fido-u2f-raw-message-formats.html
+class U2fRegisterResponse
+ : public base::RefCountedThreadSafe<U2fRegisterResponse> {
Reilly Grant (use Gerrit) 2017/01/27 02:06:30 I should have mentioned this in my response (har h
+ public:
+ scoped_refptr<U2fRegisterResponse> Create(
+ U2fApduResponse::Status status,
+ std::vector<uint8_t> user_public_key,
juanlang (chromium.org) 2017/01/27 18:52:21 TL;DR: I think returning an opaque string of bytes
+ std::vector<uint8_t> key_handle,
+ std::vector<uint8_t> attestation_cert,
+ std::vector<uint8_t> signature);
+
+ U2fApduResponse::Status status() const { return status_; };
+ const std::vector<uint8_t> user_public_key() const {
+ return user_public_key_;
+ };
+ const std::vector<uint8_t> key_handle() const { return key_handle_; };
+ const std::vector<uint8_t> attestation_cert() const {
+ return attestation_cert_;
+ };
+ const std::vector<uint8_t> signature() const { return signature_; };
+
+ private:
+ friend class base::RefCountedThreadSafe<U2fRegisterResponse>;
+
+ U2fRegisterResponse(U2fApduResponse::Status status,
+ std::vector<uint8_t> user_public_key,
+ std::vector<uint8_t> key_handle,
+ std::vector<uint8_t> attestation_cert,
+ std::vector<uint8_t> signature);
+ ~U2fRegisterResponse();
+
+ U2fApduResponse::Status status_;
+ std::vector<uint8_t> user_public_key_;
+ std::vector<uint8_t> key_handle_;
+ std::vector<uint8_t> attestation_cert_;
+ std::vector<uint8_t> signature_;
+};
+
+// Parameter object defining the response to a U2fDevice::Sign message. Raw
+// messages parameters are defined by the specification at
+// https://fidoalliance.org/specs/fido-u2f-v1.0-nfc-bt-amendment-20150514/fido-u2f-raw-message-formats.html
+class U2fSignResponse : public base::RefCountedThreadSafe<U2fSignResponse> {
+ public:
+ scoped_refptr<U2fSignResponse> Create(U2fApduResponse::Status status,
+ uint8_t presence,
juanlang (chromium.org) 2017/01/27 18:52:21 Same as above. If you accept my suggestion, you c
+ uint32_t counter,
+ std::vector<uint8_t> signature);
+
+ U2fApduResponse::Status status() const { return status_; };
+ uint8_t presence() { return presence_; }
+ uint32_t counter() { return counter_; }
+ const std::vector<uint8_t> signature() const { return signature_; };
+
+ private:
+ friend class base::RefCountedThreadSafe<U2fSignResponse>;
+
+ U2fSignResponse(U2fApduResponse::Status status,
+ uint8_t presence,
+ uint32_t counter,
+ std::vector<uint8_t> signature);
+ ~U2fSignResponse();
+
+ U2fApduResponse::Status status_;
+ uint8_t presence_;
+ uint32_t counter_;
+ std::vector<uint8_t> signature_;
+};
+
+} // namespace device
+
+#endif // DEVICE_U2F_U2F_RESPONSES_H_

Powered by Google App Engine
This is Rietveld 408576698