diff options
author | Szczepan Zalega <szczepan@nitrokey.com> | 2016-08-02 13:38:22 +0200 |
---|---|---|
committer | Szczepan Zalega <szczepan@nitrokey.com> | 2016-08-05 10:17:30 +0200 |
commit | b1fbfa8eede1f2f9d003e49c027d5e4cb8a56bfe (patch) | |
tree | 4bb4e70f50de02ef09824256072f489242a13187 /NitrokeyManager.cc | |
parent | 24b1ff2b610b3af78bdb894e17a31ea937dd0d3e (diff) | |
download | libnitrokey-b1fbfa8eede1f2f9d003e49c027d5e4cb8a56bfe.tar.gz libnitrokey-b1fbfa8eede1f2f9d003e49c027d5e4cb8a56bfe.tar.bz2 |
Support for command: is_aes_supported
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
Diffstat (limited to 'NitrokeyManager.cc')
-rw-r--r-- | NitrokeyManager.cc | 15 |
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 |