Skip to content

Commit

Permalink
Translate HOTP counter for Storage
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
szszszsz committed Apr 14, 2017
1 parent b2dec03 commit d208963
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 7 additions & 1 deletion NitrokeyManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
1 change: 0 additions & 1 deletion build/.gitignore

This file was deleted.

0 comments on commit d208963

Please sign in to comment.