diff options
| author | Szczepan Zalega <szczepan@nitrokey.com> | 2017-04-14 11:30:16 +0200 | 
|---|---|---|
| committer | Szczepan Zalega <szczepan@nitrokey.com> | 2017-04-14 11:30:16 +0200 | 
| commit | d2089636399b4b0d26f22e072a9801b915acfc74 (patch) | |
| tree | 4794fccc2c5cf4adb820edbeca2529f7b3c29df3 | |
| parent | b2dec03e9b3df59550e598906a76e51bf721afa6 (diff) | |
| download | libnitrokey-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>
| -rw-r--r-- | NitrokeyManager.cc | 8 | ||||
| -rw-r--r-- | build/.gitignore | 1 | 
2 files changed, 7 insertions, 2 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() { diff --git a/build/.gitignore b/build/.gitignore deleted file mode 100644 index 72e8ffc..0000000 --- a/build/.gitignore +++ /dev/null @@ -1 +0,0 @@ -* | 
