diff options
author | Szczepan Zalega <szczepan@nitrokey.com> | 2016-07-26 17:20:21 +0200 |
---|---|---|
committer | Szczepan Zalega <szczepan@nitrokey.com> | 2016-08-01 13:54:57 +0200 |
commit | c34196ea22e61c31fa83c22a3b73c19ba04a30bf (patch) | |
tree | c540b04aa73be69f8533bc2f9b734eff9a9bf993 /include/stick10_commands.h | |
parent | 664d33c8966f478d6f077a666a39a5b76a235ffa (diff) | |
download | libnitrokey-c34196ea22e61c31fa83c22a3b73c19ba04a30bf.tar.gz libnitrokey-c34196ea22e61c31fa83c22a3b73c19ba04a30bf.tar.bz2 |
Prepare setting password safe slots
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
Diffstat (limited to 'include/stick10_commands.h')
-rw-r--r-- | include/stick10_commands.h | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/include/stick10_commands.h b/include/stick10_commands.h index 92bddd5..c3b0a37 100644 --- a/include/stick10_commands.h +++ b/include/stick10_commands.h @@ -462,6 +462,13 @@ class SetPasswordSafeSlotData : Command<CommandID::SET_PW_SAFE_SLOT_DATA_1> { uint8_t slot_password[PWS_PASSWORD_LENGTH]; bool isValid() const { return !(slot_number & 0xF0); } + std::string dissect() const { + std::stringstream ss; + ss << " slot_number\t" << (int)slot_number << std::endl; + ss << " slot_name\t" << (char*)slot_name << std::endl; + ss << " slot_password\t" << (char*)slot_password << std::endl; + return ss.str(); + } } __packed; typedef Transaction<command_id(), struct CommandPayload, struct EmptyPayload> @@ -475,6 +482,12 @@ class SetPasswordSafeSlotData2 : Command<CommandID::SET_PW_SAFE_SLOT_DATA_2> { uint8_t slot_name[PWS_SLOTNAME_LENGTH]; bool isValid() const { return !(slot_number & 0xF0); } + std::string dissect() const { + std::stringstream ss; + ss << " slot_number\t" << (int)slot_number << std::endl; + ss << " slot_name\t" << (char*)slot_name << std::endl; + return ss.str(); + } } __packed; typedef Transaction<command_id(), struct CommandPayload, struct EmptyPayload> @@ -487,6 +500,12 @@ class ErasePasswordSafeSlot : Command<CommandID::PW_SAFE_ERASE_SLOT> { uint8_t slot_number; bool isValid() const { return !(slot_number & 0xF0); } + std::string dissect() const { + std::stringstream ss; + ss << " slot_number\t" << (int)slot_number << std::endl; + return ss.str(); + } + } __packed; typedef Transaction<command_id(), struct CommandPayload, struct EmptyPayload> @@ -496,12 +515,12 @@ class ErasePasswordSafeSlot : Command<CommandID::PW_SAFE_ERASE_SLOT> { class EnablePasswordSafe : Command<CommandID::PW_SAFE_ENABLE> { public: struct CommandPayload { - uint8_t password[30]; + uint8_t user_password[30]; bool isValid() const { return true; } std::string dissect() const { std::stringstream ss; - ss << " password\t" << password << std::endl; + ss << " user_password\t" << (char*) user_password << std::endl; return ss.str(); } } __packed; |