From d2089636399b4b0d26f22e072a9801b915acfc74 Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Fri, 14 Apr 2017 11:30:16 +0200 Subject: Translate HOTP counter for Storage Storage returns its HOTP counter as string in readslot command. This adds translating it from string to ULL. Fixes #59 Signed-off-by: Szczepan Zalega --- NitrokeyManager.cc | 8 +++++++- build/.gitignore | 1 - 2 files changed, 7 insertions(+), 2 deletions(-) delete mode 100644 build/.gitignore diff --git a/NitrokeyManager.cc b/NitrokeyManager.cc index 3af74ea..faeaf03 100644 --- a/NitrokeyManager.cc +++ b/NitrokeyManager.cc @@ -860,7 +860,13 @@ namespace nitrokey{ } stick10::ReadSlot::ResponsePayload NitrokeyManager::get_HOTP_slot_data(const uint8_t slot_number) { - return get_OTP_slot_data(get_internal_slot_number_for_hotp(slot_number)); + auto slot_data = get_OTP_slot_data(get_internal_slot_number_for_hotp(slot_number)); + if (device->get_device_model() == DeviceModel::STORAGE){ + //convert counter from string to ull + auto counter_s = std::string(slot_data.slot_counter_s, slot_data.slot_counter_s+sizeof(slot_data.slot_counter_s)); + slot_data.slot_counter = std::stoull(counter_s); + } + return slot_data; } void NitrokeyManager::lock_encrypted_volume() { diff --git a/build/.gitignore b/build/.gitignore deleted file mode 100644 index 72e8ffc..0000000 --- a/build/.gitignore +++ /dev/null @@ -1 +0,0 @@ -* -- cgit v1.2.3