summaryrefslogtreecommitdiff
path: root/NitrokeyManager.cc
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2016-07-27 10:32:30 +0200
committerSzczepan Zalega <szczepan@nitrokey.com>2016-08-01 13:54:57 +0200
commit8c5b24092faf90672523e60e6eee12a83539ce11 (patch)
tree804244fd1cacc670b8fc5e58264a24d27e269084 /NitrokeyManager.cc
parentae8f2596895ba27539409b2399d985b2c613e2d7 (diff)
downloadlibnitrokey-8c5b24092faf90672523e60e6eee12a83539ce11.tar.gz
libnitrokey-8c5b24092faf90672523e60e6eee12a83539ce11.tar.bz2
Handle write config command
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
Diffstat (limited to 'NitrokeyManager.cc')
-rw-r--r--NitrokeyManager.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/NitrokeyManager.cc b/NitrokeyManager.cc
index 31436e5..53e355e 100644
--- a/NitrokeyManager.cc
+++ b/NitrokeyManager.cc
@@ -60,6 +60,7 @@ namespace nitrokey{
auto gh = get_payload<GetHOTP>();
gh.slot_number = get_internal_slot_number_for_hotp(slot_number);
auto resp = GetHOTP::CommandTransaction::run(*device, gh);
+ //TODO handle user authorization requests (taken from config)
return resp.code;
}
@@ -79,6 +80,7 @@ namespace nitrokey{
gt.last_interval = last_interval;
gt.last_totp_time = last_totp_time;
auto resp = GetTOTP::CommandTransaction::run(*device, gt);
+ //TODO handle user authorization requests (taken from config)
return resp.code;
}
@@ -319,4 +321,20 @@ namespace nitrokey{
UnlockUserPassword::CommandTransaction::run(*device, p);
}
+ void NitrokeyManager::write_config(bool numlock, bool capslock, bool scrolllock, bool enable_user_password, bool delete_user_password, const char *admin_temporary_password) {
+ auto p = get_payload<WriteGeneralConfig>();
+ p.numlock = (uint8_t) numlock;
+ p.capslock = (uint8_t) capslock;
+ p.scrolllock = (uint8_t) scrolllock;
+ p.enable_user_password = (uint8_t) enable_user_password;
+ p.delete_user_password = (uint8_t) delete_user_password;
+
+ auto auth = get_payload<Authorize>();
+ strcpyT(auth.temporary_password, admin_temporary_password);
+ auth.crc_to_authorize = WriteGeneralConfig::CommandTransaction::getCRC(p);
+ Authorize::CommandTransaction::run(*device, auth);
+
+ WriteGeneralConfig::CommandTransaction::run(*device, p);
+ }
+
} \ No newline at end of file