diff options
author | Szczepan Zalega <szczepan.zalega@gmail.com> | 2016-03-29 13:04:52 +0200 |
---|---|---|
committer | Szczepan Zalega <szczepan.zalega@gmail.com> | 2016-03-29 13:04:52 +0200 |
commit | 955fb912ab9563a5246f9d3bfda9ccfab187949f (patch) | |
tree | d0baaea9d86ca6d17e3bd7351ab3083a6697ee8f /include/stick10_commands.h | |
parent | 75bbfc7d9e3d0f26a507c494b1e94fe71fa26ad0 (diff) | |
download | libnitrokey-955fb912ab9563a5246f9d3bfda9ccfab187949f.tar.gz libnitrokey-955fb912ab9563a5246f9d3bfda9ccfab187949f.tar.bz2 |
adding next steps for hotp tests: writing, reading and authorization for writing hotp code
Diffstat (limited to 'include/stick10_commands.h')
-rw-r--r-- | include/stick10_commands.h | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/include/stick10_commands.h b/include/stick10_commands.h index 1c21eee..60c947f 100644 --- a/include/stick10_commands.h +++ b/include/stick10_commands.h @@ -127,7 +127,7 @@ class GetHOTP : Command<CommandID::GET_CODE> { struct CommandPayload { uint8_t slot_number; - bool isValid() const { return !(slot_number & 0xF0); } + bool isValid() const { return (slot_number & 0xF0); } std::string dissect() const { std::stringstream ss; ss << "slot_number:\t" << (int)(slot_number) << std::endl; @@ -146,7 +146,7 @@ class GetHOTP : Command<CommandID::GET_CODE> { } } __packed; - typedef Transaction<command_id(), struct CommandPayload, struct EmptyPayload> + typedef Transaction<command_id(), struct CommandPayload, struct ResponsePayload> CommandTransaction; }; @@ -473,8 +473,15 @@ class UserAuthenticate : Command<CommandID::USER_AUTHENTICATE> { class Authorize : Command<CommandID::AUTHORIZE> { public: struct CommandPayload { - uint8_t crc[4]; - uint8_t password[25]; + uint32_t crc_to_authorize; + uint8_t temporary_password[25]; + + std::string dissect() const { + std::stringstream ss; + ss << " crc_to_authorize:\t" << crc_to_authorize<< std::endl; + ss << " temporary_password:\t" << temporary_password<< std::endl; + return ss.str(); + } } __packed; typedef Transaction<command_id(), struct CommandPayload, struct EmptyPayload> @@ -484,8 +491,14 @@ class Authorize : Command<CommandID::AUTHORIZE> { class UserAuthorize : Command<CommandID::USER_AUTHORIZE> { public: struct CommandPayload { - uint8_t crc[4]; - uint8_t password[25]; + uint8_t crc_to_authorize[4]; + uint8_t temporary_password[25]; + std::string dissect() const { + std::stringstream ss; + ss << " crc_to_authorize:\t" << crc_to_authorize<< std::endl; + ss << " temporary_password:\t" << temporary_password<< std::endl; + return ss.str(); + } } __packed; typedef Transaction<command_id(), struct CommandPayload, struct EmptyPayload> |