summaryrefslogtreecommitdiff
path: root/NitrokeyManager.cc
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2017-04-14 11:30:16 +0200
committerSzczepan Zalega <szczepan@nitrokey.com>2017-04-14 11:30:16 +0200
commitd2089636399b4b0d26f22e072a9801b915acfc74 (patch)
tree4794fccc2c5cf4adb820edbeca2529f7b3c29df3 /NitrokeyManager.cc
parentb2dec03e9b3df59550e598906a76e51bf721afa6 (diff)
downloadlibnitrokey-d2089636399b4b0d26f22e072a9801b915acfc74.tar.gz
libnitrokey-d2089636399b4b0d26f22e072a9801b915acfc74.tar.bz2
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 <szczepan@nitrokey.com>
Diffstat (limited to 'NitrokeyManager.cc')
-rw-r--r--NitrokeyManager.cc8
1 files changed, 7 insertions, 1 deletions
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() {