aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2017-04-15 15:37:04 +0200
committerSzczepan Zalega <szczepan@nitrokey.com>2017-05-25 13:34:49 +0200
commitb44b15f5c69c0cebdf2ce3a7005ed044d67de56b (patch)
treec104cfd8912228a8c60a25304cdc9804cf775138
parent06c0deb7935a9390a67bc02d6c323e64c785a026 (diff)
downloadlibnitrokey-b44b15f5c69c0cebdf2ce3a7005ed044d67de56b.tar.gz
libnitrokey-b44b15f5c69c0cebdf2ce3a7005ed044d67de56b.tar.bz2
Catch invalid CRC on factory reset
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
-rw-r--r--NitrokeyManager.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/NitrokeyManager.cc b/NitrokeyManager.cc
index 9a9d106..cb2d14a 100644
--- a/NitrokeyManager.cc
+++ b/NitrokeyManager.cc
@@ -652,7 +652,12 @@ using nitrokey::misc::strcpyT;
void NitrokeyManager::factory_reset(const char *admin_password) {
auto p = get_payload<FactoryReset>();
strcpyT(p.admin_password, admin_password);
+ try{
FactoryReset::CommandTransaction::run(device, p);
+ }
+ catch(InvalidCRCReceived){
+ LOG("Invalid CRC in received packet for " + std::string(__FUNCTION__), Loglevel::WARNING);
+ }
}
void NitrokeyManager::unlock_user_password(const char *admin_password, const char *new_user_password) {