From 91417029b5a3ec518d2361b9899f3e1be93317ec Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Wed, 19 Oct 2016 12:31:21 +0200 Subject: Show hex values in debug messages for certain parameters Signed-off-by: Szczepan Zalega --- include/stick10_commands.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'include/stick10_commands.h') diff --git a/include/stick10_commands.h b/include/stick10_commands.h index d1f12b6..a947e1e 100644 --- a/include/stick10_commands.h +++ b/include/stick10_commands.h @@ -111,7 +111,8 @@ class WriteToHOTPSlot : Command { std::stringstream ss; ss << "slot_number:\t" << (int)(slot_number) << std::endl; ss << "slot_name:\t" << slot_name << std::endl; - ss << "slot_secret:\t" << slot_secret << std::endl; + ss << "slot_secret:" << std::endl + << ::nitrokey::misc::hexdump((const char *)(&slot_secret), sizeof slot_secret); ss << "slot_config:\t" << std::bitset<8>((int)_slot_config) << std::endl; ss << "\tuse_8_digits(0):\t" << use_8_digits << std::endl; ss << "\tuse_enter(1):\t" << use_enter << std::endl; @@ -121,8 +122,10 @@ class WriteToHOTPSlot : Command { for (auto i : slot_token_id) ss << std::hex << std::setw(2) << std::setfill('0')<< (int) i << " " ; ss << std::endl; - ss << "slot_counter:\t" << (int)slot_counter << std::endl; - return ss.str(); + ss << "slot_counter:\t[" << (int)slot_counter << "]\t" + << ::nitrokey::misc::hexdump((const char *)(&slot_counter), sizeof slot_counter, false); + + return ss.str(); } } __packed; @@ -334,7 +337,7 @@ class GetStatus : Command { ss << "firmware_version:\t" << "[" << firmware_version << "]" << "\t" << ::nitrokey::misc::hexdump( - (const char *)(&firmware_version), 2, false); + (const char *)(&firmware_version), sizeof firmware_version, false); ss << "card_serial:\t" << ::nitrokey::misc::hexdump((const char *)(card_serial), sizeof card_serial, false); -- cgit v1.2.1