From 8f4fb5d6320241a27d4d8c93d819daba40c58867 Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Mon, 25 Jul 2016 17:38:15 +0200 Subject: Handle changing user and admin PINs Signed-off-by: Szczepan Zalega --- NitrokeyManager.cc | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'NitrokeyManager.cc') diff --git a/NitrokeyManager.cc b/NitrokeyManager.cc index 2a0033f..2b46927 100644 --- a/NitrokeyManager.cc +++ b/NitrokeyManager.cc @@ -176,7 +176,7 @@ namespace nitrokey{ bool NitrokeyManager::authorize(const char *pin, const char *temporary_password) { auto authreq = get_payload(); - assert(strlen(pin) < sizeof authreq.card_password); //160 bits + assert(strlen(pin) < sizeof authreq.card_password); assert(strlen(temporary_password) < sizeof authreq.temporary_password); strcpyT(authreq.card_password, pin); @@ -200,5 +200,18 @@ namespace nitrokey{ return false; } + void NitrokeyManager::change_user_PIN(char *current_PIN, char *new_PIN) { + auto p = get_payload(); + strcpyT(p.old_pin, current_PIN); + strcpyT(p.new_pin, new_PIN); + ChangeUserPin::CommandTransaction::run(*device, p); + } + void NitrokeyManager::change_admin_PIN(char *current_PIN, char *new_PIN) { + auto p = get_payload(); + strcpyT(p.old_pin, current_PIN); + strcpyT(p.new_pin, new_PIN); + ChangeAdminPin::CommandTransaction::run(*device, p); + } + } \ No newline at end of file -- cgit v1.2.1