summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2016-10-19 12:31:21 +0200
committerSzczepan Zalega <szczepan@nitrokey.com>2016-10-19 16:55:06 +0200
commit91417029b5a3ec518d2361b9899f3e1be93317ec (patch)
tree15da22c02933db7029825f2bbedf391349e63499
parentd26e07e7a4a5066f69364aebf13eda35490bea5c (diff)
downloadlibnitrokey-91417029b5a3ec518d2361b9899f3e1be93317ec.tar.gz
libnitrokey-91417029b5a3ec518d2361b9899f3e1be93317ec.tar.bz2
Show hex values in debug messages for certain parameters
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
-rw-r--r--include/stick10_commands.h11
1 files changed, 7 insertions, 4 deletions
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<CommandID::WRITE_TO_SLOT> {
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<CommandID::WRITE_TO_SLOT> {
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<CommandID::GET_STATUS> {
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);