diff options
author | Szczepan Zalega <szczepan@nitrokey.com> | 2017-02-17 16:29:21 +0100 |
---|---|---|
committer | Szczepan Zalega <szczepan@nitrokey.com> | 2017-03-11 15:41:47 +0100 |
commit | 5650e48b114529075d89dbdde0330901351b8460 (patch) | |
tree | c07b6715adaa10bafd76841ef1226a3659ca7d9d /NitrokeyManager.cc | |
parent | 4e26fdee0c1435016d6642cf8c1f88c3dd5495fa (diff) | |
download | libnitrokey-5650e48b114529075d89dbdde0330901351b8460.tar.gz libnitrokey-5650e48b114529075d89dbdde0330901351b8460.tar.bz2 |
Get proper card serial for Storage. Get serial as one number.
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
Diffstat (limited to 'NitrokeyManager.cc')
-rw-r--r-- | NitrokeyManager.cc | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/NitrokeyManager.cc b/NitrokeyManager.cc index 20d1a98..ac1074b 100644 --- a/NitrokeyManager.cc +++ b/NitrokeyManager.cc @@ -138,9 +138,22 @@ namespace nitrokey{ } } + string NitrokeyManager::get_serial_number() { - auto response = GetStatus::CommandTransaction::run(device); - return response.data().get_card_serial_hex(); + switch (device->get_device_model()) { + case DeviceModel::PRO: { + auto response = GetStatus::CommandTransaction::run(device); + return nitrokey::misc::toHex(response.data().card_serial_i); + } + break; + + case DeviceModel::STORAGE: + { + auto response = stick20::GetDeviceStatus::CommandTransaction::run(device); + return nitrokey::misc::toHex(response.data().ActiveSmartCardID_u32); + } + break; + } } stick10::GetStatus::ResponsePayload NitrokeyManager::get_status(){ |