aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2017-01-30 20:31:18 +0100
committerSzczepan Zalega <szczepan@nitrokey.com>2017-03-11 15:41:40 +0100
commit48ec48d2c680b9f40d2b038fda9555bfd024bb97 (patch)
tree19fa0e7aa62f0f67da0c59f02821abbf1ef3ca30 /include
parent84a98c04c6c79455b04ba300ebfa5ec752abb721 (diff)
downloadlibnitrokey-48ec48d2c680b9f40d2b038fda9555bfd024bb97.tar.gz
libnitrokey-48ec48d2c680b9f40d2b038fda9555bfd024bb97.tar.bz2
Use local hexdumping function for getting serial number
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
Diffstat (limited to 'include')
-rw-r--r--include/stick10_commands.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/include/stick10_commands.h b/include/stick10_commands.h
index b66a9b4..8d37dbd 100644
--- a/include/stick10_commands.h
+++ b/include/stick10_commands.h
@@ -357,8 +357,14 @@ 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, false, false);
+// return ::nitrokey::misc::hexdump((const char *)(card_serial),
+// sizeof card_serial, false, false, false);
+ std::stringstream ss;
+ ss << std::hex << std::setfill('0');
+ for (int i = 0; i < sizeof(card_serial); ++i) {
+ ss << std::setw(2) << static_cast<unsigned>(card_serial[i]);
+ }
+ return ss.str();
}
std::string dissect() const {