diff options
author | Szczepan Zalega <szczepan@nitrokey.com> | 2016-07-25 17:38:15 +0200 |
---|---|---|
committer | Szczepan Zalega <szczepan@nitrokey.com> | 2016-08-01 13:54:57 +0200 |
commit | 8f4fb5d6320241a27d4d8c93d819daba40c58867 (patch) | |
tree | 04d4aa7565550516756cee7687c93796892be73b /NK_C_API.cc | |
parent | 7c4012b7074252d8a5cc3b462705e171112a85bf (diff) | |
download | libnitrokey-8f4fb5d6320241a27d4d8c93d819daba40c58867.tar.gz libnitrokey-8f4fb5d6320241a27d4d8c93d819daba40c58867.tar.bz2 |
Handle changing user and admin PINs
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
Diffstat (limited to 'NK_C_API.cc')
-rw-r--r-- | NK_C_API.cc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/NK_C_API.cc b/NK_C_API.cc index 440e824..5571f0d 100644 --- a/NK_C_API.cc +++ b/NK_C_API.cc @@ -173,4 +173,29 @@ extern int NK_totp_get_time(){ return 0; } +extern int NK_change_admin_PIN(char *current_PIN, char *new_PIN){ + auto m = NitrokeyManager::instance(); + try { + m->change_admin_PIN(current_PIN, new_PIN); + } + catch (CommandFailedException & commandFailedException){ + NK_last_command_status = commandFailedException.last_command_status; + return commandFailedException.last_command_status; + } + return 0; +} + +extern int NK_change_user_PIN(char *current_PIN, char *new_PIN){ + auto m = NitrokeyManager::instance(); + try { + m->change_user_PIN(current_PIN, new_PIN); + } + catch (CommandFailedException & commandFailedException){ + NK_last_command_status = commandFailedException.last_command_status; + return commandFailedException.last_command_status; + } + return 0; +} + + }
\ No newline at end of file |