summaryrefslogtreecommitdiff
path: root/NitrokeyManager.cc
diff options
context:
space:
mode:
Diffstat (limited to 'NitrokeyManager.cc')
-rw-r--r--NitrokeyManager.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/NitrokeyManager.cc b/NitrokeyManager.cc
index fc1daa5..ef7358f 100644
--- a/NitrokeyManager.cc
+++ b/NitrokeyManager.cc
@@ -270,6 +270,11 @@ namespace nitrokey{
}
void NitrokeyManager::enable_password_safe(const char *user_pin) {
+ //The following command will cancel enabling PWS if it is not supported
+ auto a = get_payload<IsAESSupported>();
+ strcpyT(a.user_password, user_pin);
+ IsAESSupported::CommandTransaction::run(*device, a);
+
auto p = get_payload<EnablePasswordSafe>();
strcpyT(p.user_password, user_pin);
EnablePasswordSafe::CommandTransaction::run(*device, p);
@@ -390,4 +395,14 @@ namespace nitrokey{
return v;
}
+ bool NitrokeyManager::is_AES_supported(const char *user_password) {
+ try {
+ auto a = get_payload<IsAESSupported>();
+ strcpyT(a.user_password, user_password);
+ IsAESSupported::CommandTransaction::run(*device, a);
+ }
+ catch (CommandFailedException &ex) {};
+ return device->get_last_command_status() == 0;
+ }
+
} \ No newline at end of file