summaryrefslogtreecommitdiff
path: root/include/stick10_commands.h
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2016-09-08 16:05:11 +0200
committerSzczepan Zalega <szczepan@nitrokey.com>2016-09-08 16:48:36 +0200
commitbcbb54f49fad3f4bb3e8e6aca081d9d300e74d2b (patch)
treee11e0a7458d7aae9e484722550c60292b3a6d9ba /include/stick10_commands.h
parent49de98994f234e93cc37e2f01d2927a05880a7e7 (diff)
downloadlibnitrokey-bcbb54f49fad3f4bb3e8e6aca081d9d300e74d2b.tar.gz
libnitrokey-bcbb54f49fad3f4bb3e8e6aca081d9d300e74d2b.tar.bz2
Function for getting device's serial number in hex. Fixes #33
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
Diffstat (limited to 'include/stick10_commands.h')
-rw-r--r--include/stick10_commands.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/include/stick10_commands.h b/include/stick10_commands.h
index ef83747..a60be59 100644
--- a/include/stick10_commands.h
+++ b/include/stick10_commands.h
@@ -324,15 +324,20 @@ class GetStatus : Command<CommandID::GET_STATUS> {
};
bool isValid() const { return enable_user_password!=delete_user_password; }
+ std::string get_card_serial_hex() const {
+ return ::nitrokey::misc::hexdump((const char *)(card_serial),
+ sizeof card_serial, false);
+ }
+
std::string dissect() const {
std::stringstream ss;
ss << "firmware_version:\t" << firmware_version << std::endl;
ss << "card_serial:\t"
<< ::nitrokey::misc::hexdump((const char *)(card_serial),
- sizeof card_serial);
+ sizeof card_serial, false);
ss << "general_config:\t"
<< ::nitrokey::misc::hexdump((const char *)(general_config),
- sizeof general_config);
+ sizeof general_config, false);
ss << "numlock:\t" << (int)numlock << std::endl;
ss << "capslock:\t" << (int)capslock << std::endl;
ss << "scrolllock:\t" << (int)scrolllock << std::endl;