Added registration.

Currently doesn't return any valid result, hence host believes device
failed to register, however, insecure storage of keys does occur.
This commit is contained in:
2018-07-31 00:09:25 +00:00
parent 03e105bbcf
commit 86af080ba6
39 changed files with 1136 additions and 339 deletions

21
U2F_Init_CMD.cpp Normal file
View File

@@ -0,0 +1,21 @@
#include "U2F_Init_CMD.hpp"
#include <stdexcept>
#include "U2FMessage.hpp"
#include "u2f.hpp"
using namespace std;
U2F_Init_CMD U2F_Init_CMD::get()
{
const auto message = U2FMessage::read();
if (message.cmd != U2FHID_INIT)
throw runtime_error{ "Failed to get U2F Init message" };
else if (message.data.size() != INIT_NONCE_SIZE)
throw runtime_error{ "Init nonce is incorrect size" };
U2F_Init_CMD cmd;
cmd.nonce = *reinterpret_cast<const uint64_t*>(message.data.data());
return cmd;
}