aboutsummaryrefslogtreecommitdiff
path: root/NitrokeyManager.cc
diff options
context:
space:
mode:
Diffstat (limited to 'NitrokeyManager.cc')
-rw-r--r--NitrokeyManager.cc15
1 files changed, 14 insertions, 1 deletions
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<FirstAuthenticate>();
- 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<ChangeUserPin>();
+ 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<ChangeAdminPin>();
+ strcpyT(p.old_pin, current_PIN);
+ strcpyT(p.new_pin, new_PIN);
+ ChangeAdminPin::CommandTransaction::run(*device, p);
+ }
+
} \ No newline at end of file